mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-23 20:18:42 +08:00
feat: bump eslint & oxlint (#14452)
#### PR Dependency Tree * **PR #14452** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved null-safety, dependency tracking, upload validation, and error logging for more reliable uploads, clipboard, calendar linking, telemetry, PDF/theme printing, and preview/zoom behavior. * Tightened handling of all-day calendar events (missing date now reported). * **Deprecations** * Removed deprecated RadioButton and RadioButtonGroup; use RadioGroup. * **Chores** * Unified and upgraded linting/config, reorganized imports, and standardized binary handling for more consistent builds and tooling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
+13
-89
@@ -5,6 +5,7 @@ import eslint from '@eslint/js';
|
||||
import tsParser from '@typescript-eslint/parser';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
import importX from 'eslint-plugin-import-x';
|
||||
import oxlint from 'eslint-plugin-oxlint';
|
||||
import react from 'eslint-plugin-react';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
||||
@@ -16,7 +17,10 @@ const __require = createRequire(import.meta.url);
|
||||
|
||||
const rxjs = __require('@smarttools/eslint-plugin-rxjs');
|
||||
|
||||
const ignoreList = readFileSync('.prettierignore', 'utf-8')
|
||||
const ignoreList = readFileSync(
|
||||
new URL('.prettierignore', import.meta.url),
|
||||
'utf-8'
|
||||
)
|
||||
.split('\n')
|
||||
.filter(line => line.trim() && !line.startsWith('#'));
|
||||
|
||||
@@ -60,105 +64,51 @@ export default tseslint.config(
|
||||
'simple-import-sort': simpleImportSort,
|
||||
rxjs,
|
||||
unicorn,
|
||||
oxlint,
|
||||
},
|
||||
rules: {
|
||||
...eslint.configs.recommended.rules,
|
||||
...react.configs.recommended.rules,
|
||||
...react.configs['jsx-runtime'].rules,
|
||||
...reactHooks.configs.recommended.rules,
|
||||
...oxlint.configs.recommended.rules,
|
||||
// covered by TypeScript
|
||||
'no-dupe-args': 'off',
|
||||
// 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',
|
||||
'react-hooks/immutability': 'off',
|
||||
'react-hooks/refs': 'off',
|
||||
'react-hooks/set-state-in-effect': 'off',
|
||||
'react-hooks/static-components': 'off',
|
||||
'react-hooks/use-memo': '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',
|
||||
@@ -167,30 +117,13 @@ export default tseslint.config(
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
|
||||
// rules that are not supported by oxlint
|
||||
'no-unreachable-loop': 'error',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'error',
|
||||
'@typescript-eslint/no-wrapper-object-types': 'error',
|
||||
'@typescript-eslint/unified-signatures': 'error',
|
||||
'@typescript-eslint/return-await': [
|
||||
'error',
|
||||
'error-handling-correctness-only',
|
||||
],
|
||||
'@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,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'sonarjs/no-all-duplicated-branches': 'error',
|
||||
'sonarjs/no-element-overwrite': 'error',
|
||||
'sonarjs/no-empty-collection': 'error',
|
||||
@@ -198,7 +131,6 @@ export default tseslint.config(
|
||||
'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',
|
||||
@@ -234,13 +166,6 @@ export default tseslint.config(
|
||||
'error',
|
||||
{ includeInternal: true },
|
||||
],
|
||||
'react-hooks/exhaustive-deps': [
|
||||
'warn',
|
||||
{
|
||||
additionalHooks:
|
||||
'(useAsyncCallback|useCatchEventCallback|useDraggable|useDropTarget|useRefEffect)',
|
||||
},
|
||||
],
|
||||
'rxjs/finnish': [
|
||||
'error',
|
||||
{
|
||||
@@ -304,7 +229,6 @@ export default tseslint.config(
|
||||
{ ignoreVoid: true },
|
||||
],
|
||||
'@typescript-eslint/no-misused-promises': 0,
|
||||
'@typescript-eslint/no-restricted-imports': 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user