2026-04-03

- eslint OK
- import OK
- jsdoc OK
- node OK
- oxc OK
- promise OK
This commit is contained in:
gcch 2026-04-03 23:57:57 +02:00
commit fab3d73813
13 changed files with 691 additions and 209 deletions

101
rules/import.ts Normal file
View 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;

View file

@ -7,20 +7,48 @@ 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",
"jsdoc/require-param-type": "warn",
"jsdoc/require-property": "warn",
"jsdoc/require-property-description": "warn",
"jsdoc/require-property-name": "warn",
"jsdoc/require-returns": "warn",
"jsdoc/require-property-type": "warn",
"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": "warn",
"jsdoc/require-yields": [
"warn",
{
forceRequireYields: false,
withGeneratorTag: false,
},
],
};
export default jsDocRules;

12
rules/node.ts Normal file
View 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;

35
rules/oxc.ts Normal file
View 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;

53
rules/promise.ts Normal file
View file

@ -0,0 +1,53 @@
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$",
},
],
"promise/prefer-await-to-callbacks": "deny",
"promise/prefer-await-to-then": ["deny", { strict: true }],
"promise/prefer-catch": "deny",
"promise/spec-only": ["deny", { allowedMethods: [] }],
"promise/valid-params": "deny",
};
export default promiseRules;