mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-04 19:11:57 +08:00
chore: upgrade to eslint9 (#9163)
This commit is contained in:
@@ -1,17 +0,0 @@
|
|||||||
node_modules
|
|
||||||
dist
|
|
||||||
.next
|
|
||||||
out
|
|
||||||
storybook-static
|
|
||||||
affine-out
|
|
||||||
_next
|
|
||||||
lib
|
|
||||||
.eslintrc.js
|
|
||||||
e2e-dist-*
|
|
||||||
static
|
|
||||||
web-static
|
|
||||||
public
|
|
||||||
packages/frontend/i18n/src/i18n-generated.ts
|
|
||||||
packages/frontend/i18n/src/i18n-completenesses.json
|
|
||||||
packages/frontend/templates/*.gen.ts
|
|
||||||
packages/frontend/apps/android/App/app/build
|
|
||||||
-249
@@ -1,249 +0,0 @@
|
|||||||
const { join } = require('node:path');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {import('eslint').Linter.Config}
|
|
||||||
*/
|
|
||||||
const config = {
|
|
||||||
root: true,
|
|
||||||
settings: {
|
|
||||||
react: {
|
|
||||||
version: 'detect',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:react-hooks/recommended',
|
|
||||||
'plugin:react/recommended',
|
|
||||||
'plugin:react/jsx-runtime',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'prettier',
|
|
||||||
],
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
parserOptions: {
|
|
||||||
ecmaFeatures: {
|
|
||||||
globalReturn: false,
|
|
||||||
impliedStrict: true,
|
|
||||||
jsx: true,
|
|
||||||
},
|
|
||||||
ecmaVersion: 'latest',
|
|
||||||
sourceType: 'module',
|
|
||||||
project: join(__dirname, 'tsconfig.eslint.json'),
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
'react',
|
|
||||||
'@typescript-eslint',
|
|
||||||
'sonarjs',
|
|
||||||
'import-x',
|
|
||||||
'rxjs',
|
|
||||||
'unicorn',
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
// enabled in oxlint
|
|
||||||
'array-callback-return': 'off',
|
|
||||||
'constructor-super': 'off',
|
|
||||||
eqeqeq: 'off',
|
|
||||||
'getter-return': 'off',
|
|
||||||
'for-direction': 'off',
|
|
||||||
'require-yield': 'off',
|
|
||||||
'use-isnan': 'off',
|
|
||||||
'valid-typeof': 'off',
|
|
||||||
'no-self-compare': 'off',
|
|
||||||
'no-empty': 'off',
|
|
||||||
'no-constant-binary-expression': 'off',
|
|
||||||
'no-constructor-return': 'off',
|
|
||||||
'no-func-assign': 'off',
|
|
||||||
'no-global-assign': 'off',
|
|
||||||
'no-ex-assign': 'off',
|
|
||||||
'no-fallthrough': 'off',
|
|
||||||
'no-irregular-whitespace': 'off',
|
|
||||||
'no-control-regex': 'off',
|
|
||||||
'no-with': 'off',
|
|
||||||
'no-debugger': 'off',
|
|
||||||
'no-const-assign': 'off',
|
|
||||||
'no-import-assign': 'off',
|
|
||||||
'no-setter-return': 'off',
|
|
||||||
'no-obj-calls': 'off',
|
|
||||||
'no-unsafe-negation': 'off',
|
|
||||||
'no-dupe-class-members': 'off',
|
|
||||||
'no-dupe-keys': 'off',
|
|
||||||
'no-this-before-super': 'off',
|
|
||||||
'no-empty-character-class': 'off',
|
|
||||||
'no-useless-catch': 'off',
|
|
||||||
'no-async-promise-executor': 'off',
|
|
||||||
'no-unreachable': 'off',
|
|
||||||
'no-duplicate-case': 'off',
|
|
||||||
'no-empty-pattern': 'off',
|
|
||||||
'no-unused-labels': 'off',
|
|
||||||
'no-sparse-arrays': 'off',
|
|
||||||
'no-delete-var': 'off',
|
|
||||||
'no-compare-neg-zero': 'off',
|
|
||||||
'no-redeclare': 'off',
|
|
||||||
'no-case-declarations': 'off',
|
|
||||||
'no-class-assign': 'off',
|
|
||||||
'no-var': 'off',
|
|
||||||
'no-self-assign': 'off',
|
|
||||||
'no-inner-declarations': 'off',
|
|
||||||
'no-dupe-else-if': 'off',
|
|
||||||
'no-invalid-regexp': 'off',
|
|
||||||
'no-unsafe-finally': 'off',
|
|
||||||
'no-prototype-builtins': 'off',
|
|
||||||
'no-shadow-restricted-names': 'off',
|
|
||||||
'no-nonoctal-decimal-escape': 'off',
|
|
||||||
'no-constant-condition': 'off',
|
|
||||||
'no-useless-escape': 'off',
|
|
||||||
'no-unsafe-optional-chaining': 'off',
|
|
||||||
'no-extra-boolean-cast': 'off',
|
|
||||||
'no-regex-spaces': 'off',
|
|
||||||
'react/jsx-no-useless-fragment': 'off',
|
|
||||||
'react/no-unknown-property': 'off',
|
|
||||||
'react/no-string-refs': 'off',
|
|
||||||
'react/no-direct-mutation-state': 'off',
|
|
||||||
'react/require-render-return': 'off',
|
|
||||||
'react/jsx-no-undef': 'off',
|
|
||||||
'react/jsx-no-duplicate-props': 'off',
|
|
||||||
'react/jsx-key': 'off',
|
|
||||||
'react/no-danger-with-children': 'off',
|
|
||||||
'react/no-unescaped-entities': 'off',
|
|
||||||
'react/no-is-mounted': 'off',
|
|
||||||
'react/no-find-dom-node': 'off',
|
|
||||||
'react/no-children-prop': 'off',
|
|
||||||
'react/no-render-return-value': 'off',
|
|
||||||
'react/jsx-no-target-blank': 'off',
|
|
||||||
'react/jsx-no-comment-textnodes': 'off',
|
|
||||||
'sonarjs/no-useless-catch': 'off',
|
|
||||||
'@typescript-eslint/consistent-type-imports': 'off',
|
|
||||||
'@typescript-eslint/no-unused-vars': 'off',
|
|
||||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
||||||
'@typescript-eslint/no-loss-of-precision': 'off',
|
|
||||||
'@typescript-eslint/ban-ts-comment': 'off',
|
|
||||||
'@typescript-eslint/triple-slash-reference': 'off',
|
|
||||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
|
||||||
'@typescript-eslint/no-duplicate-enum-values': 'off',
|
|
||||||
'@typescript-eslint/no-extra-non-null-assertion': 'off',
|
|
||||||
'@typescript-eslint/no-misused-new': 'off',
|
|
||||||
'@typescript-eslint/prefer-for-of': 'off',
|
|
||||||
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
|
|
||||||
'@typescript-eslint/no-this-alias': 'off',
|
|
||||||
'@typescript-eslint/prefer-as-const': 'off',
|
|
||||||
'@typescript-eslint/no-var-requires': 'off',
|
|
||||||
'@typescript-eslint/no-namespace': 'off',
|
|
||||||
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
|
|
||||||
'@typescript-eslint/no-array-constructor': 'off',
|
|
||||||
'@typescript-eslint/ban-types': 'off',
|
|
||||||
// enable in typescript-eslint
|
|
||||||
'no-undef': 'off',
|
|
||||||
'no-cond-assign': 'off',
|
|
||||||
'react/prop-types': 'off',
|
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
|
||||||
'@typescript-eslint/no-empty-function': 'off',
|
|
||||||
'@typescript-eslint/await-thenable': 'error',
|
|
||||||
'@typescript-eslint/require-array-sort-compare': 'error',
|
|
||||||
'@typescript-eslint/unified-signatures': 'error',
|
|
||||||
'@typescript-eslint/prefer-for-of': 'error',
|
|
||||||
'@typescript-eslint/no-restricted-imports': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
patterns: [
|
|
||||||
{
|
|
||||||
group: ['**/dist'],
|
|
||||||
message: "Don't import from dist",
|
|
||||||
allowTypeImports: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
group: ['**/src'],
|
|
||||||
message: "Don't import from src",
|
|
||||||
allowTypeImports: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
group: ['@blocksuite/store'],
|
|
||||||
message: "Import from '@blocksuite/global/utils'",
|
|
||||||
importNames: ['assertExists', 'assertEquals'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
'sonarjs/no-all-duplicated-branches': 'error',
|
|
||||||
'sonarjs/no-element-overwrite': 'error',
|
|
||||||
'sonarjs/no-empty-collection': 'error',
|
|
||||||
'sonarjs/no-extra-arguments': 'error',
|
|
||||||
'sonarjs/no-identical-conditions': 'error',
|
|
||||||
'sonarjs/no-identical-expressions': 'error',
|
|
||||||
'sonarjs/no-ignored-return': 'error',
|
|
||||||
'sonarjs/no-one-iteration-loop': 'error',
|
|
||||||
'sonarjs/no-use-of-empty-return-value': 'error',
|
|
||||||
'sonarjs/non-existent-operator': 'error',
|
|
||||||
'sonarjs/no-collapsible-if': 'error',
|
|
||||||
'sonarjs/no-same-line-conditional': 'error',
|
|
||||||
'sonarjs/no-duplicated-branches': 'error',
|
|
||||||
'sonarjs/no-collection-size-mischeck': 'error',
|
|
||||||
'sonarjs/no-identical-functions': 'error',
|
|
||||||
'rxjs/finnish': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
functions: false,
|
|
||||||
methods: false,
|
|
||||||
strict: true,
|
|
||||||
types: {
|
|
||||||
'^LiveData$': true,
|
|
||||||
// some yjs classes are Observables, but they don't need to be in Finnish notation
|
|
||||||
'^Doc$': false, // yjs Doc
|
|
||||||
'^Awareness$': false, // yjs Awareness
|
|
||||||
'^UndoManager$': false, // yjs UndoManager
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: [
|
|
||||||
`packages/**/*.{ts,tsx,js,mjs}`,
|
|
||||||
'tools/cli/**/*.{ts,tsx,js,mjs}',
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
'@typescript-eslint/no-floating-promises': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
ignoreVoid: false,
|
|
||||||
ignoreIIFE: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'@typescript-eslint/no-misused-promises': ['error'],
|
|
||||||
'@typescript-eslint/prefer-readonly': 'error',
|
|
||||||
'import-x/no-extraneous-dependencies': ['error'],
|
|
||||||
'react-hooks/exhaustive-deps': [
|
|
||||||
'warn',
|
|
||||||
{
|
|
||||||
additionalHooks:
|
|
||||||
'(useAsyncCallback|useCatchEventCallback|useDraggable|useDropTarget|useRefEffect)',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: [
|
|
||||||
'**/__tests__/**/*',
|
|
||||||
'**/*.stories.tsx',
|
|
||||||
'**/*.spec.ts',
|
|
||||||
'**/tests/**/*',
|
|
||||||
'scripts/**/*',
|
|
||||||
'**/benchmark/**/*',
|
|
||||||
'**/__debug__/**/*',
|
|
||||||
'**/e2e/**/*',
|
|
||||||
],
|
|
||||||
rules: {
|
|
||||||
'@typescript-eslint/no-floating-promises': 0,
|
|
||||||
'@typescript-eslint/no-misused-promises': 0,
|
|
||||||
'@typescript-eslint/no-restricted-imports': 0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
files: ['packages/frontend/apps/electron/scripts/**/*'],
|
|
||||||
rules: {
|
|
||||||
'import-x/no-extraneous-dependencies': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = config;
|
|
||||||
@@ -0,0 +1,285 @@
|
|||||||
|
import eslint from '@eslint/js';
|
||||||
|
import rxjs from '@smarttools/eslint-plugin-rxjs';
|
||||||
|
import tsParser from '@typescript-eslint/parser';
|
||||||
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||||
|
import importX from 'eslint-plugin-import-x';
|
||||||
|
import react from 'eslint-plugin-react';
|
||||||
|
import reactHooks from 'eslint-plugin-react-hooks';
|
||||||
|
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
||||||
|
import sonarjs from 'eslint-plugin-sonarjs';
|
||||||
|
import unicorn from 'eslint-plugin-unicorn';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
'**/node_modules',
|
||||||
|
'**/dist',
|
||||||
|
'**/.next',
|
||||||
|
'**/out',
|
||||||
|
'**/storybook-static',
|
||||||
|
'**/affine-out',
|
||||||
|
'**/_next',
|
||||||
|
'**/lib',
|
||||||
|
'**/.eslintrc.js',
|
||||||
|
'**/e2e-dist-*',
|
||||||
|
'**/static',
|
||||||
|
'**/web-static',
|
||||||
|
'**/public',
|
||||||
|
'**/.coverage',
|
||||||
|
'.nx/**',
|
||||||
|
'.yarn/**',
|
||||||
|
'**/*.d.ts',
|
||||||
|
'.github/**/*',
|
||||||
|
'packages/frontend/component/.storybook/**/*',
|
||||||
|
'packages/frontend/i18n/src/i18n-generated.ts',
|
||||||
|
'packages/frontend/i18n/src/i18n-completenesses.json',
|
||||||
|
'packages/frontend/templates/*.gen.ts',
|
||||||
|
'packages/frontend/apps/android/App/app/build/**',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: 'detect',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
parserOptions: {
|
||||||
|
project: './tsconfig.eslint.json',
|
||||||
|
tsconfigRootDir: import.meta.dirname,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
plugins: {
|
||||||
|
'@typescript-eslint': tseslint.plugin,
|
||||||
|
react,
|
||||||
|
'react-hooks': reactHooks,
|
||||||
|
sonarjs,
|
||||||
|
'import-x': importX,
|
||||||
|
'simple-import-sort': simpleImportSort,
|
||||||
|
rxjs,
|
||||||
|
unicorn,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...eslint.configs.recommended.rules,
|
||||||
|
...react.configs.recommended.rules,
|
||||||
|
...react.configs['jsx-runtime'].rules,
|
||||||
|
...reactHooks.configs.recommended.rules,
|
||||||
|
// the following rules are disabled because they are covered by oxlint
|
||||||
|
'array-callback-return': 'off',
|
||||||
|
'constructor-super': 'off',
|
||||||
|
eqeqeq: 'off',
|
||||||
|
'getter-return': 'off',
|
||||||
|
'for-direction': 'off',
|
||||||
|
'require-yield': 'off',
|
||||||
|
'use-isnan': 'off',
|
||||||
|
'valid-typeof': 'off',
|
||||||
|
'no-self-compare': 'off',
|
||||||
|
'no-empty': 'off',
|
||||||
|
'no-constant-binary-expression': 'off',
|
||||||
|
'no-constructor-return': 'off',
|
||||||
|
'no-func-assign': 'off',
|
||||||
|
'no-global-assign': 'off',
|
||||||
|
'no-ex-assign': 'off',
|
||||||
|
'no-fallthrough': 'off',
|
||||||
|
'no-irregular-whitespace': 'off',
|
||||||
|
'no-control-regex': 'off',
|
||||||
|
'no-with': 'off',
|
||||||
|
'no-debugger': 'off',
|
||||||
|
'no-const-assign': 'off',
|
||||||
|
'no-import-assign': 'off',
|
||||||
|
'no-setter-return': 'off',
|
||||||
|
'no-obj-calls': 'off',
|
||||||
|
'no-unsafe-negation': 'off',
|
||||||
|
'no-dupe-class-members': 'off',
|
||||||
|
'no-dupe-keys': 'off',
|
||||||
|
'no-this-before-super': 'off',
|
||||||
|
'no-empty-character-class': 'off',
|
||||||
|
'no-useless-catch': 'off',
|
||||||
|
'no-async-promise-executor': 'off',
|
||||||
|
'no-unreachable': 'off',
|
||||||
|
'no-duplicate-case': 'off',
|
||||||
|
'no-empty-pattern': 'off',
|
||||||
|
'no-unused-labels': 'off',
|
||||||
|
'no-sparse-arrays': 'off',
|
||||||
|
'no-delete-var': 'off',
|
||||||
|
'no-compare-neg-zero': 'off',
|
||||||
|
'no-redeclare': 'off',
|
||||||
|
'no-case-declarations': 'off',
|
||||||
|
'no-class-assign': 'off',
|
||||||
|
'no-var': 'off',
|
||||||
|
'no-self-assign': 'off',
|
||||||
|
'no-inner-declarations': 'off',
|
||||||
|
'no-dupe-else-if': 'off',
|
||||||
|
'no-invalid-regexp': 'off',
|
||||||
|
'no-unsafe-finally': 'off',
|
||||||
|
'no-prototype-builtins': 'off',
|
||||||
|
'no-shadow-restricted-names': 'off',
|
||||||
|
'no-nonoctal-decimal-escape': 'off',
|
||||||
|
'no-constant-condition': 'off',
|
||||||
|
'no-useless-escape': 'off',
|
||||||
|
'no-unsafe-optional-chaining': 'off',
|
||||||
|
'no-extra-boolean-cast': 'off',
|
||||||
|
'no-regex-spaces': 'off',
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'no-undef': 'off',
|
||||||
|
'no-cond-assign': 'off',
|
||||||
|
'react/jsx-no-useless-fragment': 'off',
|
||||||
|
'react/no-unknown-property': 'off',
|
||||||
|
'react/no-string-refs': 'off',
|
||||||
|
'react/no-direct-mutation-state': 'off',
|
||||||
|
'react/require-render-return': 'off',
|
||||||
|
'react/jsx-no-undef': 'off',
|
||||||
|
'react/jsx-no-duplicate-props': 'off',
|
||||||
|
'react/jsx-key': 'off',
|
||||||
|
'react/no-danger-with-children': 'off',
|
||||||
|
'react/no-unescaped-entities': 'off',
|
||||||
|
'react/no-is-mounted': 'off',
|
||||||
|
'react/no-find-dom-node': 'off',
|
||||||
|
'react/no-children-prop': 'off',
|
||||||
|
'react/no-render-return-value': 'off',
|
||||||
|
'react/jsx-no-target-blank': 'off',
|
||||||
|
'react/jsx-no-comment-textnodes': 'off',
|
||||||
|
'react/prop-types': 'off',
|
||||||
|
'sonarjs/no-useless-catch': 'off',
|
||||||
|
'@typescript-eslint/consistent-type-imports': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/no-loss-of-precision': 'off',
|
||||||
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
|
'@typescript-eslint/triple-slash-reference': 'off',
|
||||||
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
||||||
|
'@typescript-eslint/no-duplicate-enum-values': 'off',
|
||||||
|
'@typescript-eslint/no-extra-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/no-misused-new': 'off',
|
||||||
|
'@typescript-eslint/prefer-for-of': 'error',
|
||||||
|
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
|
||||||
|
'@typescript-eslint/no-this-alias': 'off',
|
||||||
|
'@typescript-eslint/prefer-as-const': 'off',
|
||||||
|
'@typescript-eslint/no-var-requires': 'off',
|
||||||
|
'@typescript-eslint/no-namespace': 'off',
|
||||||
|
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
|
||||||
|
'@typescript-eslint/no-array-constructor': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
|
||||||
|
// rules that are not supported by oxlint
|
||||||
|
'@typescript-eslint/no-unsafe-function-type': 'error',
|
||||||
|
'@typescript-eslint/no-wrapper-object-types': 'error',
|
||||||
|
'@typescript-eslint/unified-signatures': 'error',
|
||||||
|
'@typescript-eslint/no-restricted-imports': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
group: ['**/dist'],
|
||||||
|
message: "Don't import from dist",
|
||||||
|
allowTypeImports: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: ['**/src'],
|
||||||
|
message: "Don't import from src",
|
||||||
|
allowTypeImports: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
group: ['@blocksuite/store'],
|
||||||
|
message: "Import from '@blocksuite/global/utils'",
|
||||||
|
importNames: ['assertExists', 'assertEquals'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'sonarjs/no-all-duplicated-branches': 'error',
|
||||||
|
'sonarjs/no-element-overwrite': 'error',
|
||||||
|
'sonarjs/no-empty-collection': 'error',
|
||||||
|
'sonarjs/no-extra-arguments': 'error',
|
||||||
|
'sonarjs/no-identical-conditions': 'error',
|
||||||
|
'sonarjs/no-identical-expressions': 'error',
|
||||||
|
'sonarjs/no-ignored-return': 'error',
|
||||||
|
'sonarjs/no-one-iteration-loop': 'error',
|
||||||
|
'sonarjs/no-use-of-empty-return-value': 'error',
|
||||||
|
'sonarjs/non-existent-operator': 'error',
|
||||||
|
'sonarjs/no-collapsible-if': 'error',
|
||||||
|
'sonarjs/no-same-line-conditional': 'error',
|
||||||
|
'sonarjs/no-duplicated-branches': 'error',
|
||||||
|
'sonarjs/no-collection-size-mischeck': 'error',
|
||||||
|
'sonarjs/no-identical-functions': 'error',
|
||||||
|
|
||||||
|
'simple-import-sort/imports': 'error',
|
||||||
|
'simple-import-sort/exports': 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['packages/**/*.{ts,tsx}', 'tools/cli/**/*.{ts,tsx}'],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-floating-promises': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
ignoreVoid: false,
|
||||||
|
ignoreIIFE: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@typescript-eslint/await-thenable': 'error',
|
||||||
|
'@typescript-eslint/require-array-sort-compare': 'error',
|
||||||
|
'@typescript-eslint/no-misused-promises': ['error'],
|
||||||
|
'@typescript-eslint/prefer-readonly': 'error',
|
||||||
|
'import-x/no-extraneous-dependencies': ['error'],
|
||||||
|
'react-hooks/exhaustive-deps': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
additionalHooks:
|
||||||
|
'(useAsyncCallback|useCatchEventCallback|useDraggable|useDropTarget|useRefEffect)',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'rxjs/finnish': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
functions: false,
|
||||||
|
methods: false,
|
||||||
|
strict: true,
|
||||||
|
|
||||||
|
types: {
|
||||||
|
'^LiveData$': true,
|
||||||
|
'^Doc$': false,
|
||||||
|
'^Awareness$': false,
|
||||||
|
'^UndoManager$': false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
'**/__tests__/**/*',
|
||||||
|
'**/*.stories.tsx',
|
||||||
|
'**/*.spec.ts',
|
||||||
|
'**/tests/**/*',
|
||||||
|
'scripts/**/*',
|
||||||
|
'**/benchmark/**/*',
|
||||||
|
'**/__debug__/**/*',
|
||||||
|
'**/e2e/**/*',
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-floating-promises': 0,
|
||||||
|
'@typescript-eslint/no-misused-promises': 0,
|
||||||
|
'@typescript-eslint/no-restricted-imports': 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.{ts,js,mjs}'],
|
||||||
|
rules: {
|
||||||
|
'react-hooks/rules-of-hooks': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['packages/frontend/apps/electron/scripts/**/*'],
|
||||||
|
rules: {
|
||||||
|
'import-x/no-extraneous-dependencies': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
eslintConfigPrettier
|
||||||
|
);
|
||||||
+1
-1
@@ -10,6 +10,7 @@
|
|||||||
"import/named": "allow",
|
"import/named": "allow",
|
||||||
"no-await-in-loop": "allow",
|
"no-await-in-loop": "allow",
|
||||||
"promise/no-callback-in-promise": "allow",
|
"promise/no-callback-in-promise": "allow",
|
||||||
|
"typescript/ban-types": "allow",
|
||||||
|
|
||||||
"array-callback-return": "error",
|
"array-callback-return": "error",
|
||||||
"constructor-super": "error",
|
"constructor-super": "error",
|
||||||
@@ -99,7 +100,6 @@
|
|||||||
"typescript/prefer-for-of": "error",
|
"typescript/prefer-for-of": "error",
|
||||||
"typescript/no-unsafe-declaration-merging": "error",
|
"typescript/no-unsafe-declaration-merging": "error",
|
||||||
"typescript/no-unnecessary-type-constraint": "error",
|
"typescript/no-unnecessary-type-constraint": "error",
|
||||||
"typescript/ban-types": "error",
|
|
||||||
"typescript/no-this-alias": [
|
"typescript/no-this-alias": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
|||||||
+9
-7
@@ -25,7 +25,7 @@
|
|||||||
"build:server-native": "yarn nx run-many -t build -p @affine/server-native",
|
"build:server-native": "yarn nx run-many -t build -p @affine/server-native",
|
||||||
"start:web-static": "yarn workspace @affine/web static-server",
|
"start:web-static": "yarn workspace @affine/web static-server",
|
||||||
"serve:test-static": "yarn exec serve tests/fixtures --cors -p 8081",
|
"serve:test-static": "yarn exec serve tests/fixtures --cors -p 8081",
|
||||||
"lint:eslint": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" eslint . --ext .js,mjs,.ts,.tsx --cache",
|
"lint:eslint": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" eslint --report-unused-disable-directives-severity=off . --cache",
|
||||||
"lint:eslint:fix": "yarn lint:eslint --fix",
|
"lint:eslint:fix": "yarn lint:eslint --fix",
|
||||||
"lint:prettier": "prettier --ignore-unknown --cache --check .",
|
"lint:prettier": "prettier --ignore-unknown --cache --check .",
|
||||||
"lint:prettier:fix": "prettier --ignore-unknown --cache --write .",
|
"lint:prettier:fix": "prettier --ignore-unknown --cache --write .",
|
||||||
@@ -55,29 +55,30 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@affine/cli": "workspace:*",
|
"@affine/cli": "workspace:*",
|
||||||
"@capacitor/cli": "^6.2.0",
|
"@capacitor/cli": "^6.2.0",
|
||||||
|
"@eslint/js": "^9.16.0",
|
||||||
"@faker-js/faker": "^9.3.0",
|
"@faker-js/faker": "^9.3.0",
|
||||||
"@istanbuljs/schema": "^0.1.3",
|
"@istanbuljs/schema": "^0.1.3",
|
||||||
"@magic-works/i18n-codegen": "^0.6.1",
|
"@magic-works/i18n-codegen": "^0.6.1",
|
||||||
"@playwright/test": "=1.49.1",
|
"@playwright/test": "=1.49.1",
|
||||||
|
"@smarttools/eslint-plugin-rxjs": "^1.0.8",
|
||||||
"@swc/core": "^1.10.1",
|
"@swc/core": "^1.10.1",
|
||||||
"@taplo/cli": "^0.7.0",
|
"@taplo/cli": "^0.7.0",
|
||||||
"@toeverything/infra": "workspace:*",
|
"@toeverything/infra": "workspace:*",
|
||||||
"@types/affine__env": "workspace:*",
|
"@types/affine__env": "workspace:*",
|
||||||
"@types/eslint": "^9.6.1",
|
"@types/eslint": "^9.6.1",
|
||||||
"@types/node": "^20.17.10",
|
"@types/node": "^20.17.10",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
"@typescript-eslint/parser": "^8.18.0",
|
||||||
"@typescript-eslint/parser": "^7.18.0",
|
|
||||||
"@vanilla-extract/vite-plugin": "^4.0.18",
|
"@vanilla-extract/vite-plugin": "^4.0.18",
|
||||||
"@vitest/coverage-istanbul": "2.1.8",
|
"@vitest/coverage-istanbul": "2.1.8",
|
||||||
"@vitest/ui": "2.1.8",
|
"@vitest/ui": "2.1.8",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"electron": "^33.3.0",
|
"electron": "^33.3.0",
|
||||||
"eslint": "^8.57.1",
|
"eslint": "^9.16.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-plugin-import-x": "^0.5.3",
|
"eslint-plugin-import-x": "^4.5.0",
|
||||||
"eslint-plugin-react": "^7.37.2",
|
"eslint-plugin-react": "^7.37.2",
|
||||||
"eslint-plugin-react-hooks": "^4.6.2",
|
"eslint-plugin-react-hooks": "^5.1.0",
|
||||||
"eslint-plugin-rxjs": "^5.0.3",
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||||
"eslint-plugin-sonarjs": "^3.0.1",
|
"eslint-plugin-sonarjs": "^3.0.1",
|
||||||
"eslint-plugin-unicorn": "^56.0.1",
|
"eslint-plugin-unicorn": "^56.0.1",
|
||||||
"happy-dom": "^15.11.7",
|
"happy-dom": "^15.11.7",
|
||||||
@@ -91,6 +92,7 @@
|
|||||||
"semver": "^7.6.3",
|
"semver": "^7.6.3",
|
||||||
"serve": "^14.2.4",
|
"serve": "^14.2.4",
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.7.2",
|
||||||
|
"typescript-eslint": "^8.18.0",
|
||||||
"unplugin-swc": "^1.5.1",
|
"unplugin-swc": "^1.5.1",
|
||||||
"vite": "^6.0.3",
|
"vite": "^6.0.3",
|
||||||
"vitest": "2.1.8"
|
"vitest": "2.1.8"
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ export class FalProvider
|
|||||||
metrics.ai.counter('chat_text_stream_calls').add(1, { model });
|
metrics.ai.counter('chat_text_stream_calls').add(1, { model });
|
||||||
const result = await this.generateText(messages, model, options);
|
const result = await this.generateText(messages, model, options);
|
||||||
|
|
||||||
for await (const content of result) {
|
for (const content of result) {
|
||||||
if (content) {
|
if (content) {
|
||||||
yield content;
|
yield content;
|
||||||
if (options.signal?.aborted) {
|
if (options.signal?.aborted) {
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ export class OIDCProvider
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
override async onModuleInit() {
|
override async onModuleInit() {
|
||||||
const config = this.optionalConfig as OAuthOIDCProviderConfig;
|
const config = this.optionalConfig as OAuthOIDCProviderConfig;
|
||||||
if (config && config.issuer && config.clientId && config.clientSecret) {
|
if (config && config.issuer && config.clientId && config.clientSecret) {
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ export class MockCopilotTestProvider
|
|||||||
// make some time gap for history test case
|
// make some time gap for history test case
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
const result = 'generate text to text stream';
|
const result = 'generate text to text stream';
|
||||||
for await (const message of result) {
|
for (const message of result) {
|
||||||
yield message;
|
yield message;
|
||||||
if (options.signal?.aborted) {
|
if (options.signal?.aborted) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { CONSTRUCTOR_CONTEXT } from '../constructor-context';
|
import { CONSTRUCTOR_CONTEXT } from '../constructor-context';
|
||||||
import type { FrameworkProvider } from '../provider';
|
import type { FrameworkProvider } from '../provider';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
export class Component<Props = {}> {
|
export class Component<Props = {}> {
|
||||||
readonly framework: FrameworkProvider;
|
readonly framework: FrameworkProvider;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Component } from './component';
|
import { Component } from './component';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
export class Entity<Props = {}> extends Component<Props> {
|
export class Entity<Props = {}> extends Component<Props> {
|
||||||
readonly __isEntity = true;
|
readonly __isEntity = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Component } from './component';
|
import { Component } from './component';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
export class Scope<Props = {}> extends Component<Props> {
|
export class Scope<Props = {}> extends Component<Props> {
|
||||||
readonly __injectable = true;
|
readonly __injectable = true;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import type { FrameworkProvider } from './provider';
|
import type { FrameworkProvider } from './provider';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
export type Type<T = any> = abstract new (...args: any) => T;
|
export type Type<T = any> = abstract new (...args: any) => T;
|
||||||
|
|
||||||
export type ComponentFactory<T = any> = (provider: FrameworkProvider) => T;
|
export type ComponentFactory<T = any> = (provider: FrameworkProvider) => T;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ export function useFramework(): FrameworkProvider {
|
|||||||
export function useService<T extends Service>(
|
export function useService<T extends Service>(
|
||||||
identifier: GeneralIdentifier<T>
|
identifier: GeneralIdentifier<T>
|
||||||
): T {
|
): T {
|
||||||
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
const stack = useContext(FrameworkStackContext);
|
const stack = useContext(FrameworkStackContext);
|
||||||
|
|
||||||
let service: T | undefined = undefined;
|
let service: T | undefined = undefined;
|
||||||
@@ -85,6 +86,7 @@ export function useServices<
|
|||||||
export function useServiceOptional<T extends Service>(
|
export function useServiceOptional<T extends Service>(
|
||||||
identifier: Type<T>
|
identifier: Type<T>
|
||||||
): T | undefined {
|
): T | undefined {
|
||||||
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
const stack = useContext(FrameworkStackContext);
|
const stack = useContext(FrameworkStackContext);
|
||||||
|
|
||||||
let service: T | undefined = undefined;
|
let service: T | undefined = undefined;
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ export class WorkspaceDBService extends Service {
|
|||||||
) as WorkspaceDBWithTables<AFFiNEWorkspaceDbSchema>;
|
) as WorkspaceDBWithTables<AFFiNEWorkspaceDbSchema>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
userdataDB(userId: (string & {}) | '__local__') {
|
userdataDB(userId: (string & {}) | '__local__') {
|
||||||
// __local__ for local workspace
|
// __local__ for local workspace
|
||||||
const userdataDb = this.userdataDBPool.get(userId);
|
const userdataDb = this.userdataDBPool.get(userId);
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ export class SpaceStorageClient extends OpClient<SpaceStorageOps> {
|
|||||||
await this.call('disconnect');
|
await this.call('disconnect');
|
||||||
}
|
}
|
||||||
|
|
||||||
override async destroy() {
|
override destroy() {
|
||||||
await this.call('destroy');
|
this.call('destroy').catch(console.error);
|
||||||
super.destroy();
|
super.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,8 +46,8 @@ export class SpaceStorageWorkerClient extends SpaceStorageClient {
|
|||||||
this.worker = worker;
|
this.worker = worker;
|
||||||
}
|
}
|
||||||
|
|
||||||
override async destroy() {
|
override destroy() {
|
||||||
await super.destroy();
|
super.destroy();
|
||||||
this.worker.terminate();
|
this.worker.terminate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import EventEmitter2 from 'eventemitter2';
|
import EventEmitter2 from 'eventemitter2';
|
||||||
|
|
||||||
import type { ConnectionStatus } from '../connection';
|
import type { ConnectionStatus } from '../connection';
|
||||||
import { type Storage, type StorageType } from './storage';
|
|
||||||
import type { BlobStorage } from './blob';
|
import type { BlobStorage } from './blob';
|
||||||
import type { DocStorage } from './doc';
|
import type { DocStorage } from './doc';
|
||||||
|
import { type Storage, type StorageType } from './storage';
|
||||||
import type { SyncStorage } from './sync';
|
import type { SyncStorage } from './sync';
|
||||||
|
|
||||||
type Storages = DocStorage | BlobStorage | SyncStorage;
|
type Storages = DocStorage | BlobStorage | SyncStorage;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { type PasswordLimitsFragment } from '@affine/graphql';
|
import { type PasswordLimitsFragment } from '@affine/graphql';
|
||||||
import { useI18n } from '@affine/i18n';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { type Options, passwordStrength } from 'check-password-strength';
|
import { type Options, passwordStrength } from 'check-password-strength';
|
||||||
import { type FC, useEffect, useMemo, useCallback, useState } from 'react';
|
import { type FC, useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { z, type ZodCustomIssue, ZodIssueCode } from 'zod';
|
import { z, type ZodCustomIssue, ZodIssueCode } from 'zod';
|
||||||
|
|
||||||
import type { InputProps } from '../../../ui/input';
|
import type { InputProps } from '../../../ui/input';
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import type React from 'react';
|
|||||||
|
|
||||||
const DEV_MODE = process.env.NODE_ENV !== 'production';
|
const DEV_MODE = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
type DistributiveOmit<T, K extends string | number | symbol> = T extends any
|
type DistributiveOmit<T, K extends string | number | symbol> = T extends any
|
||||||
? K extends keyof T
|
? K extends keyof T
|
||||||
? Omit<T, K>
|
? Omit<T, K>
|
||||||
@@ -38,7 +37,6 @@ export type WebComponentProps<I extends HTMLElement> = React.DetailedHTMLProps<
|
|||||||
> &
|
> &
|
||||||
ElementProps<I>;
|
ElementProps<I>;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
type EmptyObject = {};
|
type EmptyObject = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -51,6 +51,5 @@ export type toExternalData<D extends DNDData> = (
|
|||||||
| 'text/plain'
|
| 'text/plain'
|
||||||
| 'text/html'
|
| 'text/html'
|
||||||
| 'Files'
|
| 'Files'
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
| (string & {})]?: string;
|
| (string & {})]?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -3,8 +3,8 @@ import './ask-ai-panel';
|
|||||||
import { type EditorHost } from '@blocksuite/affine/block-std';
|
import { type EditorHost } from '@blocksuite/affine/block-std';
|
||||||
import {
|
import {
|
||||||
type AIItemGroupConfig,
|
type AIItemGroupConfig,
|
||||||
EdgelessRootService,
|
|
||||||
createLitPortal,
|
createLitPortal,
|
||||||
|
EdgelessRootService,
|
||||||
HoverController,
|
HoverController,
|
||||||
} from '@blocksuite/affine/blocks';
|
} from '@blocksuite/affine/blocks';
|
||||||
import { WithDisposable } from '@blocksuite/affine/global/utils';
|
import { WithDisposable } from '@blocksuite/affine/global/utils';
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
} from '@blocksuite/affine/blocks';
|
} from '@blocksuite/affine/blocks';
|
||||||
import { WithDisposable } from '@blocksuite/affine/global/utils';
|
import { WithDisposable } from '@blocksuite/affine/global/utils';
|
||||||
import type { BlockModel } from '@blocksuite/affine/store';
|
import type { BlockModel } from '@blocksuite/affine/store';
|
||||||
|
import { captureException } from '@sentry/react';
|
||||||
import {
|
import {
|
||||||
css,
|
css,
|
||||||
html,
|
html,
|
||||||
@@ -466,39 +467,47 @@ export class ChatCards extends WithDisposable(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async willUpdate(changedProperties: PropertyValues) {
|
protected override willUpdate(changedProperties: PropertyValues) {
|
||||||
if (changedProperties.has('temporaryParams') && this.temporaryParams) {
|
Promise.resolve()
|
||||||
const params = this.temporaryParams;
|
.then(async () => {
|
||||||
await this._appendCardWithParams(params);
|
if (changedProperties.has('temporaryParams') && this.temporaryParams) {
|
||||||
this.temporaryParams = null;
|
const params = this.temporaryParams;
|
||||||
}
|
await this._appendCardWithParams(params);
|
||||||
|
this.temporaryParams = null;
|
||||||
if (changedProperties.has('host')) {
|
|
||||||
if (this._currentDocId === this.host.doc.id) return;
|
|
||||||
this._currentDocId = this.host.doc.id;
|
|
||||||
this.cards = [];
|
|
||||||
|
|
||||||
const { text, images } = await this._extractAll();
|
|
||||||
const hasText = text.length > 0;
|
|
||||||
const hasImages = images.length > 0;
|
|
||||||
|
|
||||||
// Currently only supports checking on first load
|
|
||||||
if (hasText || hasImages) {
|
|
||||||
const card: CardBlock = {
|
|
||||||
id: Date.now(),
|
|
||||||
type: CardType.Doc,
|
|
||||||
};
|
|
||||||
if (hasText) {
|
|
||||||
card.text = text;
|
|
||||||
}
|
|
||||||
if (hasImages) {
|
|
||||||
card.images = images;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cards.push(card);
|
if (changedProperties.has('host')) {
|
||||||
this.requestUpdate();
|
if (this._currentDocId === this.host.doc.id) return;
|
||||||
}
|
this._currentDocId = this.host.doc.id;
|
||||||
}
|
this.cards = [];
|
||||||
|
|
||||||
|
const { text, images } = await this._extractAll();
|
||||||
|
const hasText = text.length > 0;
|
||||||
|
const hasImages = images.length > 0;
|
||||||
|
|
||||||
|
// Currently only supports checking on first load
|
||||||
|
if (hasText || hasImages) {
|
||||||
|
const card: CardBlock = {
|
||||||
|
id: Date.now(),
|
||||||
|
type: CardType.Doc,
|
||||||
|
};
|
||||||
|
if (hasText) {
|
||||||
|
card.text = text;
|
||||||
|
}
|
||||||
|
if (hasImages) {
|
||||||
|
card.images = images;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cards.push(card);
|
||||||
|
this.requestUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
captureException(err, {
|
||||||
|
level: 'fatal',
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
override connectedCallback() {
|
override connectedCallback() {
|
||||||
|
|||||||
@@ -276,11 +276,14 @@ export class ChatPanelMessages extends WithDisposable(ShadowlessElement) {
|
|||||||
: nothing} `;
|
: nothing} `;
|
||||||
}
|
}
|
||||||
|
|
||||||
override async connectedCallback() {
|
override connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
|
|
||||||
const res = await AIProvider.userInfo;
|
Promise.resolve(AIProvider.userInfo)
|
||||||
this.avatarUrl = res?.avatarUrl ?? '';
|
.then(res => {
|
||||||
|
this.avatarUrl = res?.avatarUrl ?? '';
|
||||||
|
})
|
||||||
|
.catch(console.error);
|
||||||
this.disposables.add(
|
this.disposables.add(
|
||||||
AIProvider.slots.userInfo.on(userInfo => {
|
AIProvider.slots.userInfo.on(userInfo => {
|
||||||
const { status, error } = this.chatContextValue;
|
const { status, error } = this.chatContextValue;
|
||||||
|
|||||||
+3
-3
@@ -1,14 +1,14 @@
|
|||||||
import {
|
import {
|
||||||
|
AFFINE_AI_PANEL_WIDGET,
|
||||||
type AffineAIPanelWidget,
|
type AffineAIPanelWidget,
|
||||||
type AffineSlashMenuActionItem,
|
type AffineSlashMenuActionItem,
|
||||||
type AffineSlashMenuContext,
|
type AffineSlashMenuContext,
|
||||||
type AffineSlashMenuItem,
|
type AffineSlashMenuItem,
|
||||||
|
AffineSlashMenuWidget,
|
||||||
type AffineSlashSubMenu,
|
type AffineSlashSubMenu,
|
||||||
type AIItemConfig,
|
type AIItemConfig,
|
||||||
DocModeProvider,
|
|
||||||
AFFINE_AI_PANEL_WIDGET,
|
|
||||||
AffineSlashMenuWidget,
|
|
||||||
AIStarIcon,
|
AIStarIcon,
|
||||||
|
DocModeProvider,
|
||||||
MoreHorizontalIcon,
|
MoreHorizontalIcon,
|
||||||
} from '@blocksuite/affine/blocks';
|
} from '@blocksuite/affine/blocks';
|
||||||
import { assertExists } from '@blocksuite/affine/global/utils';
|
import { assertExists } from '@blocksuite/affine/global/utils';
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import {
|
|||||||
ConnectorMode,
|
ConnectorMode,
|
||||||
DocModeProvider,
|
DocModeProvider,
|
||||||
type EdgelessRootService,
|
type EdgelessRootService,
|
||||||
TelemetryProvider,
|
|
||||||
NotificationProvider,
|
NotificationProvider,
|
||||||
|
TelemetryProvider,
|
||||||
} from '@blocksuite/affine/blocks';
|
} from '@blocksuite/affine/blocks';
|
||||||
import {
|
import {
|
||||||
type AIChatBlockModel,
|
type AIChatBlockModel,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import type { EditorHost } from '@blocksuite/affine/block-std';
|
import type { EditorHost } from '@blocksuite/affine/block-std';
|
||||||
import {
|
import {
|
||||||
|
BlocksUtils,
|
||||||
type CopilotTool,
|
type CopilotTool,
|
||||||
|
EdgelessRootService,
|
||||||
type FrameBlockModel,
|
type FrameBlockModel,
|
||||||
ImageBlockModel,
|
ImageBlockModel,
|
||||||
type SurfaceBlockComponent,
|
type SurfaceBlockComponent,
|
||||||
BlocksUtils,
|
|
||||||
EdgelessRootService,
|
|
||||||
} from '@blocksuite/affine/blocks';
|
} from '@blocksuite/affine/blocks';
|
||||||
import { assertExists } from '@blocksuite/affine/global/utils';
|
import { assertExists } from '@blocksuite/affine/global/utils';
|
||||||
import {
|
import {
|
||||||
|
|||||||
+1
-1
@@ -10,8 +10,8 @@ import {
|
|||||||
import { GlobalDialogService } from '@affine/core/modules/dialogs';
|
import { GlobalDialogService } from '@affine/core/modules/dialogs';
|
||||||
import {
|
import {
|
||||||
type CreateCheckoutSessionInput,
|
type CreateCheckoutSessionInput,
|
||||||
SubscriptionRecurring,
|
|
||||||
SubscriptionPlan,
|
SubscriptionPlan,
|
||||||
|
SubscriptionRecurring,
|
||||||
SubscriptionStatus,
|
SubscriptionStatus,
|
||||||
SubscriptionVariant,
|
SubscriptionVariant,
|
||||||
} from '@affine/graphql';
|
} from '@affine/graphql';
|
||||||
|
|||||||
+4
-4
@@ -107,10 +107,10 @@ export const CloudWorkspaceMembersPanel = ({
|
|||||||
return success;
|
return success;
|
||||||
}, [permissionService.permission, workspaceShareSettingService.sharePreview]);
|
}, [permissionService.permission, workspaceShareSettingService.sharePreview]);
|
||||||
|
|
||||||
const onInviteBatchConfirm = useCallback<
|
const onInviteBatchConfirm = useAsyncCallback(
|
||||||
InviteTeamMemberModalProps['onConfirm']
|
async ({
|
||||||
>(
|
emails,
|
||||||
async ({ emails }) => {
|
}: Parameters<InviteTeamMemberModalProps['onConfirm']>[0]) => {
|
||||||
setIsMutating(true);
|
setIsMutating(true);
|
||||||
const success = await permissionService.permission.inviteMembers(
|
const success = await permissionService.permission.inviteMembers(
|
||||||
emails,
|
emails,
|
||||||
|
|||||||
@@ -360,7 +360,6 @@ const ExplorerFolderNodeFolder = ({
|
|||||||
}, [additionalOperations, folderOperations]);
|
}, [additionalOperations, folderOperations]);
|
||||||
|
|
||||||
const childrenOperations = useCallback(
|
const childrenOperations = useCallback(
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
(type: string, node: FolderNode) => {
|
(type: string, node: FolderNode) => {
|
||||||
if (type === 'doc' || type === 'collection' || type === 'tag') {
|
if (type === 'doc' || type === 'collection' || type === 'tag') {
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
|
SubscriptionPlan,
|
||||||
type SubscriptionQuery,
|
type SubscriptionQuery,
|
||||||
SubscriptionRecurring,
|
SubscriptionRecurring,
|
||||||
SubscriptionVariant,
|
SubscriptionVariant,
|
||||||
SubscriptionPlan,
|
|
||||||
} from '@affine/graphql';
|
} from '@affine/graphql';
|
||||||
import {
|
import {
|
||||||
backoffRetry,
|
backoffRetry,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-types */
|
|
||||||
import type { DocMode } from '@blocksuite/affine/blocks';
|
import type { DocMode } from '@blocksuite/affine/blocks';
|
||||||
import type { WorkspaceMetadata } from '@toeverything/infra';
|
import type { WorkspaceMetadata } from '@toeverything/infra';
|
||||||
|
|
||||||
|
|||||||
@@ -712,7 +712,6 @@ const ExplorerFolderNodeFolder = ({
|
|||||||
}, [additionalOperations, folderOperations]);
|
}, [additionalOperations, folderOperations]);
|
||||||
|
|
||||||
const childrenOperations = useCallback(
|
const childrenOperations = useCallback(
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
(type: string, node: FolderNode) => {
|
(type: string, node: FolderNode) => {
|
||||||
if (type === 'doc' || type === 'collection' || type === 'tag') {
|
if (type === 'doc' || type === 'collection' || type === 'tag') {
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ export class FolderNode extends Entity<{
|
|||||||
|
|
||||||
info$ = LiveData.from<{
|
info$ = LiveData.from<{
|
||||||
data: string;
|
data: string;
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
type: (string & {}) | 'folder' | 'doc' | 'tag' | 'collection';
|
type: (string & {}) | 'folder' | 'doc' | 'tag' | 'collection';
|
||||||
index: string;
|
index: string;
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ import {
|
|||||||
type BlobStorage,
|
type BlobStorage,
|
||||||
catchErrorInto,
|
catchErrorInto,
|
||||||
type DocStorage,
|
type DocStorage,
|
||||||
|
effect,
|
||||||
exhaustMapSwitchUntilChanged,
|
exhaustMapSwitchUntilChanged,
|
||||||
fromPromise,
|
fromPromise,
|
||||||
|
getAFFiNEWorkspaceSchema,
|
||||||
type GlobalState,
|
type GlobalState,
|
||||||
LiveData,
|
LiveData,
|
||||||
ObjectPool,
|
ObjectPool,
|
||||||
@@ -24,8 +26,6 @@ import {
|
|||||||
type WorkspaceFlavoursProvider,
|
type WorkspaceFlavoursProvider,
|
||||||
type WorkspaceMetadata,
|
type WorkspaceMetadata,
|
||||||
type WorkspaceProfileInfo,
|
type WorkspaceProfileInfo,
|
||||||
effect,
|
|
||||||
getAFFiNEWorkspaceSchema,
|
|
||||||
} from '@toeverything/infra';
|
} from '@toeverything/infra';
|
||||||
import { isEqual } from 'lodash-es';
|
import { isEqual } from 'lodash-es';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ function createKey() {
|
|||||||
|
|
||||||
function warning(cond: any, message: string) {
|
function warning(cond: any, message: string) {
|
||||||
if (!cond) {
|
if (!cond) {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
if (typeof console !== 'undefined') console.warn(message);
|
if (typeof console !== 'undefined') console.warn(message);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -186,7 +185,6 @@ function warning(cond: any, message: string) {
|
|||||||
// find the source for a warning that appears in the console by
|
// find the source for a warning that appears in the console by
|
||||||
// enabling "pause on exceptions" in your JavaScript debugger.
|
// enabling "pause on exceptions" in your JavaScript debugger.
|
||||||
throw new Error(message);
|
throw new Error(message);
|
||||||
// eslint-disable-next-line no-empty
|
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,7 +199,7 @@ type Events<F> = {
|
|||||||
call: (arg: any) => void;
|
call: (arg: any) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||||
function createEvents<F extends Function>(): Events<F> {
|
function createEvents<F extends Function>(): Events<F> {
|
||||||
let handlers: F[] = [];
|
let handlers: F[] = [];
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { type I18nInstance, I18n } from '../i18next';
|
import { I18n, type I18nInstance } from '../i18next';
|
||||||
|
|
||||||
export type TimeUnit =
|
export type TimeUnit =
|
||||||
| 'second'
|
| 'second'
|
||||||
|
|||||||
@@ -294,8 +294,6 @@ const PageEvents = {
|
|||||||
property: ['addProperty'],
|
property: ['addProperty'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// remove when type added
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
edgeless: {},
|
edgeless: {},
|
||||||
workspace: {
|
workspace: {
|
||||||
$: {
|
$: {
|
||||||
@@ -316,18 +314,12 @@ const PageEvents = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// remove when type added
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
collection: {
|
collection: {
|
||||||
docList: {
|
docList: {
|
||||||
docMenu: ['removeOrganizeItem'],
|
docMenu: ['removeOrganizeItem'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// remove when type added
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
tag: {},
|
tag: {},
|
||||||
// remove when type added
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
||||||
trash: {},
|
trash: {},
|
||||||
subscriptionLanding: {
|
subscriptionLanding: {
|
||||||
$: {
|
$: {
|
||||||
|
|||||||
Reference in New Issue
Block a user