UNPKG

@oxlint/migrate

Version:

Generates a `.oxlintrc.json` from a existing eslint flat config

607 lines (606 loc) 18.5 kB
const pedanticRules = [ "array-callback-return", "eqeqeq", "max-classes-per-file", "max-depth", "max-lines-per-function", "max-lines", "max-nested-callbacks", "no-array-constructor", "no-case-declarations", "no-lonely-if", "no-object-constructor", "no-constructor-return", "no-else-return", "no-fallthrough", "no-inner-declarations", "no-negated-condition", "no-new-wrappers", "no-prototype-builtins", "no-redeclare", "no-self-compare", "no-throw-literal", "radix", "require-await", "sort-vars", "symbol-description", "import/max-dependencies", "jest/no-conditional-in-test", "jsdoc/require-param", "jsdoc/require-param-description", "jsdoc/require-param-name", "jsdoc/require-param-type", "jsdoc/require-returns", "jsdoc/require-returns-description", "jsdoc/require-returns-type", "react/checked-requires-onchange-or-readonly", "react/jsx-no-useless-fragment", "react/no-unescaped-entities", "react-hooks/rules-of-hooks", "@typescript-eslint/ban-ts-comment", "@typescript-eslint/ban-types", "@typescript-eslint/no-unsafe-function-type", "@typescript-eslint/prefer-enum-initializers", "@typescript-eslint/prefer-ts-expect-error", "unicorn/consistent-assert", "unicorn/consistent-empty-array-spread", "unicorn/escape-case", "unicorn/explicit-length-check", "unicorn/new-for-builtins", "unicorn/no-unnecessary-array-flat-depth", "unicorn/no-unnecessary-slice-end", "unicorn/no-hex-escape", "unicorn/no-instanceof-array", "unicorn/no-lonely-if", "unicorn/no-negation-in-equality-check", "unicorn/no-new-buffer", "unicorn/no-object-as-default-parameter", "unicorn/no-static-only-class", "unicorn/no-this-assignment", "unicorn/no-typeof-undefined", "unicorn/no-unreadable-iife", "unicorn/no-useless-promise-resolve-reject", "unicorn/no-useless-switch-case", "unicorn/no-useless-undefined", "unicorn/prefer-array-flat", "unicorn/prefer-array-some", "unicorn/prefer-blob-reading-methods", "unicorn/prefer-code-point", "unicorn/prefer-date-now", "unicorn/prefer-dom-node-append", "unicorn/prefer-dom-node-dataset", "unicorn/prefer-dom-node-remove", "unicorn/prefer-event-target", "unicorn/prefer-math-min-max", "unicorn/prefer-math-trunc", "unicorn/prefer-native-coercion-functions", "unicorn/prefer-prototype-methods", "unicorn/prefer-query-selector", "unicorn/prefer-regexp-test", "unicorn/prefer-string-replace-all", "unicorn/prefer-string-slice", "unicorn/prefer-type-error", "unicorn/require-number-to-fixed-digits-argument", "@typescript-eslint/no-array-constructor", "unicorn/no-negated-condition", "@typescript-eslint/no-redeclare", "import-x/max-dependencies", "vitest/no-conditional-in-test" ]; const styleRules = [ "arrow-body-style", "curly", "default-case-last", "default-param-last", "func-style", "func-names", "grouped-accessor-pairs", "guard-for-in", "id-length", "init-declarations", "max-params", "new-cap", "no-duplicate-imports", "no-extra-label", "no-labels", "no-lone-blocks", "no-multi-assign", "no-nested-ternary", "no-continue", "no-label-var", "no-magic-numbers", "no-multi-str", "no-new-func", "no-return-assign", "no-script-url", "no-template-curly-in-string", "no-ternary", "operator-assignment", "prefer-destructuring", "prefer-promise-reject-errors", "prefer-exponentiation-operator", "prefer-numeric-literals", "prefer-object-has-own", "prefer-object-spread", "prefer-rest-params", "prefer-spread", "sort-imports", "sort-keys", "vars-on-top", "yoda", "import/consistent-type-specifier-style", "import/exports-last", "import/first", "import/group-exports", "import/no-anonymous-default-export", "import/no-mutable-exports", "import/no-named-default", "import/no-namespace", "import/no-duplicates", "import/prefer-default-export", "jest/consistent-test-it", "jest/max-expects", "jest/max-nested-describe", "jest/no-alias-methods", "jest/no-confusing-set-timeout", "jest/no-deprecated-functions", "jest/no-done-callback", "jest/no-duplicate-hooks", "jest/no-hooks", "jest/no-identical-title", "jest/no-interpolation-in-snapshots", "jest/no-jasmine-globals", "jest/no-large-snapshots", "jest/no-mocks-import", "jest/no-restricted-jest-methods", "jest/no-restricted-matchers", "jest/no-test-prefixes", "jest/no-test-return-statement", "jest/no-untyped-mock-factory", "jest/prefer-each", "jest/prefer-called-with", "jest/prefer-comparison-matcher", "jest/prefer-equality-matcher", "jest/prefer-expect-resolves", "jest/prefer-hooks-in-order", "jest/prefer-hooks-on-top", "jest/prefer-jest-mocked", "jest/prefer-lowercase-title", "jest/prefer-mock-promise-shorthand", "jest/prefer-spy-on", "jest/prefer-strict-equal", "jest/prefer-to-be", "jest/prefer-to-contain", "jest/prefer-to-have-length", "jest/prefer-todo", "jest/require-hook", "jest/require-top-level-describe", "node/no-exports-assign", "promise/avoid-new", "promise/no-return-wrap", "promise/no-nesting", "promise/param-names", "promise/prefer-catch", "promise/prefer-await-to-callbacks", "promise/prefer-await-to-then", "react/jsx-boolean-value", "react/jsx-curly-brace-presence", "react/no-set-state", "react/prefer-es6-class", "react/self-closing-comp", "@typescript-eslint/adjacent-overload-signatures", "@typescript-eslint/array-type", "@typescript-eslint/ban-tslint-comment", "@typescript-eslint/consistent-generic-constructors", "@typescript-eslint/consistent-indexed-object-style", "@typescript-eslint/consistent-type-definitions", "@typescript-eslint/consistent-type-imports", "@typescript-eslint/no-inferrable-types", "@typescript-eslint/no-empty-interface", "@typescript-eslint/prefer-for-of", "@typescript-eslint/prefer-function-type", "@typescript-eslint/prefer-namespace-keyword", "unicorn/catch-error-name", "unicorn/consistent-date-clone", "unicorn/consistent-existence-index-check", "unicorn/empty-brace-spaces", "unicorn/error-message", "unicorn/filename-case", "unicorn/no-array-method-this-argument", "unicorn/no-await-expression-member", "unicorn/no-console-spaces", "unicorn/no-nested-ternary", "unicorn/no-null", "unicorn/no-unreadable-array-destructuring", "unicorn/no-zero-fractions", "unicorn/number-literal-case", "unicorn/numeric-separators-style", "unicorn/prefer-global-this", "unicorn/prefer-object-from-entries", "unicorn/prefer-array-index-of", "unicorn/prefer-spread", "unicorn/prefer-dom-node-text-content", "unicorn/prefer-includes", "unicorn/prefer-logical-operator-over-ternary", "unicorn/prefer-modern-dom-apis", "unicorn/prefer-negative-index", "unicorn/prefer-optional-catch-binding", "unicorn/prefer-reflect-apply", "unicorn/prefer-string-raw", "unicorn/prefer-string-trim-start-end", "unicorn/prefer-structured-clone", "unicorn/require-array-join-separator", "unicorn/switch-case-braces", "unicorn/text-encoding-identifier-case", "unicorn/throw-new-error", "vitest/no-import-node-test", "vitest/prefer-to-be-falsy", "vitest/prefer-to-be-object", "vitest/prefer-to-be-truthy", "@typescript-eslint/default-param-last", "@typescript-eslint/init-declarations", "@typescript-eslint/max-params", "@typescript-eslint/no-magic-numbers", "import-x/consistent-type-specifier-style", "import-x/exports-last", "import-x/first", "import-x/group-exports", "import-x/no-anonymous-default-export", "import-x/no-mutable-exports", "import-x/no-named-default", "import-x/no-namespace", "import-x/no-duplicates", "import-x/prefer-default-export", "vitest/consistent-test-it", "vitest/max-expects", "vitest/max-nested-describe", "vitest/no-alias-methods", "vitest/no-duplicate-hooks", "vitest/no-hooks", "vitest/no-identical-title", "vitest/no-interpolation-in-snapshots", "vitest/no-restricted-jest-methods", "vitest/no-restricted-matchers", "vitest/no-test-prefixes", "vitest/no-test-return-statement", "vitest/prefer-each", "vitest/prefer-comparison-matcher", "vitest/prefer-equality-matcher", "vitest/prefer-expect-resolves", "vitest/prefer-hooks-in-order", "vitest/prefer-hooks-on-top", "vitest/prefer-lowercase-title", "vitest/prefer-mock-promise-shorthand", "vitest/prefer-strict-equal", "vitest/prefer-to-have-length", "vitest/prefer-todo", "vitest/require-top-level-describe" ]; const suspiciousRules = [ "block-scoped-var", "no-extra-bind", "no-unneeded-ternary", "no-extend-native", "no-new", "no-unexpected-multiline", "no-useless-concat", "no-useless-constructor", "import/no-unassigned-import", "import/no-empty-named-blocks", "import/no-absolute-path", "import/no-named-as-default", "import/no-named-as-default-member", "import/no-self-import", "jest/no-commented-out-tests", "promise/no-promise-in-callback", "react/iframe-missing-sandbox", "react/jsx-no-comment-textnodes", "react/jsx-no-script-url", "react/no-namespace", "react/react-in-jsx-scope", "react/style-prop-object", "@typescript-eslint/no-misused-promises", "@typescript-eslint/no-floating-promises", "@typescript-eslint/no-confusing-non-null-assertion", "@typescript-eslint/no-extraneous-class", "@typescript-eslint/no-unnecessary-type-constraint", "unicorn/consistent-function-scoping", "unicorn/no-instanceof-builtins", "unicorn/no-accessor-recursion", "unicorn/prefer-add-event-listener", "unicorn/require-post-message-target-origin", "@typescript-eslint/no-useless-constructor", "import-x/no-unassigned-import", "import-x/no-empty-named-blocks", "import-x/no-absolute-path", "import-x/no-named-as-default", "import-x/no-named-as-default-member", "import-x/no-self-import", "vitest/no-commented-out-tests" ]; const restrictionRules = [ "default-case", "no-alert", "no-bitwise", "no-restricted-imports", "no-console", "no-div-regex", "no-empty-function", "no-empty", "no-eq-null", "no-iterator", "no-plusplus", "no-proto", "no-regex-spaces", "no-restricted-globals", "no-undefined", "no-unused-expressions", "no-var", "no-void", "unicode-bom", "import/extensions", "import/no-amd", "import/no-commonjs", "import/no-cycle", "import/no-default-export", "import/no-dynamic-require", "import/no-webpack-loader-syntax", "import/unambiguous", "jsdoc/check-access", "jsdoc/empty-tags", "jsx-a11y/anchor-ambiguous-text", "node/no-new-require", "promise/catch-or-return", "promise/spec-only", "react/button-has-type", "react/forbid-elements", "react/jsx-filename-extension", "react/no-danger", "react/no-unknown-property", "@typescript-eslint/explicit-module-boundary-types", "@typescript-eslint/explicit-function-return-type", "@typescript-eslint/no-dynamic-delete", "@typescript-eslint/no-empty-object-type", "@typescript-eslint/no-explicit-any", "@typescript-eslint/no-import-type-side-effects", "@typescript-eslint/no-namespace", "@typescript-eslint/no-non-null-asserted-nullish-coalescing", "@typescript-eslint/no-non-null-assertion", "@typescript-eslint/no-require-imports", "@typescript-eslint/no-var-requires", "@typescript-eslint/prefer-literal-enum-member", "unicorn/no-abusive-eslint-disable", "unicorn/no-anonymous-default-export", "unicorn/no-array-for-each", "unicorn/no-array-reduce", "unicorn/no-document-cookie", "unicorn/no-length-as-slice-end", "unicorn/no-magic-array-flat-depth", "unicorn/no-process-exit", "unicorn/prefer-modern-math-apis", "unicorn/prefer-node-protocol", "unicorn/prefer-number-properties", "@typescript-eslint/no-restricted-imports", "@typescript-eslint/no-empty-function", "@typescript-eslint/no-unused-expressions", "import-x/extensions", "import-x/no-amd", "import-x/no-commonjs", "import-x/no-cycle", "import-x/no-default-export", "import-x/no-dynamic-require", "import-x/no-webpack-loader-syntax", "import-x/unambiguous" ]; const correctnessRules = [ "for-direction", "no-unassigned-vars", "no-async-promise-executor", "no-caller", "no-class-assign", "no-useless-backreference", "no-compare-neg-zero", "no-cond-assign", "no-const-assign", "no-constant-binary-expression", "no-constant-condition", "no-control-regex", "no-debugger", "no-delete-var", "no-dupe-class-members", "no-dupe-else-if", "no-dupe-keys", "no-duplicate-case", "no-empty-character-class", "no-empty-pattern", "no-empty-static-block", "no-eval", "no-ex-assign", "no-extra-boolean-cast", "no-func-assign", "no-global-assign", "no-import-assign", "no-invalid-regexp", "no-irregular-whitespace", "no-loss-of-precision", "no-new-native-nonconstructor", "no-nonoctal-decimal-escape", "no-obj-calls", "no-self-assign", "no-setter-return", "no-shadow-restricted-names", "no-sparse-arrays", "no-this-before-super", "no-unsafe-finally", "no-unsafe-negation", "no-unsafe-optional-chaining", "no-unused-labels", "no-unused-private-class-members", "no-unused-vars", "no-useless-catch", "no-useless-escape", "no-useless-rename", "no-with", "require-yield", "use-isnan", "valid-typeof", "import/default", "import/namespace", "jest/expect-expect", "jest/no-conditional-expect", "jest/no-disabled-tests", "jest/no-export", "jest/no-focused-tests", "jest/no-standalone-expect", "jest/require-to-throw-message", "jest/valid-describe-callback", "jest/valid-expect", "jest/valid-title", "jsdoc/check-property-names", "jsdoc/check-tag-names", "jsdoc/implements-on-classes", "jsdoc/no-defaults", "jsdoc/require-property", "jsdoc/require-property-description", "jsdoc/require-property-name", "jsdoc/require-property-type", "jsdoc/require-yields", "jsx-a11y/alt-text", "jsx-a11y/anchor-has-content", "jsx-a11y/anchor-is-valid", "jsx-a11y/aria-activedescendant-has-tabindex", "jsx-a11y/aria-props", "jsx-a11y/aria-role", "jsx-a11y/aria-unsupported-elements", "jsx-a11y/autocomplete-valid", "jsx-a11y/click-events-have-key-events", "jsx-a11y/heading-has-content", "jsx-a11y/html-has-lang", "jsx-a11y/iframe-has-title", "jsx-a11y/img-redundant-alt", "jsx-a11y/label-has-associated-control", "jsx-a11y/lang", "jsx-a11y/media-has-caption", "jsx-a11y/mouse-events-have-key-events", "jsx-a11y/no-noninteractive-tabindex", "jsx-a11y/no-access-key", "jsx-a11y/no-aria-hidden-on-focusable", "jsx-a11y/no-autofocus", "jsx-a11y/no-distracting-elements", "jsx-a11y/no-redundant-roles", "jsx-a11y/prefer-tag-over-role", "jsx-a11y/role-has-required-aria-props", "jsx-a11y/role-supports-aria-props", "jsx-a11y/scope", "jsx-a11y/tabindex-no-positive", "@next/next/google-font-display", "@next/next/google-font-preconnect", "@next/next/inline-script-id", "@next/next/next-script-for-ga", "@next/next/no-assign-module-variable", "@next/next/no-async-client-component", "@next/next/no-before-interactive-script-outside-document", "@next/next/no-css-tags", "@next/next/no-document-import-in-page", "@next/next/no-duplicate-head", "@next/next/no-head-element", "@next/next/no-head-import-in-document", "@next/next/no-img-element", "@next/next/no-page-custom-font", "@next/next/no-script-component-in-head", "@next/next/no-styled-jsx-in-document", "@next/next/no-sync-scripts", "@next/next/no-title-in-document-head", "@next/next/no-typos", "@next/next/no-unwanted-polyfillio", "@next/next/no-html-link-for-pages", "promise/no-callback-in-promise", "promise/no-new-statics", "promise/valid-params", "react-hooks/exhaustive-deps", "react/forward-ref-uses-ref", "react/jsx-key", "react/jsx-no-duplicate-props", "react/jsx-no-target-blank", "react/jsx-no-undef", "react/jsx-props-no-spread-multi", "react/no-children-prop", "react/no-danger-with-children", "react/no-direct-mutation-state", "react/no-find-dom-node", "react/no-is-mounted", "react/no-render-return-value", "react/no-string-refs", "react/void-dom-elements-no-children", "@typescript-eslint/no-duplicate-enum-values", "@typescript-eslint/no-extra-non-null-assertion", "@typescript-eslint/no-misused-new", "@typescript-eslint/no-non-null-asserted-optional-chain", "@typescript-eslint/no-this-alias", "@typescript-eslint/no-unnecessary-parameter-property-assignment", "@typescript-eslint/no-unsafe-declaration-merging", "@typescript-eslint/no-useless-empty-export", "@typescript-eslint/no-wrapper-object-types", "@typescript-eslint/prefer-as-const", "@typescript-eslint/triple-slash-reference", "unicorn/no-invalid-fetch-options", "unicorn/no-await-in-promise-methods", "unicorn/no-empty-file", "unicorn/no-invalid-remove-event-listener", "unicorn/no-new-array", "unicorn/no-single-promise-in-promise-methods", "unicorn/no-thenable", "unicorn/no-unnecessary-await", "unicorn/no-useless-fallback-in-spread", "unicorn/no-useless-length-check", "unicorn/no-useless-spread", "unicorn/prefer-set-size", "unicorn/prefer-string-starts-ends-with", "vitest/no-conditional-tests", "vitest/require-local-test-context-for-concurrent-snapshots", "@typescript-eslint/no-dupe-class-members", "@typescript-eslint/no-loss-of-precision", "@typescript-eslint/no-unused-vars", "import-x/default", "import-x/namespace", "vitest/expect-expect", "vitest/no-conditional-expect", "vitest/no-disabled-tests", "vitest/no-focused-tests", "vitest/no-standalone-expect", "vitest/require-to-throw-message", "vitest/valid-describe-callback", "vitest/valid-expect" ]; const nurseryRules = [ "getter-return", "no-undef", "no-unreachable", "import/export", "import/named", "promise/no-return-in-finally", "react/require-render-return", "import-x/export", "import-x/named" ]; const perfRules = [ "no-await-in-loop", "no-useless-call", "react/no-array-index-key", "react-perf/jsx-no-jsx-as-prop", "react-perf/jsx-no-new-array-as-prop", "react-perf/jsx-no-new-function-as-prop", "react-perf/jsx-no-new-object-as-prop", "unicorn/prefer-array-find", "unicorn/prefer-array-flat-map", "unicorn/prefer-set-has" ]; export { correctnessRules, nurseryRules, pedanticRules, perfRules, restrictionRules, styleRules, suspiciousRules };