From 12eba1597ae2be571a716d3811bef84436102bdd Mon Sep 17 00:00:00 2001 From: Boshen Date: Mon, 5 Aug 2024 15:07:06 +0800 Subject: [PATCH] generate for v0.7.0 --- scripts/generate.ts | 2 +- src/rules-by-category.ts | 167 +++++++++++++++++++++++---------------- src/rules-by-scope.ts | 23 ++++++ 3 files changed, 121 insertions(+), 71 deletions(-) diff --git a/scripts/generate.ts b/scripts/generate.ts index b9a3a2b..68b5922 100644 --- a/scripts/generate.ts +++ b/scripts/generate.ts @@ -4,7 +4,7 @@ import { traverseRules } from './traverse-rules.js'; const { successResultArray, failureResultArray } = await traverseRules(); if (failureResultArray.length > 0) { - throw new Error( + console.error( `Failed to generate rules for the following rules ${JSON.stringify(failureResultArray)}` ); } diff --git a/src/rules-by-category.ts b/src/rules-by-category.ts index 0eaafa6..86d58c3 100644 --- a/src/rules-by-category.ts +++ b/src/rules-by-category.ts @@ -2,7 +2,6 @@ const pedanticRules = { 'array-callback-return': 'off', - eqeqeq: 'off', 'max-classes-per-file': 'off', 'max-lines': 'off', 'no-array-constructor': 'off', @@ -28,16 +27,10 @@ const pedanticRules = { 'react/checked-requires-onchange-or-readonly': 'off', 'react/jsx-no-useless-fragment': 'off', 'react/no-unescaped-entities': 'off', - '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/ban-types': 'off', '@typescript-eslint/no-duplicate-enum-values': 'off', '@typescript-eslint/prefer-enum-initializers': 'off', - '@typescript-eslint/prefer-ts-expect-error': 'off', - 'unicorn/escape-case': 'off', - 'unicorn/explicit-length-check': 'off', 'unicorn/new-for-builtins': 'off', - 'unicorn/no-hex-escape': 'off', - 'unicorn/no-instanceof-array': 'off', 'unicorn/no-lonely-if': 'off', 'unicorn/no-negated-condition': 'off', 'unicorn/no-negation-in-equality-check': 'off', @@ -47,26 +40,20 @@ const pedanticRules = { 'unicorn/no-this-assignment': 'off', 'unicorn/no-typeof-undefined': 'off', 'unicorn/no-unreadable-iife': 'off', - 'unicorn/no-useless-promise-resolve-reject': 'off', 'unicorn/no-useless-switch-case': 'off', 'unicorn/prefer-array-flat': 'off', 'unicorn/prefer-array-some': 'off', 'unicorn/prefer-blob-reading-methods': 'off', - 'unicorn/prefer-code-point': 'off', 'unicorn/prefer-date-now': 'off', - 'unicorn/prefer-dom-node-append': 'off', 'unicorn/prefer-dom-node-dataset': 'off', 'unicorn/prefer-dom-node-remove': 'off', 'unicorn/prefer-event-target': 'off', 'unicorn/prefer-math-trunc': 'off', 'unicorn/prefer-native-coercion-functions': 'off', - 'unicorn/prefer-prototype-methods': 'off', - 'unicorn/prefer-query-selector': 'off', 'unicorn/prefer-regexp-test': 'off', 'unicorn/prefer-string-replace-all': 'off', 'unicorn/prefer-string-slice': 'off', 'unicorn/prefer-type-error': 'off', - 'unicorn/require-number-to-fixed-digits-argument': 'off', }; const nurseryRules = { @@ -74,20 +61,19 @@ const nurseryRules = { 'getter-return': 'off', 'no-undef': 'off', 'no-unreachable': 'off', + 'no-unused-vars': 'off', 'import/export': 'off', 'import/no-deprecated': 'off', 'import/no-unused-modules': 'off', 'react/require-render-return': 'off', 'react/rules-of-hooks': 'off', 'tree-shaking/no-side-effects-in-initialization': 'off', - '@typescript-eslint/consistent-type-imports': 'off', }; const restrictionRules = { 'default-case': 'off', 'no-bitwise': 'off', 'no-console': 'off', - 'no-div-regex': 'off', 'no-empty': 'off', 'no-empty-function': 'off', 'no-eq-null': 'off', @@ -100,19 +86,19 @@ const restrictionRules = { 'no-unsafe-optional-chaining': 'off', 'no-var': 'off', 'no-void': 'off', - 'unicode-bom': 'off', 'import/no-amd': 'off', 'import/no-cycle': 'off', 'import/no-default-export': 'off', + 'import/no-webpack-loader-syntax': 'off', 'jsdoc/check-access': 'off', 'jsdoc/empty-tags': 'off', + 'promise/avoid-new': 'off', 'react/button-has-type': 'off', 'react/no-danger': 'off', 'react/no-unknown-property': 'off', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/no-dynamic-delete': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-import-type-side-effects': 'off', + '@typescript-eslint/no-namespace': 'off', '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'off', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-var-requires': 'off', @@ -121,11 +107,10 @@ const restrictionRules = { 'unicorn/no-anonymous-default-export': 'off', 'unicorn/no-array-for-each': 'off', 'unicorn/no-array-reduce': 'off', + 'unicorn/no-length-as-slice-end': 'off', 'unicorn/no-magic-array-flat-depth': 'off', - 'unicorn/no-nested-ternary': 'off', 'unicorn/no-process-exit': 'off', 'unicorn/prefer-modern-math-apis': 'off', - 'unicorn/prefer-node-protocol': 'off', 'unicorn/prefer-number-properties': 'off', }; @@ -141,79 +126,76 @@ const styleRules = { 'no-template-curly-in-string': 'off', 'no-ternary': 'off', 'prefer-exponentiation-operator': 'off', - 'sort-imports': 'off', - 'jest/consistent-test-it': 'off', 'jest/max-expects': 'off', 'jest/max-nested-describe': 'off', - 'jest/no-alias-methods': 'off', 'jest/no-confusing-set-timeout': 'off', - 'jest/no-deprecated-functions': 'off', 'jest/no-done-callback': 'off', 'jest/no-duplicate-hooks': 'off', 'jest/no-hooks': 'off', 'jest/no-identical-title': 'off', 'jest/no-interpolation-in-snapshots': 'off', - 'jest/no-jasmine-globals': 'off', 'jest/no-large-snapshots': 'off', 'jest/no-mocks-import': 'off', 'jest/no-restricted-jest-methods': 'off', 'jest/no-restricted-matchers': 'off', - 'jest/no-test-prefixes': 'off', 'jest/no-test-return-statement': 'off', - 'jest/no-untyped-mock-factory': 'off', 'jest/prefer-called-with': 'off', - 'jest/prefer-comparison-matcher': 'off', 'jest/prefer-equality-matcher': 'off', - 'jest/prefer-expect-resolves': 'off', 'jest/prefer-hooks-in-order': 'off', 'jest/prefer-hooks-on-top': 'off', - 'jest/prefer-jest-mocked': 'off', - 'jest/prefer-lowercase-title': 'off', - 'jest/prefer-mock-promise-shorthand': 'off', - 'jest/prefer-spy-on': 'off', - 'jest/prefer-strict-equal': 'off', - 'jest/prefer-to-be': 'off', 'jest/prefer-to-contain': 'off', - 'jest/prefer-to-have-length': 'off', - 'jest/prefer-todo': 'off', 'jest/require-hook': 'off', 'jest/require-top-level-describe': 'off', + 'promise/param-names': 'off', + 'react/jsx-curly-brace-presence': 'off', 'react/no-set-state': 'off', 'react/prefer-es6-class': 'off', '@typescript-eslint/adjacent-overload-signatures': 'off', - '@typescript-eslint/array-type': 'off', - '@typescript-eslint/ban-tslint-comment': 'off', - '@typescript-eslint/consistent-indexed-object-style': 'off', - '@typescript-eslint/consistent-type-definitions': 'off', '@typescript-eslint/no-empty-interface': 'off', '@typescript-eslint/prefer-for-of': 'off', - '@typescript-eslint/prefer-function-type': 'off', 'unicorn/catch-error-name': 'off', - 'unicorn/empty-brace-spaces': 'off', 'unicorn/error-message': 'off', 'unicorn/filename-case': 'off', 'unicorn/no-await-expression-member': 'off', - 'unicorn/no-console-spaces': 'off', - 'unicorn/no-null': 'off', 'unicorn/no-unreadable-array-destructuring': 'off', - 'unicorn/no-zero-fractions': 'off', - 'unicorn/number-literal-case': 'off', - 'unicorn/numeric-separators-style': 'off', 'unicorn/prefer-array-flat-map': 'off', - 'unicorn/prefer-dom-node-text-content': 'off', 'unicorn/prefer-includes': 'off', 'unicorn/prefer-logical-operator-over-ternary': 'off', 'unicorn/prefer-modern-dom-apis': 'off', 'unicorn/prefer-optional-catch-binding': 'off', 'unicorn/prefer-reflect-apply': 'off', - 'unicorn/prefer-spread': 'off', - 'unicorn/prefer-string-trim-start-end': 'off', 'unicorn/require-array-join-separator': 'off', - 'unicorn/switch-case-braces': 'off', 'unicorn/text-encoding-identifier-case': 'off', 'unicorn/throw-new-error': 'off', }; +const conditionalFixRules = { + eqeqeq: 'off', + 'prefer-numeric-literals': 'off', + 'sort-imports': 'off', + 'use-isnan': 'off', + 'valid-typeof': 'off', + 'jest/no-jasmine-globals': 'off', + 'jest/no-untyped-mock-factory': 'off', + 'jest/prefer-mock-promise-shorthand': 'off', + 'jsx-a11y/aria-props': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/consistent-indexed-object-style': 'off', + '@typescript-eslint/consistent-type-imports': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/prefer-as-const': 'off', + '@typescript-eslint/prefer-function-type': 'off', + 'unicorn/explicit-length-check': 'off', + 'unicorn/no-nested-ternary': 'off', + 'unicorn/no-single-promise-in-promise-methods': 'off', + 'unicorn/no-unnecessary-await': 'off', + 'unicorn/no-useless-fallback-in-spread': 'off', + 'unicorn/no-useless-spread': 'off', + 'unicorn/prefer-dom-node-text-content': 'off', + 'unicorn/prefer-query-selector': 'off', + 'unicorn/prefer-spread': 'off', +}; + const correctnessRules = { 'for-direction': 'off', 'no-async-promise-executor': 'off', @@ -225,7 +207,6 @@ const correctnessRules = { 'no-constant-binary-expression': 'off', 'no-constant-condition': 'off', 'no-control-regex': 'off', - 'no-debugger': 'off', 'no-delete-var': 'off', 'no-dupe-class-members': 'off', 'no-dupe-else-if': 'off', @@ -250,16 +231,11 @@ const correctnessRules = { 'no-sparse-arrays': 'off', 'no-this-before-super': 'off', 'no-unsafe-finally': 'off', - 'no-unsafe-negation': 'off', - 'no-unused-labels': 'off', 'no-unused-private-class-members': 'off', 'no-useless-catch': 'off', - 'no-useless-escape': 'off', 'no-useless-rename': 'off', 'no-with': 'off', 'require-yield': 'off', - 'use-isnan': 'off', - 'valid-typeof': 'off', 'import/default': 'off', 'import/named': 'off', 'import/namespace': 'off', @@ -267,7 +243,6 @@ const correctnessRules = { 'jest/no-conditional-expect': 'off', 'jest/no-disabled-tests': 'off', 'jest/no-export': 'off', - 'jest/no-focused-tests': 'off', 'jest/no-standalone-expect': 'off', 'jest/require-to-throw-message': 'off', 'jest/valid-describe-callback': 'off', @@ -286,7 +261,6 @@ const correctnessRules = { 'jsx-a11y/anchor-has-content': 'off', 'jsx-a11y/anchor-is-valid': 'off', 'jsx-a11y/aria-activedescendant-has-tabindex': 'off', - 'jsx-a11y/aria-props': 'off', 'jsx-a11y/aria-role': 'off', 'jsx-a11y/aria-unsupported-elements': 'off', 'jsx-a11y/autocomplete-valid': 'off', @@ -300,7 +274,6 @@ const correctnessRules = { 'jsx-a11y/mouse-events-have-key-events': 'off', 'jsx-a11y/no-access-key': 'off', 'jsx-a11y/no-aria-hidden-on-focusable': 'off', - 'jsx-a11y/no-autofocus': 'off', 'jsx-a11y/no-distracting-elements': 'off', 'jsx-a11y/no-redundant-roles': 'off', 'jsx-a11y/prefer-tag-over-role': 'off', @@ -341,26 +314,22 @@ const correctnessRules = { 'react/void-dom-elements-no-children': 'off', '@typescript-eslint/no-extra-non-null-assertion': 'off', '@typescript-eslint/no-misused-new': 'off', - '@typescript-eslint/no-namespace': 'off', '@typescript-eslint/no-non-null-asserted-optional-chain': 'off', '@typescript-eslint/no-this-alias': 'off', '@typescript-eslint/no-unsafe-declaration-merging': 'off', - '@typescript-eslint/no-useless-empty-export': 'off', - '@typescript-eslint/prefer-as-const': 'off', '@typescript-eslint/triple-slash-reference': 'off', 'unicorn/no-await-in-promise-methods': 'off', 'unicorn/no-document-cookie': 'off', 'unicorn/no-empty-file': 'off', 'unicorn/no-invalid-remove-event-listener': 'off', 'unicorn/no-new-array': 'off', - 'unicorn/no-single-promise-in-promise-methods': 'off', 'unicorn/no-thenable': 'off', - 'unicorn/no-unnecessary-await': 'off', - 'unicorn/no-useless-fallback-in-spread': 'off', 'unicorn/no-useless-length-check': 'off', - 'unicorn/no-useless-spread': 'off', 'unicorn/prefer-set-size': 'off', - 'unicorn/prefer-string-starts-ends-with': 'off', +}; + +const pendingRules = { + 'func-names': 'off', }; const perfRules = { @@ -371,10 +340,63 @@ const perfRules = { 'react-perf/jsx-no-new-object-as-prop': 'off', }; +const fixRules = { + 'no-debugger': 'off', + 'no-div-regex': 'off', + 'no-unsafe-negation': 'off', + 'no-unused-labels': 'off', + 'no-useless-constructor': 'off', + 'no-useless-escape': 'off', + 'unicode-bom': 'off', + 'jest/consistent-test-it': 'off', + 'jest/no-alias-methods': 'off', + 'jest/no-deprecated-functions': 'off', + 'jest/no-focused-tests': 'off', + 'jest/no-test-prefixes': 'off', + 'jest/prefer-comparison-matcher': 'off', + 'jest/prefer-expect-resolves': 'off', + 'jest/prefer-jest-mocked': 'off', + 'jest/prefer-lowercase-title': 'off', + 'jest/prefer-spy-on': 'off', + 'jest/prefer-strict-equal': 'off', + 'jest/prefer-to-be': 'off', + 'jest/prefer-to-have-length': 'off', + 'jest/prefer-todo': 'off', + 'jsx-a11y/no-autofocus': 'off', + 'promise/no-new-statics': 'off', + 'react/jsx-boolean-value': 'off', + '@typescript-eslint/array-type': 'off', + '@typescript-eslint/ban-tslint-comment': 'off', + '@typescript-eslint/consistent-type-definitions': 'off', + '@typescript-eslint/no-import-type-side-effects': 'off', + '@typescript-eslint/no-useless-empty-export': 'off', + '@typescript-eslint/prefer-namespace-keyword': 'off', + '@typescript-eslint/prefer-ts-expect-error': 'off', + 'unicorn/empty-brace-spaces': 'off', + 'unicorn/escape-case': 'off', + 'unicorn/no-console-spaces': 'off', + 'unicorn/no-hex-escape': 'off', + 'unicorn/no-instanceof-array': 'off', + 'unicorn/no-null': 'off', + 'unicorn/no-useless-promise-resolve-reject': 'off', + 'unicorn/no-useless-undefined': 'off', + 'unicorn/no-zero-fractions': 'off', + 'unicorn/number-literal-case': 'off', + 'unicorn/numeric-separators-style': 'off', + 'unicorn/prefer-code-point': 'off', + 'unicorn/prefer-dom-node-append': 'off', + 'unicorn/prefer-node-protocol': 'off', + 'unicorn/prefer-prototype-methods': 'off', + 'unicorn/prefer-string-starts-ends-with': 'off', + 'unicorn/prefer-string-trim-start-end': 'off', + 'unicorn/require-number-to-fixed-digits-argument': 'off', + 'unicorn/switch-case-braces': 'off', + 'vitest/no-import-node-test': 'off', +}; + const suspiciousRules = { 'no-new': 'off', 'no-useless-concat': 'off', - 'no-useless-constructor': 'off', 'import/no-duplicates': 'off', 'import/no-named-as-default': 'off', 'import/no-named-as-default-member': 'off', @@ -382,6 +404,8 @@ const suspiciousRules = { 'jest/no-commented-out-tests': 'off', 'react/jsx-no-comment-textnodes': 'off', 'react/react-in-jsx-scope': 'off', + '@typescript-eslint/no-confusing-non-null-assertion': 'off', + '@typescript-eslint/no-extraneous-class': 'off', '@typescript-eslint/no-unnecessary-type-constraint': 'off', 'unicorn/prefer-add-event-listener': 'off', }; @@ -391,7 +415,10 @@ export { nurseryRules, restrictionRules, styleRules, + conditionalFixRules, correctnessRules, + pendingRules, perfRules, + fixRules, suspiciousRules, }; diff --git a/src/rules-by-scope.ts b/src/rules-by-scope.ts index d50ce19..1e3a0d1 100644 --- a/src/rules-by-scope.ts +++ b/src/rules-by-scope.ts @@ -8,6 +8,7 @@ const eslintRules = { 'default-param-last': 'off', eqeqeq: 'off', 'for-direction': 'off', + 'func-names': 'off', 'getter-return': 'off', 'guard-for-in': 'off', 'max-classes-per-file': 'off', @@ -82,6 +83,7 @@ const eslintRules = { 'no-unsafe-optional-chaining': 'off', 'no-unused-labels': 'off', 'no-unused-private-class-members': 'off', + 'no-unused-vars': 'off', 'no-useless-catch': 'off', 'no-useless-concat': 'off', 'no-useless-constructor': 'off', @@ -91,6 +93,7 @@ const eslintRules = { 'no-void': 'off', 'no-with': 'off', 'prefer-exponentiation-operator': 'off', + 'prefer-numeric-literals': 'off', radix: 'off', 'require-await': 'off', 'require-yield': 'off', @@ -116,6 +119,7 @@ const importRules = { 'import/no-named-as-default-member': 'off', 'import/no-self-import': 'off', 'import/no-unused-modules': 'off', + 'import/no-webpack-loader-syntax': 'off', }; const jestRules = { @@ -241,9 +245,17 @@ const nextjsRules = { 'nextjs/no-unwanted-polyfillio': 'off', }; +const promiseRules = { + 'promise/avoid-new': 'off', + 'promise/no-new-statics': 'off', + 'promise/param-names': 'off', +}; + const reactRules = { 'react/button-has-type': 'off', 'react/checked-requires-onchange-or-readonly': 'off', + 'react/jsx-boolean-value': 'off', + 'react/jsx-curly-brace-presence': 'off', 'react/jsx-key': 'off', 'react/jsx-no-comment-textnodes': 'off', 'react/jsx-no-duplicate-props': 'off', @@ -288,11 +300,13 @@ const typescriptRules = { '@typescript-eslint/consistent-type-definitions': 'off', '@typescript-eslint/consistent-type-imports': 'off', '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-confusing-non-null-assertion': 'off', '@typescript-eslint/no-duplicate-enum-values': 'off', '@typescript-eslint/no-dynamic-delete': 'off', '@typescript-eslint/no-empty-interface': 'off', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-extra-non-null-assertion': 'off', + '@typescript-eslint/no-extraneous-class': 'off', '@typescript-eslint/no-import-type-side-effects': 'off', '@typescript-eslint/no-misused-new': 'off', '@typescript-eslint/no-namespace': 'off', @@ -309,6 +323,7 @@ const typescriptRules = { '@typescript-eslint/prefer-for-of': 'off', '@typescript-eslint/prefer-function-type': 'off', '@typescript-eslint/prefer-literal-enum-member': 'off', + '@typescript-eslint/prefer-namespace-keyword': 'off', '@typescript-eslint/prefer-ts-expect-error': 'off', '@typescript-eslint/triple-slash-reference': 'off', }; @@ -333,6 +348,7 @@ const unicornRules = { 'unicorn/no-hex-escape': 'off', 'unicorn/no-instanceof-array': 'off', 'unicorn/no-invalid-remove-event-listener': 'off', + 'unicorn/no-length-as-slice-end': 'off', 'unicorn/no-lonely-if': 'off', 'unicorn/no-magic-array-flat-depth': 'off', 'unicorn/no-negated-condition': 'off', @@ -356,6 +372,7 @@ const unicornRules = { 'unicorn/no-useless-promise-resolve-reject': 'off', 'unicorn/no-useless-spread': 'off', 'unicorn/no-useless-switch-case': 'off', + 'unicorn/no-useless-undefined': 'off', 'unicorn/no-zero-fractions': 'off', 'unicorn/number-literal-case': 'off', 'unicorn/numeric-separators-style': 'off', @@ -398,6 +415,10 @@ const unicornRules = { 'unicorn/throw-new-error': 'off', }; +const vitestRules = { + 'vitest/no-import-node-test': 'off', +}; + export { eslintRules, importRules, @@ -405,9 +426,11 @@ export { jsdocRules, jsxA11yRules, nextjsRules, + promiseRules, reactRules, reactPerfRules, treeShakingRules, typescriptRules, unicornRules, + vitestRules, };