diff --git a/dist/index.mjs b/dist/index.mjs index ed323c0..b7a31d4 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -82,71 +82,61 @@ const functionalRules = { //#endregion //#region ../rules/eslint.ts const esLintRules = { - "array-callback-return": [ - "error", + "eslint/accessor-pairs": ["deny", { enforceForTSTypes: true }], + "eslint/array-callback-return ": ["deny", { checkForEach: true }], + "eslint/arrow-body-style": ["deny", "as-needed", { requireReturnForObjectLiteral: false }], + "eslint/block-scoped-var": "deny", + "eslint/capitalized-comments": [ + "deny", + "always", { - allowVoid: true, - checkForEach: true, + block: { ignoreConsecutiveComments: true }, + line: { ignoreConsecutiveComments: true }, }, ], - "for-direction": "error", - "max-params": ["error", { max: 3 }], - "no-array-constructor": "error", - "no-async-promise-executor": "error", - "no-case-declarations": "error", - "no-compare-neg-zero": "error", - "no-cond-assign": "error", - "no-constant-binary-expression": "error", - "no-constant-condition": "error", - "no-control-regex": "error", - "no-debugger": "error", - "no-delete-var": "error", - "no-dupe-else-if": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": ["error", { allowSeparateTypeImports: true }], - "no-empty": "error", - "no-empty-character-class": "error", - "no-empty-function": "error", - "no-empty-pattern": "error", - "no-empty-static-block": "error", - "no-ex-assign": "error", - "no-extra-boolean-cast": "error", - "no-fallthrough": "error", - "no-global-assign": "error", - "no-invalid-regexp": "error", - "no-irregular-whitespace": "error", - "no-loss-of-precision": "error", - "no-misleading-character-class": "error", - "no-nonoctal-decimal-escape": "error", - "no-param-reassign": "error", - "no-prototype-builtins": "error", - "no-regex-spaces": "error", - "no-self-assign": "error", - "no-shadow-restricted-names": "error", - "no-sparse-arrays": "error", - "no-unassigned-vars": "error", - "no-unexpected-multiline": "error", - "no-unneeded-ternary": ["error", { defaultAssignment: false }], - "no-unsafe-finally": "error", - "no-unsafe-optional-chaining": "error", - "no-unused-expressions": "error", - "no-unused-labels": "error", - "no-unused-private-class-members": "error", - "no-unused-vars": "error", - "no-useless-backreference": "error", - "no-useless-catch": "error", - "no-useless-constructor": "error", - "no-useless-escape": "error", - "no-var": "error", - "prefer-const": "error", - "prefer-rest-params": "error", - "prefer-spread": "error", - "preserve-caught-error": "error", - "require-yield": "error", - "sort-imports": "off", - "use-isnan": "error", - "valid-typeof": "error", - yoda: ["error", "never"], + "eslint/constructor-super": "deny", + "eslint/curly": ["deny", "all"], + "eslint/default-case": "deny", + "eslint/default-case-last": "deny", + "eslint/default-param-last": "deny", + "eslint/eqeqeq": "deny", + "eslint/for-direction": "deny", + "eslint/func-names": "allow", + "eslint/func-style": ["deny", "expression", { allowArrowFunctions: true }], + "eslint/getter-return": "deny", + "eslint/grouped-accessor-pairs": ["deny", "setBeforeGet", { enforceForTSTypes: true }], + "eslint/guard-for-in": "deny", + "eslint/id-length": "deny", + "eslint/init-declarations": ["deny", "always"], + "eslint/new-cap": [ + "deny", + { + capIsNew: false, + newIsCap: true, + properties: true, + }, + ], + "eslint/no-alert": "deny", + "eslint/no-array-constructor": "deny", + "eslint/no-async-promise-executor": "deny", + "eslint/no-await-in-loop": "deny", + "eslint/no-bitwise": "deny", + "eslint/no-caller": "deny", + "eslint/no-case-declarations": "deny", + "eslint/no-class-assign": "deny", + "eslint/no-compare-neg-zero": "deny", + "eslint/no-cond-assign": "deny", + "eslint/no-console": "allow", + "eslint/no-const-assign": "deny", + "eslint/no-constant-binary-expression": "deny", + "eslint/no-constant-condition": ["deny", { checkLoops: "allExceptWhileTrue" }], + "eslint/no-constructor-return": "deny", + "eslint/no-continue": "allow", + "eslint/no-control-regex": "deny", + "eslint/no-debugger": "deny", + "eslint/no-delete-var": "deny", + "eslint/no-div-regex": "allow", + "eslint/no-dupe-class-members": "deny", }; //#endregion @@ -752,7 +742,7 @@ const unicornRules = { "unicorn/prefer-string-starts-ends-with": "error", "unicorn/prefer-string-trim-start-end": "error", "unicorn/prefer-structured-clone": "error", - "unicorn/prefer-ternary": "error", + "unicorn/prefer-ternary": "off", "unicorn/prefer-top-level-await": "error", "unicorn/prefer-type-error": "error", "unicorn/relative-url-style": "error", @@ -768,12 +758,12 @@ const unicornRules = { //#region ../index.ts const config = defineConfig({ categories: { - correctness: "warn", - nursery: "warn", - pedantic: "warn", - perf: "error", - style: "error", - suspicious: "error", + correctness: "off", + nursery: "off", + pedantic: "off", + perf: "off", + style: "off", + suspicious: "off", }, env: { browser: true, @@ -781,7 +771,7 @@ const config = defineConfig({ es2026: true, node: true, }, - ignorePatterns: ["dist/**/*"], + ignorePatterns: [".astro", ".cache", "dist/**/*"], jsPlugins: ["eslint-plugin-functional", "eslint-plugin-perfectionist", "eslint-plugin-sonarjs"], options: { reportUnusedDisableDirectives: "warn", diff --git a/index.ts b/index.ts index 7bc9a60..cf0b2fe 100644 --- a/index.ts +++ b/index.ts @@ -11,12 +11,12 @@ import unicornRules from "./rules/unicorn"; const config: OxlintConfig = defineConfig({ categories: { - correctness: "warn", - nursery: "warn", - pedantic: "warn", - perf: "error", - style: "error", - suspicious: "error", + correctness: "off", + nursery: "off", + pedantic: "off", + perf: "off", + style: "off", + suspicious: "off", }, env: { browser: true, diff --git a/rules/eslint.ts b/rules/eslint.ts index 672d087..5c6735d 100644 --- a/rules/eslint.ts +++ b/rules/eslint.ts @@ -1,87 +1,93 @@ import type { DummyRuleMap } from "oxlint"; const esLintRules: DummyRuleMap = { - "array-callback-return": [ - "error", + "eslint/accessor-pairs": ["deny", { enforceForTSTypes: true }], + "eslint/array-callback-return ": [ + "deny", { - allowVoid: true, checkForEach: true, }, ], - "for-direction": "error", - "max-params": [ - "error", + "eslint/arrow-body-style": [ + "deny", + "as-needed", { - max: 3, + requireReturnForObjectLiteral: false, }, ], - "no-array-constructor": "error", - "no-async-promise-executor": "error", - "no-case-declarations": "error", - "no-compare-neg-zero": "error", - "no-cond-assign": "error", - "no-constant-binary-expression": "error", - "no-constant-condition": "error", - "no-control-regex": "error", - "no-debugger": "error", - "no-delete-var": "error", - "no-dupe-else-if": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": [ - "error", + "eslint/block-scoped-var": "deny", + "eslint/capitalized-comments": [ + "deny", + "always", { - allowSeparateTypeImports: true, + block: { + ignoreConsecutiveComments: true, + }, + line: { + ignoreConsecutiveComments: true, + }, }, ], - "no-empty": "error", - "no-empty-character-class": "error", - "no-empty-function": "error", - "no-empty-pattern": "error", - "no-empty-static-block": "error", - "no-ex-assign": "error", - "no-extra-boolean-cast": "error", - "no-fallthrough": "error", - "no-global-assign": "error", - "no-invalid-regexp": "error", - "no-irregular-whitespace": "error", - "no-loss-of-precision": "error", - "no-misleading-character-class": "error", - "no-nonoctal-decimal-escape": "error", - "no-param-reassign": "error", - "no-prototype-builtins": "error", - "no-regex-spaces": "error", - "no-self-assign": "error", - "no-shadow-restricted-names": "error", - "no-sparse-arrays": "error", - "no-unassigned-vars": "error", - "no-unexpected-multiline": "error", - "no-unneeded-ternary": [ - "error", + "eslint/constructor-super": "deny", + "eslint/curly": ["deny", "all"], + "eslint/default-case": "deny", + "eslint/default-case-last": "deny", + "eslint/default-param-last": "deny", + "eslint/eqeqeq": "deny", + "eslint/for-direction": "deny", + "eslint/func-names": "allow", + "eslint/func-style": [ + "deny", + "expression", { - defaultAssignment: false, + allowArrowFunctions: true, }, ], - "no-unsafe-finally": "error", - "no-unsafe-optional-chaining": "error", - "no-unused-expressions": "error", - "no-unused-labels": "error", - "no-unused-private-class-members": "error", - "no-unused-vars": "error", - "no-useless-backreference": "error", - "no-useless-catch": "error", - "no-useless-constructor": "error", - "no-useless-escape": "error", - "no-var": "error", - "prefer-const": "error", - "prefer-rest-params": "error", - "prefer-spread": "error", - "preserve-caught-error": "error", - "require-yield": "error", - // Rentre en conflit avec perfectionnist. - "sort-imports": "off", - "use-isnan": "error", - "valid-typeof": "error", - yoda: ["error", "never"], + "eslint/getter-return": "deny", + "eslint/grouped-accessor-pairs": [ + "deny", + "setBeforeGet", + { + enforceForTSTypes: true, + }, + ], + "eslint/guard-for-in": "deny", + "eslint/id-length": "deny", + "eslint/init-declarations": ["deny", "always"], + "eslint/new-cap": [ + "deny", + { + capIsNew: false, + newIsCap: true, + properties: true, + }, + ], + "eslint/no-alert": "deny", + "eslint/no-array-constructor": "deny", + "eslint/no-async-promise-executor": "deny", + "eslint/no-await-in-loop": "deny", + "eslint/no-bitwise": "deny", + "eslint/no-caller": "deny", + "eslint/no-case-declarations": "deny", + "eslint/no-class-assign": "deny", + "eslint/no-compare-neg-zero": "deny", + "eslint/no-cond-assign": "deny", + "eslint/no-console": "allow", + "eslint/no-const-assign": "deny", + "eslint/no-constant-binary-expression": "deny", + "eslint/no-constant-condition": [ + "deny", + { + checkLoops: "allExceptWhileTrue", + }, + ], + "eslint/no-constructor-return": "deny", + "eslint/no-continue": "allow", + "eslint/no-control-regex": "deny", + "eslint/no-debugger": "deny", + "eslint/no-delete-var": "deny", + "eslint/no-div-regex": "allow", + "eslint/no-dupe-class-members": "deny", }; export default esLintRules; diff --git a/rules/old-eslint.ts b/rules/old-eslint.ts new file mode 100644 index 0000000..672d087 --- /dev/null +++ b/rules/old-eslint.ts @@ -0,0 +1,87 @@ +import type { DummyRuleMap } from "oxlint"; + +const esLintRules: DummyRuleMap = { + "array-callback-return": [ + "error", + { + allowVoid: true, + checkForEach: true, + }, + ], + "for-direction": "error", + "max-params": [ + "error", + { + max: 3, + }, + ], + "no-array-constructor": "error", + "no-async-promise-executor": "error", + "no-case-declarations": "error", + "no-compare-neg-zero": "error", + "no-cond-assign": "error", + "no-constant-binary-expression": "error", + "no-constant-condition": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-dupe-else-if": "error", + "no-duplicate-case": "error", + "no-duplicate-imports": [ + "error", + { + allowSeparateTypeImports: true, + }, + ], + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-function": "error", + "no-empty-pattern": "error", + "no-empty-static-block": "error", + "no-ex-assign": "error", + "no-extra-boolean-cast": "error", + "no-fallthrough": "error", + "no-global-assign": "error", + "no-invalid-regexp": "error", + "no-irregular-whitespace": "error", + "no-loss-of-precision": "error", + "no-misleading-character-class": "error", + "no-nonoctal-decimal-escape": "error", + "no-param-reassign": "error", + "no-prototype-builtins": "error", + "no-regex-spaces": "error", + "no-self-assign": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-unassigned-vars": "error", + "no-unexpected-multiline": "error", + "no-unneeded-ternary": [ + "error", + { + defaultAssignment: false, + }, + ], + "no-unsafe-finally": "error", + "no-unsafe-optional-chaining": "error", + "no-unused-expressions": "error", + "no-unused-labels": "error", + "no-unused-private-class-members": "error", + "no-unused-vars": "error", + "no-useless-backreference": "error", + "no-useless-catch": "error", + "no-useless-constructor": "error", + "no-useless-escape": "error", + "no-var": "error", + "prefer-const": "error", + "prefer-rest-params": "error", + "prefer-spread": "error", + "preserve-caught-error": "error", + "require-yield": "error", + // Rentre en conflit avec perfectionnist. + "sort-imports": "off", + "use-isnan": "error", + "valid-typeof": "error", + yoda: ["error", "never"], +}; + +export default esLintRules;