2026-04-03
- eslint OK - import OK - jsdoc OK - node OK - oxc OK - promise OK - typescript OK - unicorn en cours
This commit is contained in:
parent
93dd909919
commit
f5b489235d
22 changed files with 3087 additions and 1600 deletions
104
rules/astro.ts
104
rules/astro.ts
|
|
@ -7,70 +7,70 @@ const astroConfig: OxlintOverride = {
|
|||
files: ["**/*.astro"],
|
||||
jsPlugins: ["eslint-plugin-astro"],
|
||||
rules: {
|
||||
"astro/jsx-a11y/alt-text": "error",
|
||||
"astro/jsx-a11y/anchor-ambiguous-text": "error",
|
||||
"astro/jsx-a11y/anchor-has-content": "error",
|
||||
"astro/jsx-a11y/anchor-is-valid": "error",
|
||||
"astro/jsx-a11y/aria-activedescendant-has-tabindex": "error",
|
||||
"astro/jsx-a11y/aria-props": "error",
|
||||
"astro/jsx-a11y/aria-proptypes": "error",
|
||||
"astro/jsx-a11y/aria-role": "error",
|
||||
"astro/jsx-a11y/aria-unsupported-elements": "error",
|
||||
"astro/jsx-a11y/autocomplete-valid": "error",
|
||||
"astro/jsx-a11y/click-events-have-key-events": "error",
|
||||
"astro/jsx-a11y/control-has-associated-label": "error",
|
||||
"astro/jsx-a11y/heading-has-content": "error",
|
||||
"astro/jsx-a11y/html-has-lang": "error",
|
||||
"astro/jsx-a11y/iframe-has-title": "error",
|
||||
"astro/jsx-a11y/img-redundant-alt": "error",
|
||||
"astro/jsx-a11y/interactive-supports-focus": "error",
|
||||
"astro/jsx-a11y/label-has-associated-control": "error",
|
||||
"astro/jsx-a11y/lang": "error",
|
||||
"astro/jsx-a11y/media-has-caption": "error",
|
||||
"astro/jsx-a11y/mouse-events-have-key-events": "error",
|
||||
"astro/jsx-a11y/no-access-key": "error",
|
||||
"astro/jsx-a11y/no-aria-hidden-on-focusable": "error",
|
||||
"astro/jsx-a11y/no-autofocus": "error",
|
||||
"astro/jsx-a11y/no-distracting-elements": "error",
|
||||
"astro/jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
|
||||
"astro/jsx-a11y/no-noninteractive-element-interactions": "error",
|
||||
"astro/jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
|
||||
"astro/jsx-a11y/no-noninteractive-tabindex": "error",
|
||||
"astro/jsx-a11y/no-redundant-roles": "error",
|
||||
"astro/jsx-a11y/no-static-element-interactions": "error",
|
||||
"astro/jsx-a11y/prefer-tag-over-role": "error",
|
||||
"astro/jsx-a11y/role-has-required-aria-props": "error",
|
||||
"astro/jsx-a11y/role-supports-aria-props": "error",
|
||||
"astro/jsx-a11y/scope": "error",
|
||||
"astro/jsx-a11y/tabindex-no-positive": "error",
|
||||
"astro/missing-client-only-directive-value": "error",
|
||||
"astro/no-conflict-set-directives": "error",
|
||||
"astro/no-deprecated-astro-canonicalurl": "error",
|
||||
"astro/no-deprecated-astro-fetchcontent": "error",
|
||||
"astro/no-deprecated-astro-resolve": "error",
|
||||
"astro/no-deprecated-getentrybyslug": "error",
|
||||
"astro/no-exports-from-components": "error",
|
||||
"astro/no-set-html-directive": "error",
|
||||
"astro/no-set-text-directive": "error",
|
||||
"astro/no-unused-css-selector": "error",
|
||||
"astro/no-unused-define-vars-in-style": "error",
|
||||
"astro/prefer-class-list-directive": "error",
|
||||
"astro/prefer-object-class-list": "error",
|
||||
"astro/jsx-a11y/alt-text": "deny",
|
||||
"astro/jsx-a11y/anchor-ambiguous-text": "deny",
|
||||
"astro/jsx-a11y/anchor-has-content": "deny",
|
||||
"astro/jsx-a11y/anchor-is-valid": "deny",
|
||||
"astro/jsx-a11y/aria-activedescendant-has-tabindex": "deny",
|
||||
"astro/jsx-a11y/aria-props": "deny",
|
||||
"astro/jsx-a11y/aria-proptypes": "deny",
|
||||
"astro/jsx-a11y/aria-role": "deny",
|
||||
"astro/jsx-a11y/aria-unsupported-elements": "deny",
|
||||
"astro/jsx-a11y/autocomplete-valid": "deny",
|
||||
"astro/jsx-a11y/click-events-have-key-events": "deny",
|
||||
"astro/jsx-a11y/control-has-associated-label": "deny",
|
||||
"astro/jsx-a11y/heading-has-content": "deny",
|
||||
"astro/jsx-a11y/html-has-lang": "deny",
|
||||
"astro/jsx-a11y/iframe-has-title": "deny",
|
||||
"astro/jsx-a11y/img-redundant-alt": "deny",
|
||||
"astro/jsx-a11y/interactive-supports-focus": "deny",
|
||||
"astro/jsx-a11y/label-has-associated-control": "deny",
|
||||
"astro/jsx-a11y/lang": "deny",
|
||||
"astro/jsx-a11y/media-has-caption": "deny",
|
||||
"astro/jsx-a11y/mouse-events-have-key-events": "deny",
|
||||
"astro/jsx-a11y/no-access-key": "deny",
|
||||
"astro/jsx-a11y/no-aria-hidden-on-focusable": "deny",
|
||||
"astro/jsx-a11y/no-autofocus": "deny",
|
||||
"astro/jsx-a11y/no-distracting-elements": "deny",
|
||||
"astro/jsx-a11y/no-interactive-element-to-noninteractive-role": "deny",
|
||||
"astro/jsx-a11y/no-noninteractive-element-interactions": "deny",
|
||||
"astro/jsx-a11y/no-noninteractive-element-to-interactive-role": "deny",
|
||||
"astro/jsx-a11y/no-noninteractive-tabindex": "deny",
|
||||
"astro/jsx-a11y/no-redundant-roles": "deny",
|
||||
"astro/jsx-a11y/no-static-element-interactions": "deny",
|
||||
"astro/jsx-a11y/prefer-tag-over-role": "deny",
|
||||
"astro/jsx-a11y/role-has-required-aria-props": "deny",
|
||||
"astro/jsx-a11y/role-supports-aria-props": "deny",
|
||||
"astro/jsx-a11y/scope": "deny",
|
||||
"astro/jsx-a11y/tabindex-no-positive": "deny",
|
||||
"astro/missing-client-only-directive-value": "deny",
|
||||
"astro/no-conflict-set-directives": "deny",
|
||||
"astro/no-deprecated-astro-canonicalurl": "deny",
|
||||
"astro/no-deprecated-astro-fetchcontent": "deny",
|
||||
"astro/no-deprecated-astro-resolve": "deny",
|
||||
"astro/no-deprecated-getentrybyslug": "deny",
|
||||
"astro/no-exports-from-components": "deny",
|
||||
"astro/no-set-html-directive": "deny",
|
||||
"astro/no-set-text-directive": "deny",
|
||||
"astro/no-unused-css-selector": "deny",
|
||||
"astro/no-unused-define-vars-in-style": "deny",
|
||||
"astro/prefer-class-list-directive": "deny",
|
||||
"astro/prefer-object-class-list": "deny",
|
||||
"astro/prefer-split-class-list": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
splitLiteral: false,
|
||||
},
|
||||
],
|
||||
"astro/sort-attributes": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
ignoreCase: false,
|
||||
order: "asc",
|
||||
type: "alphabetical",
|
||||
},
|
||||
],
|
||||
"astro/valid-compile": "error",
|
||||
"astro/valid-compile": "deny",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,17 @@ const esLintRules: DummyRuleMap = {
|
|||
},
|
||||
],
|
||||
"eslint/guard-for-in": "deny",
|
||||
"eslint/id-length": "deny",
|
||||
"eslint/id-length": [
|
||||
"deny",
|
||||
{
|
||||
checkGeneric: true,
|
||||
exceptionPatterns: [],
|
||||
exceptions: ["_"],
|
||||
max: 100_000_000,
|
||||
min: 2,
|
||||
properties: "always",
|
||||
},
|
||||
],
|
||||
"eslint/init-declarations": ["deny", "always"],
|
||||
"eslint/new-cap": [
|
||||
"deny",
|
||||
|
|
@ -266,6 +276,7 @@ const esLintRules: DummyRuleMap = {
|
|||
"deny",
|
||||
{
|
||||
args: "all",
|
||||
argsIgnorePattern: "^_",
|
||||
caughtErrors: "all",
|
||||
fix: {
|
||||
ignoreClassWithStaticInitBlock: false,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import type { DummyRuleMap } from "oxlint";
|
||||
|
||||
const functionalRules: DummyRuleMap = {
|
||||
"functional/immutable-data": "error",
|
||||
"functional/no-let": "error",
|
||||
"functional/no-throw-statements": "error",
|
||||
"functional/no-try-statements": "error",
|
||||
"functional/prefer-property-signatures": "error",
|
||||
"functional/readonly-type": ["error", "generic"],
|
||||
"functional/immutable-data": "deny",
|
||||
"functional/no-let": "deny",
|
||||
"functional/no-throw-statements": "deny",
|
||||
"functional/no-try-statements": "deny",
|
||||
"functional/prefer-property-signatures": "deny",
|
||||
"functional/readonly-type": ["deny", "generic"],
|
||||
};
|
||||
|
||||
export default functionalRules;
|
||||
|
|
|
|||
101
rules/import.ts
Normal file
101
rules/import.ts
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
import type { DummyRuleMap } from "oxlint";
|
||||
|
||||
const importRules: DummyRuleMap = {
|
||||
"import/consistent-type-specifier-style": ["deny", "prefer-top-level"],
|
||||
"import/default": "deny",
|
||||
"import/export": "deny",
|
||||
"import/exports-last": "deny",
|
||||
"import/extensions": [
|
||||
"deny",
|
||||
"always",
|
||||
{
|
||||
checkTypeImports: true,
|
||||
ignorePackages: true,
|
||||
},
|
||||
],
|
||||
"import/first": ["deny", "absolute-first"],
|
||||
"import/group-exports": "deny",
|
||||
"import/max-dependencies": "allow",
|
||||
"import/named": "deny",
|
||||
"import/namespace": [
|
||||
"deny",
|
||||
{
|
||||
allowComputed: false,
|
||||
},
|
||||
],
|
||||
"import/no-absolute-path": [
|
||||
"deny",
|
||||
{
|
||||
amd: false,
|
||||
commonjs: true,
|
||||
esmodule: true,
|
||||
},
|
||||
],
|
||||
"import/no-amd": "deny",
|
||||
"import/no-anonymous-default-export": [
|
||||
"deny",
|
||||
{
|
||||
allowAnonymousClass: false,
|
||||
allowAnonymousFunction: false,
|
||||
allowArray: false,
|
||||
allowArrowFunction: false,
|
||||
allowCallExpression: false,
|
||||
allowLiteral: false,
|
||||
allowNew: false,
|
||||
allowObject: false,
|
||||
},
|
||||
],
|
||||
"import/no-commonjs": [
|
||||
"deny",
|
||||
{
|
||||
allowConditionalRequire: false,
|
||||
allowPrimitiveModules: false,
|
||||
allowRequire: false,
|
||||
},
|
||||
],
|
||||
"import/no-cycle": [
|
||||
"deny",
|
||||
{
|
||||
allowUnsafeDynamicCyclicDependency: false,
|
||||
ignoreExternal: false,
|
||||
ignoreTypes: true,
|
||||
maxDepth: 4_294_967_295,
|
||||
},
|
||||
],
|
||||
// J'aime les exports par défaut.
|
||||
"import/no-default-export": "allow",
|
||||
"import/no-duplicates": [
|
||||
"deny",
|
||||
{
|
||||
considerQueryString: true,
|
||||
preferInline: false,
|
||||
},
|
||||
],
|
||||
"import/no-dynamic-require": [
|
||||
"deny",
|
||||
{
|
||||
esmodule: true,
|
||||
},
|
||||
],
|
||||
"import/no-empty-named-blocks": "deny",
|
||||
"import/no-mutable-exports": "deny",
|
||||
"import/no-named-as-default": "deny",
|
||||
"import/no-named-as-default-member": "deny",
|
||||
"import/no-named-default": "deny",
|
||||
"import/no-named-export": "deny",
|
||||
"import/no-namespace": "deny",
|
||||
"import/no-nodejs-modules": "allow",
|
||||
"import/no-relative-parent-imports": "allow",
|
||||
"import/no-self-import": "deny",
|
||||
"import/no-unassigned-import": "deny",
|
||||
"import/no-webpack-loader-syntax": "deny",
|
||||
"import/prefer-default-export": [
|
||||
"deny",
|
||||
{
|
||||
target: "single",
|
||||
},
|
||||
],
|
||||
"import/unambiguous": "deny",
|
||||
};
|
||||
|
||||
export default importRules;
|
||||
|
|
@ -7,20 +7,50 @@ const jsDocRules: DummyRuleMap = {
|
|||
"warn",
|
||||
{
|
||||
definedTags: ["link"],
|
||||
typed: true,
|
||||
},
|
||||
],
|
||||
"jsdoc/empty-tags": "warn",
|
||||
"jsdoc/implements-on-classes": "warn",
|
||||
"jsdoc/no-defaults": "warn",
|
||||
"jsdoc/require-param": "warn",
|
||||
"jsdoc/no-defaults": ["warn", { noOptionalParamNames: true }],
|
||||
"jsdoc/require-param": [
|
||||
"warn",
|
||||
{
|
||||
checkConstructors: true,
|
||||
checkDestructured: true,
|
||||
checkDestructuredRoots: true,
|
||||
checkGetters: true,
|
||||
checkRestProperty: true,
|
||||
checkSetters: true,
|
||||
},
|
||||
],
|
||||
"jsdoc/require-param-description": "warn",
|
||||
"jsdoc/require-param-name": "warn",
|
||||
// Pris en charge par les annotations de type TypeScript.
|
||||
"jsdoc/require-param-type": "allow",
|
||||
"jsdoc/require-property": "warn",
|
||||
"jsdoc/require-property-description": "warn",
|
||||
"jsdoc/require-property-name": "warn",
|
||||
"jsdoc/require-returns": "warn",
|
||||
// Pris en charge par les annotations de type TypeScript.
|
||||
"jsdoc/require-property-type": "allow",
|
||||
"jsdoc/require-returns": [
|
||||
"warn",
|
||||
{
|
||||
checkConstructors: true,
|
||||
checkGetters: true,
|
||||
forceRequireReturn: true,
|
||||
forceReturnsWithAsync: true,
|
||||
},
|
||||
],
|
||||
"jsdoc/require-returns-description": "warn",
|
||||
"jsdoc/require-yields": "warn",
|
||||
"jsdoc/require-returns-type": "allow",
|
||||
"jsdoc/require-yields": [
|
||||
"warn",
|
||||
{
|
||||
forceRequireYields: false,
|
||||
withGeneratorTag: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default jsDocRules;
|
||||
|
|
|
|||
12
rules/node.ts
Normal file
12
rules/node.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import type { DummyRuleMap } from "oxlint";
|
||||
|
||||
const nodeRules: DummyRuleMap = {
|
||||
"node/global-require": "deny",
|
||||
"node/handle-callback-err": "allow",
|
||||
"node/no-exports-assign": "deny",
|
||||
"node/no-new-require": "deny",
|
||||
"node/no-path-concat": "deny",
|
||||
"node/no-process-env": "deny",
|
||||
};
|
||||
|
||||
export default nodeRules;
|
||||
|
|
@ -2,86 +2,86 @@ import type { DummyRuleMap } from "oxlint";
|
|||
|
||||
const esLintRules: DummyRuleMap = {
|
||||
"array-callback-return": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
allowVoid: true,
|
||||
checkForEach: true,
|
||||
},
|
||||
],
|
||||
"for-direction": "error",
|
||||
"for-direction": "deny",
|
||||
"max-params": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
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-array-constructor": "deny",
|
||||
"no-async-promise-executor": "deny",
|
||||
"no-case-declarations": "deny",
|
||||
"no-compare-neg-zero": "deny",
|
||||
"no-cond-assign": "deny",
|
||||
"no-constant-binary-expression": "deny",
|
||||
"no-constant-condition": "deny",
|
||||
"no-control-regex": "deny",
|
||||
"no-debugger": "deny",
|
||||
"no-delete-var": "deny",
|
||||
"no-dupe-else-if": "deny",
|
||||
"no-duplicate-case": "deny",
|
||||
"no-duplicate-imports": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
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-empty": "deny",
|
||||
"no-empty-character-class": "deny",
|
||||
"no-empty-function": "deny",
|
||||
"no-empty-pattern": "deny",
|
||||
"no-empty-static-block": "deny",
|
||||
"no-ex-assign": "deny",
|
||||
"no-extra-boolean-cast": "deny",
|
||||
"no-fallthrough": "deny",
|
||||
"no-global-assign": "deny",
|
||||
"no-invalid-regexp": "deny",
|
||||
"no-irregular-whitespace": "deny",
|
||||
"no-loss-of-precision": "deny",
|
||||
"no-misleading-character-class": "deny",
|
||||
"no-nonoctal-decimal-escape": "deny",
|
||||
"no-param-reassign": "deny",
|
||||
"no-prototype-builtins": "deny",
|
||||
"no-regex-spaces": "deny",
|
||||
"no-self-assign": "deny",
|
||||
"no-shadow-restricted-names": "deny",
|
||||
"no-sparse-arrays": "deny",
|
||||
"no-unassigned-vars": "deny",
|
||||
"no-unexpected-multiline": "deny",
|
||||
"no-unneeded-ternary": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
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",
|
||||
"no-unsafe-finally": "deny",
|
||||
"no-unsafe-optional-chaining": "deny",
|
||||
"no-unused-expressions": "deny",
|
||||
"no-unused-labels": "deny",
|
||||
"no-unused-private-class-members": "deny",
|
||||
"no-unused-vars": "deny",
|
||||
"no-useless-backreference": "deny",
|
||||
"no-useless-catch": "deny",
|
||||
"no-useless-constructor": "deny",
|
||||
"no-useless-escape": "deny",
|
||||
"no-var": "deny",
|
||||
"prefer-const": "deny",
|
||||
"prefer-rest-params": "deny",
|
||||
"prefer-spread": "deny",
|
||||
"preserve-caught-error": "deny",
|
||||
"require-yield": "deny",
|
||||
// Rentre en conflit avec perfectionnist.
|
||||
"sort-imports": "off",
|
||||
"use-isnan": "error",
|
||||
"valid-typeof": "error",
|
||||
yoda: ["error", "never"],
|
||||
"use-isnan": "deny",
|
||||
"valid-typeof": "deny",
|
||||
yoda: ["deny", "never"],
|
||||
};
|
||||
|
||||
export default esLintRules;
|
||||
|
|
|
|||
35
rules/oxc.ts
Normal file
35
rules/oxc.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import type { DummyRuleMap } from "oxlint";
|
||||
|
||||
const oxcRules: DummyRuleMap = {
|
||||
"oxc/approx-constant": "deny",
|
||||
"oxc/bad-array-method-on-arguments": "deny",
|
||||
"oxc/bad-bitwise-operator": "deny",
|
||||
"oxc/bad-char-at-comparison": "deny",
|
||||
"oxc/bad-comparison-sequence": "deny",
|
||||
"oxc/bad-min-max-func": "deny",
|
||||
"oxc/bad-object-literal-comparison": "deny",
|
||||
"oxc/bad-replace-all-arg": "deny",
|
||||
"oxc/branches-sharing-code": "warn",
|
||||
"oxc/const-comparisons": "deny",
|
||||
"oxc/double-comparisons": "deny",
|
||||
"oxc/erasing-op": "deny",
|
||||
"oxc/misrefactored-assign-op": "deny",
|
||||
"oxc/missing-throw": "deny",
|
||||
"oxc/no-accumulating-spread": "deny",
|
||||
// This rule should generally not be used in modern JavaScript/TypeScript codebases without good reason.
|
||||
"oxc/no-async-await": "allow",
|
||||
"oxc/no-async-endpoint-handlers": "allow",
|
||||
"oxc/no-barrel-file": ["deny", { threshold: 100 }],
|
||||
"oxc/no-const-enum": "deny",
|
||||
"oxc/no-map-spread": "allow",
|
||||
// In most codebases at this point, you should not use this rule.
|
||||
"oxc/no-optional-chaining": "allow",
|
||||
// In most codebases at this point, you should not use this rule.
|
||||
"oxc/no-rest-spread-properties": "allow",
|
||||
"oxc/no-this-in-exported-function": "deny",
|
||||
"oxc/number-arg-out-of-range": "deny",
|
||||
"oxc/only-used-in-recursion": "deny",
|
||||
"oxc/uninvoked-array-callback": "deny",
|
||||
};
|
||||
|
||||
export default oxcRules;
|
||||
|
|
@ -2,147 +2,147 @@ import type { DummyRuleMap } from "oxlint";
|
|||
|
||||
const perfectionistRules: DummyRuleMap = {
|
||||
"perfectionist/sort-array-includes": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-classes": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-decorators": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-enums": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-export-attributes": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-exports": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-heritage-clauses": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-import-attributes": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-interfaces": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-intersection-types": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-jsx-props": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-maps": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-modules": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-named-exports": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-named-imports": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-object-types": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-objects": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-sets": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-switch-case": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-union-types": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
},
|
||||
],
|
||||
"perfectionist/sort-variable-declarations": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
order: "asc",
|
||||
type: "natural",
|
||||
|
|
|
|||
64
rules/promise.ts
Normal file
64
rules/promise.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import type { DummyRuleMap } from "oxlint";
|
||||
|
||||
const promiseRules: DummyRuleMap = {
|
||||
"promise/always-return": [
|
||||
"deny",
|
||||
{
|
||||
ignoreAssignmentVariable: ["globalThis"],
|
||||
ignoreLastCallback: false,
|
||||
},
|
||||
],
|
||||
"promise/avoid-new": "deny",
|
||||
"promise/catch-or-return": [
|
||||
"deny",
|
||||
{
|
||||
allowFinally: false,
|
||||
allowThen: false,
|
||||
terminationMethod: ["catch"],
|
||||
},
|
||||
],
|
||||
"promise/no-callback-in-promise": [
|
||||
"deny",
|
||||
{
|
||||
callbacks: ["callback", "cb", "done", "next"],
|
||||
exceptions: [],
|
||||
timeoutsErr: false,
|
||||
},
|
||||
],
|
||||
"promise/no-multiple-resolved": "deny",
|
||||
"promise/no-nesting": "deny",
|
||||
"promise/no-new-statics": "deny",
|
||||
"promise/no-promise-in-callback": "deny",
|
||||
"promise/no-return-in-finally": "deny",
|
||||
"promise/no-return-wrap": [
|
||||
"deny",
|
||||
{
|
||||
allowReject: false,
|
||||
},
|
||||
],
|
||||
"promise/param-names": [
|
||||
"deny",
|
||||
{
|
||||
rejectPattern: "^_?reject$",
|
||||
resolvePattern: "^_?resolve$",
|
||||
},
|
||||
],
|
||||
// Émet de faux positifs avec Effect.
|
||||
"promise/prefer-await-to-callbacks": "allow",
|
||||
"promise/prefer-await-to-then": [
|
||||
"deny",
|
||||
{
|
||||
strict: true,
|
||||
},
|
||||
],
|
||||
"promise/prefer-catch": "deny",
|
||||
"promise/spec-only": [
|
||||
"deny",
|
||||
{
|
||||
allowedMethods: [],
|
||||
},
|
||||
],
|
||||
"promise/valid-params": "deny",
|
||||
};
|
||||
|
||||
export default promiseRules;
|
||||
420
rules/sonarjs.ts
420
rules/sonarjs.ts
|
|
@ -1,216 +1,216 @@
|
|||
import type { DummyRuleMap } from "oxlint";
|
||||
|
||||
const sonarJsRules: DummyRuleMap = {
|
||||
"sonarjs/anchor-precedence": "error",
|
||||
"sonarjs/argument-type": "error",
|
||||
"sonarjs/arguments-order": "error",
|
||||
"sonarjs/arguments-usage": "error",
|
||||
"sonarjs/array-callback-without-return": "error",
|
||||
"sonarjs/assertions-in-tests": "error",
|
||||
"sonarjs/aws-apigateway-public-api": "error",
|
||||
"sonarjs/aws-ec2-rds-dms-public": "error",
|
||||
"sonarjs/aws-ec2-unencrypted-ebs-volume": "error",
|
||||
"sonarjs/aws-efs-unencrypted": "error",
|
||||
"sonarjs/aws-iam-all-privileges": "error",
|
||||
"sonarjs/aws-iam-privilege-escalation": "error",
|
||||
"sonarjs/aws-iam-public-access": "error",
|
||||
"sonarjs/aws-opensearchservice-domain": "error",
|
||||
"sonarjs/aws-rds-unencrypted-databases": "error",
|
||||
"sonarjs/aws-restricted-ip-admin-access": "error",
|
||||
"sonarjs/aws-s3-bucket-granted-access": "error",
|
||||
"sonarjs/aws-s3-bucket-insecure-http": "error",
|
||||
"sonarjs/aws-s3-bucket-public-access": "error",
|
||||
"sonarjs/aws-s3-bucket-versioning": "error",
|
||||
"sonarjs/aws-sagemaker-unencrypted-notebook": "error",
|
||||
"sonarjs/aws-sns-unencrypted-topics": "error",
|
||||
"sonarjs/aws-sqs-unencrypted-queue": "error",
|
||||
"sonarjs/bitwise-operators": "error",
|
||||
"sonarjs/block-scoped-var": "error",
|
||||
"sonarjs/call-argument-line": "error",
|
||||
"sonarjs/chai-determinate-assertion": "error",
|
||||
"sonarjs/class-name": "error",
|
||||
"sonarjs/code-eval": "error",
|
||||
"sonarjs/cognitive-complexity": "error",
|
||||
"sonarjs/comma-or-logical-or-case": "error",
|
||||
"sonarjs/concise-regex": "error",
|
||||
"sonarjs/confidential-information-logging": "error",
|
||||
"sonarjs/constructor-for-side-effects": "error",
|
||||
"sonarjs/content-length": "error",
|
||||
"sonarjs/content-security-policy": "error",
|
||||
"sonarjs/cookie-no-httponly": "error",
|
||||
"sonarjs/cors": "error",
|
||||
"sonarjs/csrf": "error",
|
||||
"sonarjs/deprecation": "error",
|
||||
"sonarjs/different-types-comparison": "error",
|
||||
"sonarjs/disabled-auto-escaping": "error",
|
||||
"sonarjs/disabled-resource-integrity": "error",
|
||||
"sonarjs/disabled-timeout": "error",
|
||||
"sonarjs/duplicates-in-character-class": "error",
|
||||
"sonarjs/dynamically-constructed-templates": "error",
|
||||
"sonarjs/empty-string-repetition": "error",
|
||||
"sonarjs/encryption-secure-mode": "error",
|
||||
"sonarjs/existing-groups": "error",
|
||||
"sonarjs/file-permissions": "error",
|
||||
"sonarjs/file-uploads": "error",
|
||||
"sonarjs/fixme-tag": "error",
|
||||
"sonarjs/for-loop-increment-sign": "error",
|
||||
"sonarjs/frame-ancestors": "error",
|
||||
"sonarjs/function-inside-loop": "error",
|
||||
"sonarjs/function-return-type": "error",
|
||||
"sonarjs/future-reserved-words": "error",
|
||||
"sonarjs/generator-without-yield": "error",
|
||||
"sonarjs/hardcoded-secret-signatures": "error",
|
||||
"sonarjs/hashing": "error",
|
||||
"sonarjs/hidden-files": "error",
|
||||
"sonarjs/in-operator-type-error": "error",
|
||||
"sonarjs/inconsistent-function-call": "error",
|
||||
"sonarjs/index-of-compare-to-positive-number": "error",
|
||||
"sonarjs/insecure-cookie": "error",
|
||||
"sonarjs/insecure-jwt-token": "error",
|
||||
"sonarjs/inverted-assertion-arguments": "error",
|
||||
"sonarjs/jsx-no-leaked-render": "error",
|
||||
"sonarjs/label-position": "error",
|
||||
"sonarjs/link-with-target-blank": "error",
|
||||
"sonarjs/max-switch-cases": "error",
|
||||
"sonarjs/misplaced-loop-counter": "error",
|
||||
"sonarjs/new-operator-misuse": "error",
|
||||
"sonarjs/no-all-duplicated-branches": "error",
|
||||
"sonarjs/no-alphabetical-sort": "error",
|
||||
"sonarjs/no-angular-bypass-sanitization": "error",
|
||||
"sonarjs/no-array-delete": "error",
|
||||
"sonarjs/no-associative-arrays": "error",
|
||||
"sonarjs/no-async-constructor": "error",
|
||||
"sonarjs/no-case-label-in-switch": "error",
|
||||
"sonarjs/no-clear-text-protocols": "error",
|
||||
"sonarjs/no-code-after-done": "error",
|
||||
"sonarjs/no-collapsible-if": "error",
|
||||
"sonarjs/no-collection-size-mischeck": "error",
|
||||
"sonarjs/no-commented-code": "error",
|
||||
"sonarjs/no-control-regex": "error",
|
||||
"sonarjs/no-dead-store": "error",
|
||||
"sonarjs/no-delete-var": "error",
|
||||
"sonarjs/no-duplicate-in-composite": "error",
|
||||
"sonarjs/no-duplicate-string": "error",
|
||||
"sonarjs/no-duplicated-branches": "error",
|
||||
"sonarjs/no-element-overwrite": "error",
|
||||
"sonarjs/no-empty-after-reluctant": "error",
|
||||
"sonarjs/no-empty-alternatives": "error",
|
||||
"sonarjs/no-empty-character-class": "error",
|
||||
"sonarjs/no-empty-collection": "error",
|
||||
"sonarjs/no-empty-group": "error",
|
||||
"sonarjs/no-empty-test-file": "error",
|
||||
"sonarjs/no-equals-in-for-termination": "error",
|
||||
"sonarjs/no-exclusive-tests": "error",
|
||||
"sonarjs/no-extra-arguments": "error",
|
||||
"sonarjs/no-fallthrough": "error",
|
||||
"sonarjs/no-global-this": "error",
|
||||
"sonarjs/no-globals-shadowing": "error",
|
||||
"sonarjs/no-gratuitous-expressions": "error",
|
||||
"sonarjs/no-hardcoded-ip": "error",
|
||||
"sonarjs/no-hardcoded-passwords": "error",
|
||||
"sonarjs/no-hardcoded-secrets": "error",
|
||||
"sonarjs/no-hook-setter-in-body": "error",
|
||||
"sonarjs/no-identical-conditions": "error",
|
||||
"sonarjs/no-identical-expressions": "error",
|
||||
"sonarjs/no-identical-functions": "error",
|
||||
"sonarjs/no-ignored-exceptions": "error",
|
||||
"sonarjs/no-ignored-return": "error",
|
||||
"sonarjs/no-implicit-global": "error",
|
||||
"sonarjs/no-in-misuse": "error",
|
||||
"sonarjs/no-incomplete-assertions": "error",
|
||||
"sonarjs/no-inconsistent-returns": "error",
|
||||
"sonarjs/no-internal-api-use": "error",
|
||||
"sonarjs/no-intrusive-permissions": "error",
|
||||
"sonarjs/no-invalid-regexp": "error",
|
||||
"sonarjs/no-invariant-returns": "error",
|
||||
"sonarjs/no-inverted-boolean-check": "error",
|
||||
"sonarjs/no-ip-forward": "error",
|
||||
"sonarjs/no-labels": "error",
|
||||
"sonarjs/no-literal-call": "error",
|
||||
"sonarjs/no-mime-sniff": "error",
|
||||
"sonarjs/no-misleading-array-reverse": "error",
|
||||
"sonarjs/no-misleading-character-class": "error",
|
||||
"sonarjs/no-mixed-content": "error",
|
||||
"sonarjs/no-nested-assignment": "error",
|
||||
"sonarjs/no-nested-conditional": "error",
|
||||
"sonarjs/no-nested-functions": "error",
|
||||
"sonarjs/no-nested-switch": "error",
|
||||
"sonarjs/no-nested-template-literals": "error",
|
||||
"sonarjs/no-os-command-from-path": "error",
|
||||
"sonarjs/no-parameter-reassignment": "error",
|
||||
"sonarjs/no-primitive-wrappers": "error",
|
||||
"sonarjs/no-redundant-assignments": "error",
|
||||
"sonarjs/no-redundant-boolean": "error",
|
||||
"sonarjs/no-redundant-jump": "error",
|
||||
"sonarjs/no-redundant-optional": "error",
|
||||
"sonarjs/no-referrer-policy": "error",
|
||||
"sonarjs/no-regex-spaces": "error",
|
||||
"sonarjs/no-same-argument-assert": "error",
|
||||
"sonarjs/no-same-line-conditional": "error",
|
||||
"sonarjs/no-selector-parameter": "error",
|
||||
"sonarjs/no-session-cookies-on-static-assets": "error",
|
||||
"sonarjs/no-skipped-tests": "error",
|
||||
"sonarjs/no-small-switch": "error",
|
||||
"sonarjs/no-table-as-layout": "error",
|
||||
"sonarjs/no-try-promise": "error",
|
||||
"sonarjs/no-undefined-argument": "error",
|
||||
"sonarjs/no-unenclosed-multiline-block": "error",
|
||||
"sonarjs/no-uniq-key": "error",
|
||||
"sonarjs/no-unsafe-unzip": "error",
|
||||
"sonarjs/no-unthrown-error": "error",
|
||||
"sonarjs/no-unused-collection": "error",
|
||||
"sonarjs/no-unused-vars": "error",
|
||||
"sonarjs/no-use-of-empty-return-value": "error",
|
||||
"sonarjs/no-useless-catch": "error",
|
||||
"sonarjs/no-useless-increment": "error",
|
||||
"sonarjs/no-useless-intersection": "error",
|
||||
"sonarjs/no-useless-react-setstate": "error",
|
||||
"sonarjs/no-weak-cipher": "error",
|
||||
"sonarjs/no-weak-keys": "error",
|
||||
"sonarjs/non-existent-operator": "error",
|
||||
"sonarjs/null-dereference": "error",
|
||||
"sonarjs/object-alt-content": "error",
|
||||
"sonarjs/os-command": "error",
|
||||
"sonarjs/post-message": "error",
|
||||
"sonarjs/prefer-default-last": "error",
|
||||
"sonarjs/prefer-immediate-return": "error",
|
||||
"sonarjs/prefer-promise-shorthand": "error",
|
||||
"sonarjs/prefer-read-only-props": "error",
|
||||
"sonarjs/prefer-regexp-exec": "error",
|
||||
"sonarjs/prefer-single-boolean-return": "error",
|
||||
"sonarjs/prefer-type-guard": "error",
|
||||
"sonarjs/prefer-while": "error",
|
||||
"sonarjs/production-debug": "error",
|
||||
"sonarjs/pseudo-random": "error",
|
||||
"sonarjs/public-static-readonly": "error",
|
||||
"sonarjs/publicly-writable-directories": "error",
|
||||
"sonarjs/reduce-initial-value": "error",
|
||||
"sonarjs/redundant-type-aliases": "error",
|
||||
"sonarjs/regex-complexity": "error",
|
||||
"sonarjs/review-blockchain-mnemonic": "error",
|
||||
"sonarjs/session-regeneration": "error",
|
||||
"sonarjs/single-char-in-character-classes": "error",
|
||||
"sonarjs/single-character-alternation": "error",
|
||||
"sonarjs/slow-regex": "error",
|
||||
"sonarjs/sql-queries": "error",
|
||||
"sonarjs/stable-tests": "error",
|
||||
"sonarjs/stateful-regex": "error",
|
||||
"sonarjs/strict-transport-security": "error",
|
||||
"sonarjs/table-header": "error",
|
||||
"sonarjs/table-header-reference": "error",
|
||||
"sonarjs/test-check-exception": "error",
|
||||
"sonarjs/todo-tag": "error",
|
||||
"sonarjs/unused-import": "error",
|
||||
"sonarjs/unused-named-groups": "error",
|
||||
"sonarjs/unverified-certificate": "error",
|
||||
"sonarjs/unverified-hostname": "error",
|
||||
"sonarjs/updated-const-var": "error",
|
||||
"sonarjs/updated-loop-counter": "error",
|
||||
"sonarjs/use-type-alias": "error",
|
||||
"sonarjs/void-use": "error",
|
||||
"sonarjs/weak-ssl": "error",
|
||||
"sonarjs/x-powered-by": "error",
|
||||
"sonarjs/xml-parser-xxe": "error",
|
||||
"sonarjs/anchor-precedence": "deny",
|
||||
"sonarjs/argument-type": "deny",
|
||||
"sonarjs/arguments-order": "deny",
|
||||
"sonarjs/arguments-usage": "deny",
|
||||
"sonarjs/array-callback-without-return": "deny",
|
||||
"sonarjs/assertions-in-tests": "deny",
|
||||
"sonarjs/aws-apigateway-public-api": "deny",
|
||||
"sonarjs/aws-ec2-rds-dms-public": "deny",
|
||||
"sonarjs/aws-ec2-unencrypted-ebs-volume": "deny",
|
||||
"sonarjs/aws-efs-unencrypted": "deny",
|
||||
"sonarjs/aws-iam-all-privileges": "deny",
|
||||
"sonarjs/aws-iam-privilege-escalation": "deny",
|
||||
"sonarjs/aws-iam-public-access": "deny",
|
||||
"sonarjs/aws-opensearchservice-domain": "deny",
|
||||
"sonarjs/aws-rds-unencrypted-databases": "deny",
|
||||
"sonarjs/aws-restricted-ip-admin-access": "deny",
|
||||
"sonarjs/aws-s3-bucket-granted-access": "deny",
|
||||
"sonarjs/aws-s3-bucket-insecure-http": "deny",
|
||||
"sonarjs/aws-s3-bucket-public-access": "deny",
|
||||
"sonarjs/aws-s3-bucket-versioning": "deny",
|
||||
"sonarjs/aws-sagemaker-unencrypted-notebook": "deny",
|
||||
"sonarjs/aws-sns-unencrypted-topics": "deny",
|
||||
"sonarjs/aws-sqs-unencrypted-queue": "deny",
|
||||
"sonarjs/bitwise-operators": "deny",
|
||||
"sonarjs/block-scoped-var": "deny",
|
||||
"sonarjs/call-argument-line": "deny",
|
||||
"sonarjs/chai-determinate-assertion": "deny",
|
||||
"sonarjs/class-name": "deny",
|
||||
"sonarjs/code-eval": "deny",
|
||||
"sonarjs/cognitive-complexity": "deny",
|
||||
"sonarjs/comma-or-logical-or-case": "deny",
|
||||
"sonarjs/concise-regex": "deny",
|
||||
"sonarjs/confidential-information-logging": "deny",
|
||||
"sonarjs/constructor-for-side-effects": "deny",
|
||||
"sonarjs/content-length": "deny",
|
||||
"sonarjs/content-security-policy": "deny",
|
||||
"sonarjs/cookie-no-httponly": "deny",
|
||||
"sonarjs/cors": "deny",
|
||||
"sonarjs/csrf": "deny",
|
||||
"sonarjs/deprecation": "deny",
|
||||
"sonarjs/different-types-comparison": "deny",
|
||||
"sonarjs/disabled-auto-escaping": "deny",
|
||||
"sonarjs/disabled-resource-integrity": "deny",
|
||||
"sonarjs/disabled-timeout": "deny",
|
||||
"sonarjs/duplicates-in-character-class": "deny",
|
||||
"sonarjs/dynamically-constructed-templates": "deny",
|
||||
"sonarjs/empty-string-repetition": "deny",
|
||||
"sonarjs/encryption-secure-mode": "deny",
|
||||
"sonarjs/existing-groups": "deny",
|
||||
"sonarjs/file-permissions": "deny",
|
||||
"sonarjs/file-uploads": "deny",
|
||||
"sonarjs/fixme-tag": "deny",
|
||||
"sonarjs/for-loop-increment-sign": "deny",
|
||||
"sonarjs/frame-ancestors": "deny",
|
||||
"sonarjs/function-inside-loop": "deny",
|
||||
"sonarjs/function-return-type": "deny",
|
||||
"sonarjs/future-reserved-words": "deny",
|
||||
"sonarjs/generator-without-yield": "deny",
|
||||
"sonarjs/hardcoded-secret-signatures": "deny",
|
||||
"sonarjs/hashing": "deny",
|
||||
"sonarjs/hidden-files": "deny",
|
||||
"sonarjs/in-operator-type-error": "deny",
|
||||
"sonarjs/inconsistent-function-call": "deny",
|
||||
"sonarjs/index-of-compare-to-positive-number": "deny",
|
||||
"sonarjs/insecure-cookie": "deny",
|
||||
"sonarjs/insecure-jwt-token": "deny",
|
||||
"sonarjs/inverted-assertion-arguments": "deny",
|
||||
"sonarjs/jsx-no-leaked-render": "deny",
|
||||
"sonarjs/label-position": "deny",
|
||||
"sonarjs/link-with-target-blank": "deny",
|
||||
"sonarjs/max-switch-cases": "deny",
|
||||
"sonarjs/misplaced-loop-counter": "deny",
|
||||
"sonarjs/new-operator-misuse": "deny",
|
||||
"sonarjs/no-all-duplicated-branches": "deny",
|
||||
"sonarjs/no-alphabetical-sort": "deny",
|
||||
"sonarjs/no-angular-bypass-sanitization": "deny",
|
||||
"sonarjs/no-array-delete": "deny",
|
||||
"sonarjs/no-associative-arrays": "deny",
|
||||
"sonarjs/no-async-constructor": "deny",
|
||||
"sonarjs/no-case-label-in-switch": "deny",
|
||||
"sonarjs/no-clear-text-protocols": "deny",
|
||||
"sonarjs/no-code-after-done": "deny",
|
||||
"sonarjs/no-collapsible-if": "deny",
|
||||
"sonarjs/no-collection-size-mischeck": "deny",
|
||||
"sonarjs/no-commented-code": "deny",
|
||||
"sonarjs/no-control-regex": "deny",
|
||||
"sonarjs/no-dead-store": "deny",
|
||||
"sonarjs/no-delete-var": "deny",
|
||||
"sonarjs/no-duplicate-in-composite": "deny",
|
||||
"sonarjs/no-duplicate-string": "deny",
|
||||
"sonarjs/no-duplicated-branches": "deny",
|
||||
"sonarjs/no-element-overwrite": "deny",
|
||||
"sonarjs/no-empty-after-reluctant": "deny",
|
||||
"sonarjs/no-empty-alternatives": "deny",
|
||||
"sonarjs/no-empty-character-class": "deny",
|
||||
"sonarjs/no-empty-collection": "deny",
|
||||
"sonarjs/no-empty-group": "deny",
|
||||
"sonarjs/no-empty-test-file": "deny",
|
||||
"sonarjs/no-equals-in-for-termination": "deny",
|
||||
"sonarjs/no-exclusive-tests": "deny",
|
||||
"sonarjs/no-extra-arguments": "deny",
|
||||
"sonarjs/no-fallthrough": "deny",
|
||||
"sonarjs/no-global-this": "deny",
|
||||
"sonarjs/no-globals-shadowing": "deny",
|
||||
"sonarjs/no-gratuitous-expressions": "deny",
|
||||
"sonarjs/no-hardcoded-ip": "deny",
|
||||
"sonarjs/no-hardcoded-passwords": "deny",
|
||||
"sonarjs/no-hardcoded-secrets": "deny",
|
||||
"sonarjs/no-hook-setter-in-body": "deny",
|
||||
"sonarjs/no-identical-conditions": "deny",
|
||||
"sonarjs/no-identical-expressions": "deny",
|
||||
"sonarjs/no-identical-functions": "deny",
|
||||
"sonarjs/no-ignored-exceptions": "deny",
|
||||
"sonarjs/no-ignored-return": "deny",
|
||||
"sonarjs/no-implicit-global": "deny",
|
||||
"sonarjs/no-in-misuse": "deny",
|
||||
"sonarjs/no-incomplete-assertions": "deny",
|
||||
"sonarjs/no-inconsistent-returns": "deny",
|
||||
"sonarjs/no-internal-api-use": "deny",
|
||||
"sonarjs/no-intrusive-permissions": "deny",
|
||||
"sonarjs/no-invalid-regexp": "deny",
|
||||
"sonarjs/no-invariant-returns": "deny",
|
||||
"sonarjs/no-inverted-boolean-check": "deny",
|
||||
"sonarjs/no-ip-forward": "deny",
|
||||
"sonarjs/no-labels": "deny",
|
||||
"sonarjs/no-literal-call": "deny",
|
||||
"sonarjs/no-mime-sniff": "deny",
|
||||
"sonarjs/no-misleading-array-reverse": "deny",
|
||||
"sonarjs/no-misleading-character-class": "deny",
|
||||
"sonarjs/no-mixed-content": "deny",
|
||||
"sonarjs/no-nested-assignment": "deny",
|
||||
"sonarjs/no-nested-conditional": "deny",
|
||||
"sonarjs/no-nested-functions": "deny",
|
||||
"sonarjs/no-nested-switch": "deny",
|
||||
"sonarjs/no-nested-template-literals": "deny",
|
||||
"sonarjs/no-os-command-from-path": "deny",
|
||||
"sonarjs/no-parameter-reassignment": "deny",
|
||||
"sonarjs/no-primitive-wrappers": "deny",
|
||||
"sonarjs/no-redundant-assignments": "deny",
|
||||
"sonarjs/no-redundant-boolean": "deny",
|
||||
"sonarjs/no-redundant-jump": "deny",
|
||||
"sonarjs/no-redundant-optional": "deny",
|
||||
"sonarjs/no-referrer-policy": "deny",
|
||||
"sonarjs/no-regex-spaces": "deny",
|
||||
"sonarjs/no-same-argument-assert": "deny",
|
||||
"sonarjs/no-same-line-conditional": "deny",
|
||||
"sonarjs/no-selector-parameter": "deny",
|
||||
"sonarjs/no-session-cookies-on-static-assets": "deny",
|
||||
"sonarjs/no-skipped-tests": "deny",
|
||||
"sonarjs/no-small-switch": "deny",
|
||||
"sonarjs/no-table-as-layout": "deny",
|
||||
"sonarjs/no-try-promise": "deny",
|
||||
"sonarjs/no-undefined-argument": "deny",
|
||||
"sonarjs/no-unenclosed-multiline-block": "deny",
|
||||
"sonarjs/no-uniq-key": "deny",
|
||||
"sonarjs/no-unsafe-unzip": "deny",
|
||||
"sonarjs/no-unthrown-error": "deny",
|
||||
"sonarjs/no-unused-collection": "deny",
|
||||
"sonarjs/no-unused-vars": "deny",
|
||||
"sonarjs/no-use-of-empty-return-value": "deny",
|
||||
"sonarjs/no-useless-catch": "deny",
|
||||
"sonarjs/no-useless-increment": "deny",
|
||||
"sonarjs/no-useless-intersection": "deny",
|
||||
"sonarjs/no-useless-react-setstate": "deny",
|
||||
"sonarjs/no-weak-cipher": "deny",
|
||||
"sonarjs/no-weak-keys": "deny",
|
||||
"sonarjs/non-existent-operator": "deny",
|
||||
"sonarjs/null-dereference": "deny",
|
||||
"sonarjs/object-alt-content": "deny",
|
||||
"sonarjs/os-command": "deny",
|
||||
"sonarjs/post-message": "deny",
|
||||
"sonarjs/prefer-default-last": "deny",
|
||||
"sonarjs/prefer-immediate-return": "deny",
|
||||
"sonarjs/prefer-promise-shorthand": "deny",
|
||||
"sonarjs/prefer-read-only-props": "deny",
|
||||
"sonarjs/prefer-regexp-exec": "deny",
|
||||
"sonarjs/prefer-single-boolean-return": "deny",
|
||||
"sonarjs/prefer-type-guard": "deny",
|
||||
"sonarjs/prefer-while": "deny",
|
||||
"sonarjs/production-debug": "deny",
|
||||
"sonarjs/pseudo-random": "deny",
|
||||
"sonarjs/public-static-readonly": "deny",
|
||||
"sonarjs/publicly-writable-directories": "deny",
|
||||
"sonarjs/reduce-initial-value": "deny",
|
||||
"sonarjs/redundant-type-aliases": "deny",
|
||||
"sonarjs/regex-complexity": "deny",
|
||||
"sonarjs/review-blockchain-mnemonic": "deny",
|
||||
"sonarjs/session-regeneration": "deny",
|
||||
"sonarjs/single-char-in-character-classes": "deny",
|
||||
"sonarjs/single-character-alternation": "deny",
|
||||
"sonarjs/slow-regex": "deny",
|
||||
"sonarjs/sql-queries": "deny",
|
||||
"sonarjs/stable-tests": "deny",
|
||||
"sonarjs/stateful-regex": "deny",
|
||||
"sonarjs/strict-transport-security": "deny",
|
||||
"sonarjs/table-header": "deny",
|
||||
"sonarjs/table-header-reference": "deny",
|
||||
"sonarjs/test-check-exception": "deny",
|
||||
"sonarjs/todo-tag": "deny",
|
||||
"sonarjs/unused-import": "deny",
|
||||
"sonarjs/unused-named-groups": "deny",
|
||||
"sonarjs/unverified-certificate": "deny",
|
||||
"sonarjs/unverified-hostname": "deny",
|
||||
"sonarjs/updated-const-var": "deny",
|
||||
"sonarjs/updated-loop-counter": "deny",
|
||||
"sonarjs/use-type-alias": "deny",
|
||||
"sonarjs/void-use": "deny",
|
||||
"sonarjs/weak-ssl": "deny",
|
||||
"sonarjs/x-powered-by": "deny",
|
||||
"sonarjs/xml-parser-xxe": "deny",
|
||||
};
|
||||
|
||||
export default sonarJsRules;
|
||||
|
|
|
|||
|
|
@ -1,94 +1,374 @@
|
|||
import type { DummyRuleMap } from "oxlint";
|
||||
|
||||
/** Longueur minimale de la description accompagnat une directive (p. ex. `@ts-expect-error`). */
|
||||
const MIN_DIRECTIVE_DESCRIPTION_LENGTH = 10;
|
||||
|
||||
const typeScriptRules: DummyRuleMap = {
|
||||
"@typescript-eslint/adjacent-overload-signatures": "error",
|
||||
"@typescript-eslint/array-type": [
|
||||
"error",
|
||||
"typescript/adjacent-overload-signatures": "deny",
|
||||
"typescript/array-type": [
|
||||
"deny",
|
||||
{
|
||||
default: "generic",
|
||||
readonly: "generic",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"@typescript-eslint/ban-ts-comment": [
|
||||
"error",
|
||||
"typescript/await-thenable": "deny",
|
||||
"typescript/ban-ts-comment": [
|
||||
"deny",
|
||||
{
|
||||
minimumDescriptionLength: 10,
|
||||
minimumDescriptionLength: MIN_DIRECTIVE_DESCRIPTION_LENGTH,
|
||||
"ts-check": false,
|
||||
"ts-expect-error": "allow-with-description",
|
||||
"ts-ignore": true,
|
||||
"ts-nocheck": true,
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/ban-tslint-comment": "error",
|
||||
"@typescript-eslint/class-literal-property-style": "error",
|
||||
"@typescript-eslint/consistent-generic-constructors": "error",
|
||||
"@typescript-eslint/consistent-indexed-object-style": "error",
|
||||
"@typescript-eslint/consistent-type-assertions": "error",
|
||||
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
||||
"@typescript-eslint/dot-notation": "error",
|
||||
"@typescript-eslint/no-array-delete": "error",
|
||||
"@typescript-eslint/no-base-to-string": "error",
|
||||
"@typescript-eslint/no-confusing-non-null-assertion": "error",
|
||||
"@typescript-eslint/no-confusing-void-expression": "error",
|
||||
"@typescript-eslint/no-deprecated": "error",
|
||||
"@typescript-eslint/no-duplicate-enum-values": "error",
|
||||
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
||||
"@typescript-eslint/no-dynamic-delete": "error",
|
||||
"@typescript-eslint/no-empty-object-type": "error",
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||
"@typescript-eslint/no-extraneous-class": "error",
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
"@typescript-eslint/no-for-in-array": "error",
|
||||
"@typescript-eslint/no-implied-eval": "error",
|
||||
"@typescript-eslint/no-inferrable-types": "error",
|
||||
"@typescript-eslint/no-invalid-void-type": "error",
|
||||
"@typescript-eslint/no-meaningless-void-operator": "error",
|
||||
"@typescript-eslint/no-misused-new": "error",
|
||||
"@typescript-eslint/no-misused-promises": "error",
|
||||
"@typescript-eslint/no-misused-spread": "error",
|
||||
"@typescript-eslint/no-mixed-enums": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
||||
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
||||
"@typescript-eslint/no-non-null-assertion": "error",
|
||||
"@typescript-eslint/no-redundant-type-constituents": "error",
|
||||
"@typescript-eslint/no-require-imports": "error",
|
||||
"@typescript-eslint/no-this-alias": "error",
|
||||
"@typescript-eslint/no-unnecessary-condition": "error",
|
||||
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-arguments": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-conversion": "error",
|
||||
"@typescript-eslint/no-unsafe-argument": "error",
|
||||
"@typescript-eslint/no-unsafe-assignment": "error",
|
||||
"@typescript-eslint/no-unsafe-call": "error",
|
||||
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
||||
"@typescript-eslint/no-unsafe-enum-comparison": "error",
|
||||
"@typescript-eslint/no-unsafe-function-type": "error",
|
||||
"@typescript-eslint/no-unsafe-member-access": "error",
|
||||
"@typescript-eslint/no-unsafe-return": "error",
|
||||
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
||||
"@typescript-eslint/no-useless-default-assignment": "error",
|
||||
"@typescript-eslint/no-wrapper-object-types": "error",
|
||||
"@typescript-eslint/non-nullable-type-assertion-style": "error",
|
||||
"@typescript-eslint/prefer-as-const": "error",
|
||||
"@typescript-eslint/prefer-find": "error",
|
||||
"@typescript-eslint/prefer-for-of": "error",
|
||||
"@typescript-eslint/prefer-function-type": "error",
|
||||
"@typescript-eslint/prefer-includes": "error",
|
||||
"@typescript-eslint/prefer-literal-enum-member": "error",
|
||||
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
||||
"@typescript-eslint/prefer-optional-chain": "error",
|
||||
"@typescript-eslint/prefer-promise-reject-errors": "error",
|
||||
"@typescript-eslint/prefer-readonly": "error",
|
||||
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
||||
"@typescript-eslint/prefer-regexp-exec": "error",
|
||||
"@typescript-eslint/prefer-return-this-type": "error",
|
||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
||||
"@typescript-eslint/related-getter-setter-pairs": "error",
|
||||
"@typescript-eslint/require-await": "error",
|
||||
"@typescript-eslint/restrict-plus-operands": [
|
||||
"error",
|
||||
"typescript/ban-tslint-comment": "deny",
|
||||
"typescript/class-literal-property-style": ["deny", "fields"],
|
||||
"typescript/consistent-generic-constructors": [
|
||||
"deny",
|
||||
{
|
||||
option: "constructor",
|
||||
},
|
||||
],
|
||||
"typescript/consistent-indexed-object-style": ["deny", "record"],
|
||||
"typescript/consistent-return": [
|
||||
"deny",
|
||||
{
|
||||
treatUndefinedAsUnspecified: false,
|
||||
},
|
||||
],
|
||||
"typescript/consistent-type-assertions": [
|
||||
"deny",
|
||||
{
|
||||
assertionStyle: "never",
|
||||
},
|
||||
],
|
||||
"typescript/consistent-type-definitions": ["deny", "type"],
|
||||
"typescript/consistent-type-exports": [
|
||||
"deny",
|
||||
{
|
||||
fixMixedExportsWithInlineTypeSpecifier: false,
|
||||
},
|
||||
],
|
||||
"typescript/consistent-type-imports": [
|
||||
"deny",
|
||||
{
|
||||
disallowTypeAnnotations: true,
|
||||
fixStyle: "separate-type-imports",
|
||||
prefer: "type-imports",
|
||||
},
|
||||
],
|
||||
"typescript/dot-notation": [
|
||||
"deny",
|
||||
{
|
||||
allowIndexSignaturePropertyAccess: false,
|
||||
allowKeywords: false,
|
||||
allowPattern: "",
|
||||
allowPrivateClassPropertyAccess: false,
|
||||
allowProtectedClassPropertyAccess: false,
|
||||
},
|
||||
],
|
||||
"typescript/explicit-function-return-type": [
|
||||
"deny",
|
||||
{
|
||||
allowConciseArrowFunctionExpressionsStartingWithVoid: false,
|
||||
allowDirectConstAssertionInArrowFunctions: true,
|
||||
allowedNames: [],
|
||||
allowExpressions: false,
|
||||
allowFunctionsWithoutTypeParameters: false,
|
||||
allowHigherOrderFunctions: true,
|
||||
allowIIFEs: false,
|
||||
allowTypedFunctionExpressions: true,
|
||||
},
|
||||
],
|
||||
"typescript/explicit-module-boundary-types": [
|
||||
"deny",
|
||||
{
|
||||
allowArgumentsExplicitlyTypedAsAny: false,
|
||||
allowDirectConstAssertionInArrowFunctions: true,
|
||||
allowedNames: [],
|
||||
allowHigherOrderFunctions: true,
|
||||
allowOverloadFunctions: false,
|
||||
allowTypedFunctionExpressions: true,
|
||||
},
|
||||
],
|
||||
"typescript/no-array-delete": "deny",
|
||||
"typescript/no-base-to-string": [
|
||||
"deny",
|
||||
{
|
||||
checkUnknown: true,
|
||||
ignoredTypeNames: ["deny", "RegExp", "URL", "URLSearchParams"],
|
||||
},
|
||||
],
|
||||
"typescript/no-confusing-non-null-assertion": "deny",
|
||||
"typescript/no-confusing-void-expression": [
|
||||
"deny",
|
||||
{
|
||||
ignoreArrowShorthand: false,
|
||||
ignoreVoidOperator: false,
|
||||
ignoreVoidReturningFunctions: false,
|
||||
},
|
||||
],
|
||||
"typescript/no-deprecated": "deny",
|
||||
"typescript/no-duplicate-enum-values": "deny",
|
||||
"typescript/no-duplicate-type-constituents": [
|
||||
"deny",
|
||||
{
|
||||
ignoreIntersections: false,
|
||||
ignoreUnions: false,
|
||||
},
|
||||
],
|
||||
"typescript/no-dynamic-delete": "deny",
|
||||
"typescript/no-empty-interface": [
|
||||
"deny",
|
||||
{
|
||||
allowSingleExtends: false,
|
||||
},
|
||||
],
|
||||
"typescript/no-empty-object-type": [
|
||||
"deny",
|
||||
{
|
||||
allowInterfaces: "never",
|
||||
allowObjectTypes: "never",
|
||||
},
|
||||
],
|
||||
"typescript/no-explicit-any": [
|
||||
"deny",
|
||||
{
|
||||
fixToUnknown: true,
|
||||
ignoreRestArgs: false,
|
||||
},
|
||||
],
|
||||
"typescript/no-extra-non-null-assertion": "deny",
|
||||
"typescript/no-extraneous-class": [
|
||||
"deny",
|
||||
{
|
||||
allowConstructorOnly: false,
|
||||
allowEmpty: false,
|
||||
allowStaticOnly: false,
|
||||
allowWithDecorator: false,
|
||||
},
|
||||
],
|
||||
"typescript/no-floating-promises": [
|
||||
"deny",
|
||||
{
|
||||
allowForKnownSafeCalls: [],
|
||||
allowForKnownSafePromises: [],
|
||||
checkThenables: true,
|
||||
ignoreIIFE: false,
|
||||
ignoreVoid: false,
|
||||
},
|
||||
],
|
||||
"typescript/no-for-in-array": "deny",
|
||||
"typescript/no-implied-eval": "deny",
|
||||
"typescript/no-import-type-side-effects": "deny",
|
||||
//
|
||||
"typescript/no-inferrable-types": [
|
||||
"deny",
|
||||
{
|
||||
ignoreParameters: true,
|
||||
ignoreProperties: true,
|
||||
},
|
||||
],
|
||||
"typescript/no-invalid-void-type": [
|
||||
"deny",
|
||||
{
|
||||
allowAsThisParameter: false,
|
||||
allowInGenericTypeArguments: true,
|
||||
},
|
||||
],
|
||||
"typescript/no-meaningless-void-operator": [
|
||||
"deny",
|
||||
{
|
||||
checkNever: true,
|
||||
},
|
||||
],
|
||||
"typescript/no-misused-new": "deny",
|
||||
"typescript/no-misused-promises": [
|
||||
"deny",
|
||||
{
|
||||
checksConditionals: true,
|
||||
checksSpreads: true,
|
||||
checksVoidReturn: true,
|
||||
},
|
||||
],
|
||||
"typescript/no-misused-spread": [
|
||||
"deny",
|
||||
{
|
||||
allow: [],
|
||||
},
|
||||
],
|
||||
"typescript/no-mixed-enums": "deny",
|
||||
"typescript/no-namespace": [
|
||||
"deny",
|
||||
{
|
||||
allowDeclarations: false,
|
||||
allowDefinitionFiles: true,
|
||||
},
|
||||
],
|
||||
"typescript/no-non-null-asserted-nullish-coalescing": "deny",
|
||||
"typescript/no-non-null-asserted-optional-chain": "deny",
|
||||
"typescript/no-non-null-assertion": "deny",
|
||||
"typescript/no-redundant-type-constituents": "deny",
|
||||
"typescript/no-require-imports": [
|
||||
"deny",
|
||||
{
|
||||
allow: [],
|
||||
allowAsImport: false,
|
||||
},
|
||||
],
|
||||
"typescript/no-this-alias": [
|
||||
"deny",
|
||||
{
|
||||
allowDestructuring: false,
|
||||
allowedNames: [],
|
||||
},
|
||||
],
|
||||
// J'apprécie de pouvoir être explicite dans la comparaison.
|
||||
"typescript/no-unnecessary-boolean-literal-compare": "allow",
|
||||
"typescript/no-unnecessary-condition": [
|
||||
"deny",
|
||||
{
|
||||
allowConstantLoopConditions: "never",
|
||||
checkTypePredicates: true,
|
||||
},
|
||||
],
|
||||
"typescript/no-unnecessary-parameter-property-assignment": "deny",
|
||||
"typescript/no-unnecessary-qualifier": "deny",
|
||||
"typescript/no-unnecessary-template-expression": "deny",
|
||||
"typescript/no-unnecessary-type-arguments": "deny",
|
||||
"typescript/no-unnecessary-type-assertion": [
|
||||
"deny",
|
||||
{
|
||||
checkLiteralConstAssertions: false,
|
||||
typesToIgnore: [],
|
||||
},
|
||||
],
|
||||
"typescript/no-unnecessary-type-constraint": "deny",
|
||||
"typescript/no-unnecessary-type-conversion": "deny",
|
||||
"typescript/no-unnecessary-type-parameters": "deny",
|
||||
"typescript/no-unsafe-argument": "deny",
|
||||
"typescript/no-unsafe-assignment": "deny",
|
||||
"typescript/no-unsafe-call": "deny",
|
||||
"typescript/no-unsafe-declaration-merging": "deny",
|
||||
"typescript/no-unsafe-enum-comparison": "deny",
|
||||
"typescript/no-unsafe-function-type": "deny",
|
||||
"typescript/no-unsafe-member-access": [
|
||||
"deny",
|
||||
{
|
||||
allowOptionalChaining: false,
|
||||
},
|
||||
],
|
||||
"typescript/no-unsafe-return": "deny",
|
||||
"typescript/no-unsafe-type-assertion": "deny",
|
||||
"typescript/no-unsafe-unary-minus": "deny",
|
||||
"typescript/no-useless-default-assignment": "deny",
|
||||
"typescript/no-useless-empty-export": "deny",
|
||||
"typescript/no-wrapper-object-types": "deny",
|
||||
"typescript/non-nullable-type-assertion-style": "allow",
|
||||
"typescript/only-throw-error": [
|
||||
"deny",
|
||||
{
|
||||
allow: [],
|
||||
allowRethrowing: true,
|
||||
allowThrowingAny: false,
|
||||
allowThrowingUnknown: false,
|
||||
},
|
||||
],
|
||||
"typescript/parameter-properties": [
|
||||
"deny",
|
||||
{
|
||||
prefer: "class-property",
|
||||
},
|
||||
],
|
||||
"typescript/prefer-as-const": "deny",
|
||||
"typescript/prefer-enum-initializers": "deny",
|
||||
"typescript/prefer-find": "deny",
|
||||
"typescript/prefer-for-of": "deny",
|
||||
"typescript/prefer-function-type": "deny",
|
||||
"typescript/prefer-includes": "deny",
|
||||
|
||||
"typescript/prefer-literal-enum-member": [
|
||||
"deny",
|
||||
{
|
||||
allowBitwiseExpressions: false,
|
||||
},
|
||||
],
|
||||
"typescript/prefer-nullish-coalescing": [
|
||||
"deny",
|
||||
{
|
||||
ignoreBooleanCoercion: false,
|
||||
ignoreConditionalTests: true,
|
||||
ignoreIfStatements: false,
|
||||
ignoreMixedLogicalExpressions: false,
|
||||
ignorePrimitives: false,
|
||||
ignoreTernaryTests: false,
|
||||
},
|
||||
],
|
||||
"typescript/prefer-optional-chain": [
|
||||
"deny",
|
||||
{
|
||||
checkAny: true,
|
||||
checkBigInt: true,
|
||||
checkBoolean: true,
|
||||
checkNumber: true,
|
||||
checkString: true,
|
||||
checkUnknown: true,
|
||||
requireNullish: false,
|
||||
},
|
||||
],
|
||||
"typescript/prefer-promise-reject-errors": [
|
||||
"deny",
|
||||
{
|
||||
allowEmptyReject: false,
|
||||
allowThrowingAny: false,
|
||||
allowThrowingUnknown: false,
|
||||
},
|
||||
],
|
||||
"typescript/prefer-readonly": [
|
||||
"deny",
|
||||
{
|
||||
onlyInlineLambdas: false,
|
||||
},
|
||||
],
|
||||
// Nécessite trop de bruit dans le code avec l'ajout d'annotations de type `Readonly`.
|
||||
"typescript/prefer-readonly-parameter-types": [
|
||||
"allow",
|
||||
{
|
||||
allow: [],
|
||||
checkParameterProperties: true,
|
||||
ignoreInferredTypes: true,
|
||||
treatMethodsAsReadonly: false,
|
||||
},
|
||||
],
|
||||
"typescript/prefer-reduce-type-parameter": "deny",
|
||||
"typescript/prefer-regexp-exec": "deny",
|
||||
"typescript/prefer-return-this-type": "deny",
|
||||
"typescript/prefer-string-starts-ends-with": ["deny", { allowSingleElementEquality: "never" }],
|
||||
// Règle rendue caduque par typescript/ban-ts-comment.
|
||||
"typescript/prefer-ts-expect-error": "allow",
|
||||
"typescript/promise-function-async": [
|
||||
"deny",
|
||||
{
|
||||
allowAny: false,
|
||||
allowedPromiseNames: [],
|
||||
checkArrowFunctions: true,
|
||||
checkFunctionDeclarations: true,
|
||||
checkFunctionExpressions: true,
|
||||
checkMethodDeclarations: true,
|
||||
},
|
||||
],
|
||||
"typescript/related-getter-setter-pairs": "deny",
|
||||
"typescript/require-array-sort-compare": [
|
||||
"deny",
|
||||
{
|
||||
ignoreStringArrays: true,
|
||||
},
|
||||
],
|
||||
"typescript/require-await": "deny",
|
||||
"typescript/restrict-plus-operands": [
|
||||
"deny",
|
||||
{
|
||||
allowAny: false,
|
||||
allowBoolean: false,
|
||||
|
|
@ -97,9 +377,10 @@ const typeScriptRules: DummyRuleMap = {
|
|||
allowRegExp: false,
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/restrict-template-expressions": [
|
||||
"error",
|
||||
"typescript/restrict-template-expressions": [
|
||||
"deny",
|
||||
{
|
||||
allow: [{ from: "lib", name: ["Error", "URL", "URLSearchParams"] }],
|
||||
allowAny: false,
|
||||
allowBoolean: false,
|
||||
allowNever: false,
|
||||
|
|
@ -108,12 +389,57 @@ const typeScriptRules: DummyRuleMap = {
|
|||
allowRegExp: false,
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/return-await": ["error", "error-handling-correctness-only"],
|
||||
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
||||
"@typescript-eslint/triple-slash-reference": "error",
|
||||
"@typescript-eslint/unbound-method": "error",
|
||||
"@typescript-eslint/unified-signatures": "error",
|
||||
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
|
||||
"typescript/return-await": ["deny", "error-handling-correctness-only"],
|
||||
"typescript/strict-boolean-expressions": [
|
||||
"deny",
|
||||
{
|
||||
allowAny: false,
|
||||
allowNullableBoolean: true,
|
||||
allowNullableEnum: true,
|
||||
allowNullableNumber: false,
|
||||
allowNullableObject: false,
|
||||
allowNullableString: false,
|
||||
allowNumber: false,
|
||||
allowString: false,
|
||||
},
|
||||
],
|
||||
"typescript/strict-void-return": [
|
||||
"deny",
|
||||
{
|
||||
allowReturnAny: false,
|
||||
},
|
||||
],
|
||||
"typescript/switch-exhaustiveness-check": [
|
||||
"deny",
|
||||
{
|
||||
allowDefaultCaseForExhaustiveSwitch: true,
|
||||
considerDefaultExhaustiveForUnions: false,
|
||||
defaultCaseCommentPattern: "@skip-exhaustive-check",
|
||||
requireDefaultForNonUnion: false,
|
||||
},
|
||||
],
|
||||
"typescript/triple-slash-reference": [
|
||||
"deny",
|
||||
{
|
||||
lib: "never",
|
||||
path: "never",
|
||||
types: "prefer-import",
|
||||
},
|
||||
],
|
||||
"typescript/unbound-method": [
|
||||
"deny",
|
||||
{
|
||||
ignoreStatic: false,
|
||||
},
|
||||
],
|
||||
"typescript/unified-signatures": [
|
||||
"deny",
|
||||
{
|
||||
ignoreDifferentlyNamedParameters: false,
|
||||
ignoreOverloadsWithDifferentJSDoc: false,
|
||||
},
|
||||
],
|
||||
"typescript/use-unknown-in-catch-callback-variable": "deny",
|
||||
};
|
||||
|
||||
export default typeScriptRules;
|
||||
|
|
|
|||
564
rules/unicorn.ts
564
rules/unicorn.ts
|
|
@ -1,121 +1,467 @@
|
|||
import type { DummyRuleMap } from "oxlint";
|
||||
|
||||
const unicornRules: DummyRuleMap = {
|
||||
"unicorn/catch-error-name": "error",
|
||||
"unicorn/consistent-date-clone": "error",
|
||||
"unicorn/consistent-empty-array-spread": "error",
|
||||
"unicorn/consistent-existence-index-check": "error",
|
||||
"unicorn/custom-error-definition": "error",
|
||||
"unicorn/error-message": "error",
|
||||
"unicorn/escape-case": "error",
|
||||
/**
|
||||
* This rule enforces consistent and descriptive naming for error variables in `catch` statements, preventing the use
|
||||
* of vague names like `badName` or _ when the error is used.
|
||||
*
|
||||
* Using non-descriptive names like `badName` or _ makes the code harder to read and understand, especially when
|
||||
* debugging. It's important to use clear, consistent names to represent errors.
|
||||
*/
|
||||
"unicorn/catch-error-name": [
|
||||
"deny",
|
||||
{
|
||||
ignore: ["_"],
|
||||
name: "error",
|
||||
},
|
||||
],
|
||||
/** Enforces consistent usage of the `assert` module. */
|
||||
"unicorn/consistent-assert": "deny",
|
||||
/**
|
||||
* The `Date` constructor can clone a `Date` object directly when passed as an argument, making timestamp conversion
|
||||
* unnecessary. This rule enforces the use of the direct `Date` cloning instead of using `.getTime()` for conversion.
|
||||
*
|
||||
* Using `.getTime()` to convert a `Date` object to a timestamp and then back to a `Date` is redundant and
|
||||
* unnecessary. Simply passing the `Date` object to the `Date` constructor is cleaner and more efficient.
|
||||
*/
|
||||
"unicorn/consistent-date-clone": "deny",
|
||||
/**
|
||||
* When spreading a ternary in an array, we can use both `[]` and `''` as fallbacks, but it's better to have
|
||||
* consistent types in both branches.
|
||||
*/
|
||||
"unicorn/consistent-empty-array-spread": "deny",
|
||||
/**
|
||||
* Enforce consistent style for element existence checks with `indexOf()`, `lastIndexOf()`, `findIndex()`, and
|
||||
* `findLastIndex()`. This ensures that comparisons are performed in a standard and clear way.
|
||||
*
|
||||
* This rule is meant to enforce a specific style and improve code clarity. Using inconsistent comparison styles
|
||||
* (e.g., `index < 0`, `index >= 0`) can make the intention behind the code unclear, especially in large codebases.
|
||||
*/
|
||||
"unicorn/consistent-existence-index-check": "deny",
|
||||
/**
|
||||
* Enforces the only valid way of `Error` subclassing. It works with any super class that ends in `Error`.
|
||||
*
|
||||
* Incorrectly defined custom errors can lead to unexpected behavior when catching and identifying errors. Missing
|
||||
* `super()` calls, wrong `name` property values, or non-standard class names make error handling unreliable.
|
||||
*/
|
||||
"unicorn/custom-error-definition": "deny",
|
||||
/**
|
||||
* Removes the extra spaces or new line characters inside a pair of braces that does not contain additional code. This
|
||||
* ensures that braces are clean and do not contain unnecessary spaces or newlines.
|
||||
*
|
||||
* Extra spaces inside braces can negatively impact the readability of the code. Keeping braces clean and free of
|
||||
* unnecessary characters improves consistency and makes the code easier to understand and maintain.
|
||||
*/
|
||||
"unicorn/empty-brace-spaces": "deny",
|
||||
/**
|
||||
* Enforces providing a `message` when creating built-in `Error` objects to improve readability and debugging.
|
||||
*
|
||||
* Throwing an `Error` without a message, like throw new `Error()`, provides no context on what went wrong, making
|
||||
* debugging harder. A clear error message improves code clarity and helps developers quickly identify issues.
|
||||
*/
|
||||
"unicorn/error-message": "deny",
|
||||
/**
|
||||
* Enforces defining escape sequence values with uppercase characters rather than lowercase ones. This promotes
|
||||
* readability by making the escaped value more distinguishable from the identifier.
|
||||
*/
|
||||
"unicorn/escape-case": "deny",
|
||||
/** Enforce explicitly comparing the `length` or `size` property of a value. */
|
||||
"unicorn/explicit-length-check": [
|
||||
"error",
|
||||
"deny",
|
||||
{
|
||||
"non-zero": "not-equal",
|
||||
},
|
||||
],
|
||||
"unicorn/new-for-builtins": "error",
|
||||
"unicorn/no-abusive-eslint-disable": "error",
|
||||
"unicorn/no-accessor-recursion": "error",
|
||||
"unicorn/no-anonymous-default-export": "error",
|
||||
"unicorn/no-array-method-this-argument": "error",
|
||||
"unicorn/no-array-reverse": "error",
|
||||
"unicorn/no-array-sort": "error",
|
||||
"unicorn/no-await-in-promise-methods": "error",
|
||||
"unicorn/no-console-spaces": "error",
|
||||
"unicorn/no-document-cookie": "error",
|
||||
"unicorn/no-empty-file": "error",
|
||||
"unicorn/no-hex-escape": "error",
|
||||
"unicorn/no-instanceof-builtins": "error",
|
||||
"unicorn/no-invalid-fetch-options": "error",
|
||||
"unicorn/no-invalid-remove-event-listener": "error",
|
||||
"unicorn/no-lonely-if": "error",
|
||||
"unicorn/no-magic-array-flat-depth": "error",
|
||||
"unicorn/no-negated-condition": "error",
|
||||
"unicorn/no-negation-in-equality-check": "error",
|
||||
"unicorn/no-nested-ternary": "error",
|
||||
"unicorn/no-new-array": "error",
|
||||
"unicorn/no-new-buffer": "error",
|
||||
"unicorn/no-null": "error",
|
||||
"unicorn/no-object-as-default-parameter": "error",
|
||||
"unicorn/no-process-exit": "error",
|
||||
"unicorn/no-single-promise-in-promise-methods": "error",
|
||||
"unicorn/no-static-only-class": "error",
|
||||
"unicorn/no-thenable": "error",
|
||||
"unicorn/no-this-assignment": "error",
|
||||
"unicorn/no-typeof-undefined": "error",
|
||||
"unicorn/no-unnecessary-array-flat-depth": "error",
|
||||
"unicorn/no-unnecessary-array-splice-count": "error",
|
||||
"unicorn/no-unnecessary-await": "error",
|
||||
"unicorn/no-unnecessary-slice-end": "error",
|
||||
"unicorn/no-unreadable-array-destructuring": "error",
|
||||
"unicorn/no-unreadable-iife": "error",
|
||||
"unicorn/no-useless-collection-argument": "error",
|
||||
"unicorn/no-useless-error-capture-stack-trace": "error",
|
||||
"unicorn/no-useless-fallback-in-spread": "error",
|
||||
"unicorn/no-useless-length-check": "error",
|
||||
"unicorn/no-useless-promise-resolve-reject": "error",
|
||||
"unicorn/no-useless-spread": "error",
|
||||
"unicorn/no-useless-switch-case": "error",
|
||||
"unicorn/no-useless-undefined": "error",
|
||||
"unicorn/no-zero-fractions": "error",
|
||||
"unicorn/number-literal-case": "error",
|
||||
"unicorn/numeric-separators-style": "error",
|
||||
"unicorn/prefer-add-event-listener": "error",
|
||||
"unicorn/prefer-array-find": "error",
|
||||
"unicorn/prefer-array-flat": "error",
|
||||
"unicorn/prefer-array-flat-map": "error",
|
||||
"unicorn/prefer-array-index-of": "error",
|
||||
"unicorn/prefer-array-some": "error",
|
||||
"unicorn/prefer-at": "error",
|
||||
"unicorn/prefer-bigint-literals": "error",
|
||||
"unicorn/prefer-blob-reading-methods": "error",
|
||||
"unicorn/prefer-class-fields": "error",
|
||||
"unicorn/prefer-classlist-toggle": "error",
|
||||
"unicorn/prefer-code-point": "error",
|
||||
"unicorn/prefer-date-now": "error",
|
||||
"unicorn/prefer-default-parameters": "error",
|
||||
"unicorn/prefer-dom-node-append": "error",
|
||||
"unicorn/prefer-dom-node-remove": "error",
|
||||
"unicorn/prefer-dom-node-text-content": "error",
|
||||
"unicorn/prefer-event-target": "error",
|
||||
"unicorn/prefer-global-this": "error",
|
||||
"unicorn/prefer-includes": "error",
|
||||
"unicorn/prefer-keyboard-event-key": "error",
|
||||
"unicorn/prefer-logical-operator-over-ternary": "error",
|
||||
"unicorn/prefer-math-min-max": "error",
|
||||
"unicorn/prefer-math-trunc": "error",
|
||||
"unicorn/prefer-modern-dom-apis": "error",
|
||||
"unicorn/prefer-modern-math-apis": "error",
|
||||
"unicorn/prefer-module": "error",
|
||||
"unicorn/prefer-native-coercion-functions": "error",
|
||||
"unicorn/prefer-negative-index": "error",
|
||||
"unicorn/prefer-node-protocol": "error",
|
||||
"unicorn/prefer-number-properties": "error",
|
||||
"unicorn/prefer-object-from-entries": "error",
|
||||
"unicorn/prefer-optional-catch-binding": "error",
|
||||
"unicorn/prefer-prototype-methods": "error",
|
||||
"unicorn/prefer-reflect-apply": "error",
|
||||
"unicorn/prefer-regexp-test": "error",
|
||||
"unicorn/prefer-response-static-json": "error",
|
||||
"unicorn/prefer-set-has": "error",
|
||||
"unicorn/prefer-set-size": "error",
|
||||
"unicorn/prefer-string-raw": "error",
|
||||
"unicorn/prefer-string-replace-all": "error",
|
||||
"unicorn/prefer-string-slice": "error",
|
||||
"unicorn/prefer-string-starts-ends-with": "error",
|
||||
"unicorn/prefer-string-trim-start-end": "error",
|
||||
"unicorn/prefer-structured-clone": "error",
|
||||
/**
|
||||
* Enforces a consistent case style for filenames to improve project organization and maintainability. By default,
|
||||
* `kebab-case` is enforced, but other styles can be configured.
|
||||
*
|
||||
* Files named `index.js`, `index.ts`, etc. are exempt from this rule as they cannot reliably be renamed to other
|
||||
* casings (mainly just a problem with PascalCase).
|
||||
*
|
||||
* Inconsistent file naming conventions make it harder to locate files, navigate projects, and enforce consistency
|
||||
* across a codebase. Standardizing naming conventions improves readability, reduces cognitive overhead, and aligns
|
||||
* with best practices in large-scale development.
|
||||
*/
|
||||
"unicorn/filename-case": [
|
||||
"deny",
|
||||
{
|
||||
case: "kebabCase",
|
||||
ignore: "",
|
||||
multipleFileExtensions: true,
|
||||
},
|
||||
],
|
||||
/** Enforces the use of `new` for many builtins and disallow it for some other. */
|
||||
"unicorn/new-for-builtins": "deny",
|
||||
/** Disallows `oxlint-disable` or `eslint-disable` comments without specifying rules. */
|
||||
"unicorn/no-abusive-eslint-disable": "deny",
|
||||
"unicorn/no-accessor-recursion": "deny",
|
||||
/** Disallows anonymous functions and classes as default exports. */
|
||||
"unicorn/no-anonymous-default-export": "deny",
|
||||
/**
|
||||
* Prevents passing a function reference directly to iterator methods.
|
||||
*
|
||||
* Passing functions to iterator methods can cause issues when the function is changed without realizing that the iterator passes 2 more parameters to it (index and array). This can lead to unexpected behavior when the function signature changes.
|
||||
*
|
||||
* Cause des soucis avec les pipelines `Effect`.
|
||||
*/
|
||||
"unicorn/no-array-callback-reference": "allow",
|
||||
/**
|
||||
* Forbids the use of Array#forEach in favor of a for loop.
|
||||
*
|
||||
* Je préfère utiliser les méthodes `.forEach` dans les pipelines.
|
||||
*/
|
||||
"unicorn/no-array-for-each": "allow",
|
||||
/**
|
||||
* Disallows the use of the `thisArg` parameter in array iteration methods such as `map`, `filter`, `some`, `every`,
|
||||
* and similar.
|
||||
*
|
||||
* The `thisArg` parameter makes code harder to understand and reason about. Instead, prefer arrow functions or bind
|
||||
* explicitly in a clearer way. Arrow functions inherit `this` from the lexical scope, which is more intuitive and
|
||||
* less error-prone.
|
||||
*
|
||||
* Cause des soucis avec les pipelines `Effect`.
|
||||
*/
|
||||
"unicorn/no-array-method-this-argument": "allow",
|
||||
/**
|
||||
* Disallow `Array#reduce()` and `Array#reduceRight()`.
|
||||
*
|
||||
* `reduce()` est utile dans certains cas.
|
||||
*/
|
||||
"unicorn/no-array-reduce": "allow",
|
||||
"unicorn/no-array-reverse": "deny",
|
||||
"unicorn/no-array-sort": "deny",
|
||||
/**
|
||||
* Disallows member access from `await` expressions.
|
||||
*
|
||||
* When accessing a member from an `await` expression, the `await` expression has to be parenthesized, which is not
|
||||
* readable.
|
||||
*/
|
||||
"unicorn/no-await-expression-member": "deny",
|
||||
/** Disallow using await in Promise method parameters. */
|
||||
"unicorn/no-await-in-promise-methods": "deny",
|
||||
/**
|
||||
* Disallows leading/trailing space inside `console.log()` and similar methods.
|
||||
*
|
||||
* The `console.log()` method and similar methods join the parameters with a space so adding a leading/trailing space
|
||||
* to a parameter, results in two spaces being added.
|
||||
*/
|
||||
"unicorn/no-console-spaces": "deny",
|
||||
/** Disallows direct use of [`document.cookie`](https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie). */
|
||||
"unicorn/no-document-cookie": "deny",
|
||||
/** Disallows files that do not contain any meaningful code. */
|
||||
"unicorn/no-empty-file": "deny",
|
||||
/** Enforces a convention of using Unicode escapes instead of hexadecimal escapes for consistency and clarity. */
|
||||
"unicorn/no-hex-escape": "deny",
|
||||
/** Disallows mutating a variable immediately after initialization. */
|
||||
"unicorn/no-immediate-mutation": "deny",
|
||||
/** Require `Array.isArray()` instead of `instanceof Array`. */
|
||||
"unicorn/no-instanceof-array": "deny",
|
||||
"unicorn/no-instanceof-builtins": "deny",
|
||||
/**
|
||||
* Disallow invalid options in `fetch()` and new `Request().` Specifically, this rule ensures that a body is not
|
||||
* provided when the method is `GET` or `HEAD,` as it will result in a `TypeError.`
|
||||
*/
|
||||
"unicorn/no-invalid-fetch-options": "deny",
|
||||
/** It warns when you use a non-function value as the second argument of `removeEventListener`. */
|
||||
"unicorn/no-invalid-remove-event-listener": "deny",
|
||||
/** Disallow using `length` as the end argument of a `slice` call. */
|
||||
"unicorn/no-length-as-slice-end": "deny",
|
||||
/** Disallow `if` statements as the only statement in `if` blocks without `else`. */
|
||||
"unicorn/no-lonely-if": "deny",
|
||||
/**
|
||||
* Disallow magic numbers for
|
||||
* [`Array.prototype.flat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat)
|
||||
* depth.
|
||||
*
|
||||
* Magic numbers are hard to understand and maintain. When calling `Array.prototype.flat`, it is usually called with
|
||||
* `1`, or `Infinity`. If you are using a different number, it is better to add a comment explaining the reason for
|
||||
* the depth provided.
|
||||
*/
|
||||
"unicorn/no-magic-array-flat-depth": "deny",
|
||||
"unicorn/no-negated-condition": "deny",
|
||||
/** Disallow negated expressions on the left of (in)equality checks. */
|
||||
"unicorn/no-negation-in-equality-check": "deny",
|
||||
"unicorn/no-nested-ternary": "deny",
|
||||
/** Disallow new `Array()`. */
|
||||
"unicorn/no-new-array": "deny",
|
||||
/** Disallows the deprecated new `Buffer()` constructor. */
|
||||
"unicorn/no-new-buffer": "deny",
|
||||
"unicorn/no-null": "deny",
|
||||
/** Disallow the use of an object literal as a default value for a parameter. */
|
||||
"unicorn/no-object-as-default-parameter": "deny",
|
||||
/**
|
||||
* Disallow all usage of `process.exit()`.
|
||||
*
|
||||
* `process.exit()` should generally only be used in command-line utilities. In all other types of applications, the
|
||||
* code should throw an error instead.
|
||||
*/
|
||||
"unicorn/no-process-exit": "deny",
|
||||
/** Disallow passing single-element arrays to `Promise` methods. */
|
||||
"unicorn/no-single-promise-in-promise-methods": "deny",
|
||||
/** Disallow `class` declarations that exclusively contain `static` members. */
|
||||
"unicorn/no-static-only-class": "deny",
|
||||
/** Disallow defining a `then` property. */
|
||||
"unicorn/no-thenable": "deny",
|
||||
/** Disallow assigning `this` to a variable. */
|
||||
"unicorn/no-this-assignment": "deny",
|
||||
/** Disallow `typeof` comparisons with `undefined`. */
|
||||
"unicorn/no-typeof-undefined": "deny",
|
||||
/** Disallows passing `1` to `Array.prototype.flat`. */
|
||||
"unicorn/no-unnecessary-array-flat-depth": "deny",
|
||||
/**
|
||||
* Disallows passing `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#splice()` or
|
||||
* `Array#toSpliced()`.
|
||||
*/
|
||||
"unicorn/no-unnecessary-array-splice-count": "deny",
|
||||
/** Disallow awaiting on non-`Promise` values. */
|
||||
"unicorn/no-unnecessary-await": "deny",
|
||||
/** Disallows unnecessarily passing a second argument to `slice(...)`, for cases where it would not change the result. */
|
||||
"unicorn/no-unnecessary-slice-end": "deny",
|
||||
"unicorn/no-unreadable-array-destructuring": "deny",
|
||||
/** This rule disallows IIFEs with a parenthesized arrow function body. */
|
||||
"unicorn/no-unreadable-iife": "deny",
|
||||
"unicorn/no-useless-collection-argument": "deny",
|
||||
/**
|
||||
* Disallows unnecessary `Error.captureStackTrace(…)` in error constructors.
|
||||
*
|
||||
* Calling `Error.captureStackTrace(…)` inside the constructor of a built-in `Error` subclass is unnecessary, since
|
||||
* the `Error` constructor calls it automatically.
|
||||
*/
|
||||
"unicorn/no-useless-error-capture-stack-trace": "deny",
|
||||
/** Disallow useless fallback when spreading in object litterals. */
|
||||
"unicorn/no-useless-fallback-in-spread": "deny",
|
||||
/** It checks for an unnecessary array length check in a logical expression. */
|
||||
"unicorn/no-useless-length-check": "deny",
|
||||
/**
|
||||
* Disallows returning values wrapped in `Promise.resolve` or `Promise.reject` in an async function or a
|
||||
* `Promise#then/catch/finally` callback.
|
||||
*/
|
||||
"unicorn/no-useless-promise-resolve-reject": [
|
||||
"deny",
|
||||
{
|
||||
allowReject: false,
|
||||
},
|
||||
],
|
||||
/**
|
||||
* Disallows using spread syntax in following, unnecessary cases:
|
||||
*
|
||||
* - Spread an array literal as elements of an array literal
|
||||
* - Spread an array literal as arguments of a call or a new call
|
||||
* - Spread an object literal as properties of an object literal
|
||||
* - Use spread syntax to clone an array created inline
|
||||
*/
|
||||
"unicorn/no-useless-spread": "deny",
|
||||
/** Disallows useless `default` cases in `switch` statements. */
|
||||
"unicorn/no-useless-switch-case": "deny",
|
||||
/** Prevents usage of undefined in cases where it would be useless. */
|
||||
"unicorn/no-useless-undefined": "deny",
|
||||
"unicorn/no-zero-fractions": "deny",
|
||||
"unicorn/number-literal-case": "deny",
|
||||
"unicorn/numeric-separators-style": "deny",
|
||||
"unicorn/prefer-add-event-listener": "deny",
|
||||
/**
|
||||
* Encourages using `Array.prototype.find` instead of `filter(...)[0]` or similar patterns when only the first
|
||||
* matching element is needed.
|
||||
*/
|
||||
"unicorn/prefer-array-find": "deny",
|
||||
/** Prefers `Array#flat()` over legacy techniques to flatten arrays. */
|
||||
"unicorn/prefer-array-flat": "deny",
|
||||
/** Prefers the use of `.flatMap()` when `map().flat()` are used together. */
|
||||
"unicorn/prefer-array-flat-map": "deny",
|
||||
"unicorn/prefer-array-index-of": "deny",
|
||||
/**
|
||||
* Prefers using `Array#some()` over `Array#find()`, `Array#findLast()` with comparing to `undefined`, or
|
||||
* `Array#findIndex()`, `Array#findLastIndex()` and a non-zero length check on the result of `Array#filter()`.
|
||||
*/
|
||||
"unicorn/prefer-array-some": "deny",
|
||||
/**
|
||||
* Prefer the `Array#at()` and `String#at()` methods for index access.
|
||||
*
|
||||
* This rule also discourages using `String#charAt()`.
|
||||
*/
|
||||
"unicorn/prefer-at": [
|
||||
"deny",
|
||||
{
|
||||
/**
|
||||
* Check all index access, not just special patterns like `array.length - 1`. When enabled, `array[0]`,
|
||||
* `array[1]`, etc. will also be flagged.
|
||||
*/
|
||||
checkAllIndexAccess: true,
|
||||
/**
|
||||
* List of function names to treat as "get last element" functions. These functions will be checked for `.at(-1)`
|
||||
* usage.
|
||||
*/
|
||||
getLastElementFunctions: [],
|
||||
},
|
||||
],
|
||||
"unicorn/prefer-bigint-literals": "deny",
|
||||
/**
|
||||
* Recommends using `Blob#text()` and `Blob#arrayBuffer()` over `FileReader#readAsText()` and
|
||||
* `FileReader#readAsArrayBuffer()`.
|
||||
*/
|
||||
"unicorn/prefer-blob-reading-methods": "deny",
|
||||
"unicorn/prefer-class-fields": "deny",
|
||||
"unicorn/prefer-classlist-toggle": "deny",
|
||||
/**
|
||||
* Prefers usage of `String.prototype.codePointAt` over `String.prototype.charCodeAt.` Prefers usage of
|
||||
* `String.fromCodePoint` over `String.fromCharCode`.
|
||||
*/
|
||||
"unicorn/prefer-code-point": "deny",
|
||||
/** Prefers use of `Date.now()` over new `Date().getTime()` or new `Date().valueOf()`. */
|
||||
"unicorn/prefer-date-now": "deny",
|
||||
"unicorn/prefer-default-parameters": "deny",
|
||||
/**
|
||||
* Enforces the use of, for example, `document.body.append(div);` over `document.body.appendChild(div);` for DOM
|
||||
* nodes.
|
||||
*/
|
||||
"unicorn/prefer-dom-node-append": "deny",
|
||||
/**
|
||||
* Use `.dataset` on DOM elements over `getAttribute(…)`, `.setAttribute(…)`, `.removeAttribute(…)` and
|
||||
* ``.hasAttribute(…)`.
|
||||
*/
|
||||
"unicorn/prefer-dom-node-dataset": "allow",
|
||||
/** Prefers the use of `child.remove()` over `parentNode.removeChild(child)`. */
|
||||
"unicorn/prefer-dom-node-remove": "deny",
|
||||
"unicorn/prefer-dom-node-text-content": "deny",
|
||||
/**
|
||||
* Prefers `EventTarget` over `EventEmitter`.
|
||||
*
|
||||
* This rule reduces the bundle size and makes your code more cross-platform friendly.
|
||||
*/
|
||||
"unicorn/prefer-event-target": "deny",
|
||||
"unicorn/prefer-global-this": "deny",
|
||||
"unicorn/prefer-includes": "deny",
|
||||
"unicorn/prefer-keyboard-event-key": "deny",
|
||||
"unicorn/prefer-logical-operator-over-ternary": "deny",
|
||||
/** Prefers use of `Math.min()` and `Math.max()` instead of ternary expressions when performing simple comparisons. */
|
||||
"unicorn/prefer-math-min-max": "deny",
|
||||
/** Prefers use of `Math.trunc()` instead of bitwise operations for clarity and more reliable results. */
|
||||
"unicorn/prefer-math-trunc": "deny",
|
||||
"unicorn/prefer-modern-dom-apis": "deny",
|
||||
/**
|
||||
* Checks for usage of legacy patterns for mathematical operations.
|
||||
*
|
||||
* Modern JavaScript provides more concise and readable alternatives to legacy patterns.
|
||||
*
|
||||
* Currently, the following cases are checked:
|
||||
*
|
||||
* - Prefer `Math.log10(x)` over alternatives
|
||||
* - Prefer `Math.hypot(…)` over alternatives
|
||||
*/
|
||||
"unicorn/prefer-modern-math-apis": "deny",
|
||||
/**
|
||||
* Prefer JavaScript modules (ESM) over CommonJS.
|
||||
*
|
||||
* CommonJS globals and patterns (`require`, `module`, `exports`, `__filename`, `__dirname`) make code harder to
|
||||
* migrate and can block ESM-only features.
|
||||
*/
|
||||
"unicorn/prefer-module": "deny",
|
||||
/** Prefers built in functions, over custom ones with the same functionality. */
|
||||
"unicorn/prefer-native-coercion-functions": "deny",
|
||||
"unicorn/prefer-negative-index": "deny",
|
||||
/**
|
||||
* Prefer using the `node:protocol` when importing Node.js builtin modules.
|
||||
*
|
||||
* Node.js builtin modules should be imported using the `node:` protocol to avoid ambiguity with local modules.
|
||||
*/
|
||||
"unicorn/prefer-node-protocol": "deny",
|
||||
/**
|
||||
* Disallows use of parseInt(), parseFloat(), isNan(), isFinite(), Nan, Infinity and -Infinity as global variables.
|
||||
*
|
||||
* ECMAScript 2015 moved globals onto the Number constructor for consistency and to slightly improve them. This rule
|
||||
* enforces their usage to limit the usage of globals:
|
||||
*
|
||||
* - `Number.parseInt()` over `parseInt()`
|
||||
* - `Number.parseFloat()` over `parseFloat()`
|
||||
* - `Number.isNaN()` over `isNaN()` (they have slightly different behavior)
|
||||
* - `Number.isFinite()` over `isFinite()` (they have slightly different behavior)
|
||||
* - `Number.NaN` over `NaN`
|
||||
* - `Number.POSITIVE_INFINITY` over `Infinity`
|
||||
* - `Number.NEGATIVE_INFINITY` over `-Infinity`
|
||||
*/
|
||||
"unicorn/prefer-number-properties": [
|
||||
"deny",
|
||||
{
|
||||
/** If set to `true`, checks for usage of `Infinity` and `-Infinity` as global variables. */
|
||||
checkInfinity: true,
|
||||
/** If set to `true`, checks for usage of `NaN` as a global variable. */
|
||||
checkNaN: true,
|
||||
},
|
||||
],
|
||||
"unicorn/prefer-object-from-entries": "deny",
|
||||
"unicorn/prefer-optional-catch-binding": "deny",
|
||||
/**
|
||||
* “Borrowing” a method from an instance of `Array` or `Object` is less clear than getting it from the corresponding
|
||||
* prototype.
|
||||
*/
|
||||
"unicorn/prefer-prototype-methods": "deny",
|
||||
/**
|
||||
* Prefer `.querySelector()` over `.getElementById().` And prefer `.querySelectorAll()` over
|
||||
* `.getElementsByClassName()`, `.getElementsByTagName()`, and `.getElementsByName()`.
|
||||
*/
|
||||
"unicorn/prefer-query-selector": "deny",
|
||||
"unicorn/prefer-reflect-apply": "deny",
|
||||
/** Prefers `RegExp#test()` over `String#match()` and `String#exec()`. */
|
||||
"unicorn/prefer-regexp-test": "deny",
|
||||
"unicorn/prefer-response-static-json": "deny",
|
||||
/** Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence. */
|
||||
"unicorn/prefer-set-has": "deny",
|
||||
/** Prefer `Set#size` over `Set#length` when the `Set` is converted to an array. */
|
||||
"unicorn/prefer-set-size": "deny",
|
||||
"unicorn/prefer-string-raw": "deny",
|
||||
/** Prefers `String#replaceAll()` over `String#replace()` when using a regex with the global flag. */
|
||||
"unicorn/prefer-string-replace-all": "deny",
|
||||
/** Prefer `String#slice()` over `String#substr()` and `String#substring()`. */
|
||||
"unicorn/prefer-string-slice": "deny",
|
||||
/** Prefer `String#startsWith()` and `String#endsWith()` over using a regex with `/^foo/` or `/foo$/`. */
|
||||
"unicorn/prefer-string-starts-ends-with": "deny",
|
||||
"unicorn/prefer-string-trim-start-end": "deny",
|
||||
"unicorn/prefer-structured-clone": "deny",
|
||||
"unicorn/prefer-ternary": "off",
|
||||
"unicorn/prefer-top-level-await": "error",
|
||||
"unicorn/prefer-type-error": "error",
|
||||
"unicorn/relative-url-style": "error",
|
||||
"unicorn/require-array-join-separator": "error",
|
||||
"unicorn/require-module-attributes": "error",
|
||||
"unicorn/require-module-specifiers": "error",
|
||||
"unicorn/require-number-to-fixed-digits-argument": "error",
|
||||
"unicorn/text-encoding-identifier-case": "error",
|
||||
"unicorn/throw-new-error": "error",
|
||||
/** Prefer top-level await over top-level promises and async function calls. */
|
||||
"unicorn/prefer-top-level-await": "deny",
|
||||
/** Enforce throwing a `TypeError` instead of a generic `Error` after a type checking if-statement. */
|
||||
"unicorn/prefer-type-error": "deny",
|
||||
"unicorn/relative-url-style": "deny",
|
||||
"unicorn/require-array-join-separator": "deny",
|
||||
/**
|
||||
* This rule enforces non-empty attribute list in `import`/`export` statements and `import()` expressions.
|
||||
*
|
||||
* Import attributes are meant to provide metadata about how a module should be loaded (e.g., with `{ type: "json"
|
||||
* }`). An empty attribute object provides no information and should be removed.
|
||||
*/
|
||||
"unicorn/require-module-attributes": "deny",
|
||||
"unicorn/require-module-specifiers": "deny",
|
||||
/** Enforce using the digits argument with `Number#toFixed()`. */
|
||||
"unicorn/require-number-to-fixed-digits-argument": "deny",
|
||||
/**
|
||||
* Requires empty switch cases to omit braces, while non-empty cases must use braces. This reduces visual clutter for
|
||||
* empty cases and enforces proper scoping for non-empty ones.
|
||||
*
|
||||
* Using braces unnecessarily for empty cases adds visual noise, while omitting braces in non-empty cases can lead to
|
||||
* scoping issues.
|
||||
*/
|
||||
"unicorn/switch-case-braces": ["deny", "avoid"],
|
||||
/**
|
||||
* This rule enforces consistent casing for text encoding identifiers, specifically:
|
||||
*
|
||||
* - `'utf8'` instead of `'UTF-8'` or `'utf-8'` (or `'utf-8'` if `withDash` is enabled) ;
|
||||
* - `'ascii'` instead of `'ASCII'`.
|
||||
*
|
||||
* Inconsistent casing of encoding identifiers reduces code readability and can lead to subtle confusion across a
|
||||
* codebase. Although casing is not strictly enforced by ECMAScript or Node.js, using lowercase is the conventional
|
||||
* and widely recognized style.
|
||||
*/
|
||||
"unicorn/text-encoding-identifier-case": "deny",
|
||||
/**
|
||||
* This rule makes sure you always use new when throwing an error.
|
||||
*
|
||||
* In JavaScript, omitting `new` (e.g., `throw Error('message')`) is allowed, but it does not properly initialize the
|
||||
* error object. This can lead to missing stack traces or incorrect prototype chains. Using `new` makes the intent
|
||||
* clear, ensures consistent behavior, and helps avoid subtle bugs.
|
||||
*/
|
||||
"unicorn/throw-new-error": "deny",
|
||||
};
|
||||
|
||||
export default unicornRules;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue