Enable each lint plugin through its all config and share the Node code override
Check / check (pull_request) Successful in 42s
Check / check (pull_request) Successful in 42s
This commit is contained in:
+22
-14
@@ -166,11 +166,6 @@ const noAssetImportsRule: ProjectRule = {
|
||||
* rules it turns off, and options that differ from a rule's defaults.
|
||||
*/
|
||||
const rules: DummyRuleMap = {
|
||||
// Its own rules.
|
||||
"project/no-disable-comments": "error",
|
||||
"project/no-asset-imports": "error",
|
||||
|
||||
// Options.
|
||||
// The explicit-types template's `camelcase` stand-in: no `_` inside a name
|
||||
// once leading and trailing ones are trimmed, unless it has no lowercase
|
||||
// ASCII letter (UPPER_SNAKE).
|
||||
@@ -191,6 +186,7 @@ const rules: DummyRuleMap = {
|
||||
],
|
||||
// Single capital type parameters, which explicit-types requires, may be one letter.
|
||||
"id-length": ["error", { exceptionPatterns: ["^[A-Z]$"] }],
|
||||
// Option tweaks.
|
||||
"one-var": ["error", "never"],
|
||||
"no-use-before-define": ["error", { functions: false }],
|
||||
"func-style": ["error", "declaration", { allowArrowFunctions: true }],
|
||||
@@ -204,8 +200,10 @@ const rules: DummyRuleMap = {
|
||||
"max-statements": ["error", 32],
|
||||
"import/max-dependencies": ["error", { max: 13 }],
|
||||
"unicorn/max-nested-calls": ["error", { max: 4 }],
|
||||
|
||||
// Collides with another rule, a plugin config, or Oxfmt.
|
||||
// No lint suppression and only `.ts` imports, as in the plugin template.
|
||||
"project/no-disable-comments": "error",
|
||||
"project/no-asset-imports": "error",
|
||||
// Off, collides with a repo or plugin rule, Oxfmt, or another category rule:
|
||||
// Collides with `#private`: members are public unless marked so.
|
||||
"typescript/explicit-member-accessibility": "off",
|
||||
// Collides with `typescript/prefer-readonly-parameter-types` being off.
|
||||
@@ -253,23 +251,20 @@ const rules: DummyRuleMap = {
|
||||
"unicorn/no-array-reduce": "off",
|
||||
// Collides with literal Gitea Actions `${{ }}` expressions in workflow strings.
|
||||
"no-template-curly-in-string": "off",
|
||||
|
||||
// Node code: this action runs on Node.
|
||||
// Node code, everywhere: this action runs on Node.
|
||||
// Node built-ins are the action's runtime.
|
||||
"import/no-nodejs-modules": "off",
|
||||
// Command-line entry points set their exit status.
|
||||
"unicorn/no-process-exit": "off",
|
||||
// The action reports to the job log through the console.
|
||||
"no-console": "off",
|
||||
|
||||
// PENDING USER: union members are values in profiles.json, the Gitea API,
|
||||
// and posted comments; renaming them changes behavior.
|
||||
"explicit-types/upper-snake-string-unions": "off",
|
||||
// PENDING USER: a fitting `name` needs a constructor and changes logged
|
||||
// error names.
|
||||
"unicorn/custom-error-definition": "off",
|
||||
|
||||
// Too much churn.
|
||||
// Off, too much churn:
|
||||
// Literal numbers read better than a constant per use.
|
||||
"no-magic-numbers": "off",
|
||||
// Keys follow meaning, not the alphabet.
|
||||
@@ -296,9 +291,22 @@ const rules: DummyRuleMap = {
|
||||
"no-continue": "off",
|
||||
};
|
||||
|
||||
/** Node code (`vite.config.ts` and `scripts/`), spread into `overrides`. */
|
||||
const nodeRules: DummyRuleMap = {
|
||||
// Vite and the Oxlint plugin host read a default export.
|
||||
"import/no-default-export": "off",
|
||||
// Node code: tooling imports Node's built-ins.
|
||||
"import/no-nodejs-modules": "off",
|
||||
// Node code: a CLI exits with a status.
|
||||
"unicorn/no-process-exit": "off",
|
||||
// Node code: a CLI reports through the console.
|
||||
"no-console": "off",
|
||||
};
|
||||
|
||||
/**
|
||||
* The repo-local plugin, namespace `project`: its own rules, enabled as
|
||||
* `project/<rule>`, and `configs.project`, the rule list above.
|
||||
* `project/<rule>`, `configs.project`, the rule list above, and
|
||||
* `configs.node`, the Node code offs.
|
||||
*/
|
||||
const plugin = {
|
||||
meta: { name: "project" },
|
||||
@@ -306,7 +314,7 @@ const plugin = {
|
||||
"no-disable-comments": noDisableCommentsRule,
|
||||
"no-asset-imports": noAssetImportsRule,
|
||||
},
|
||||
configs: { project: { rules } },
|
||||
configs: { project: { rules }, node: { rules: nodeRules } },
|
||||
};
|
||||
|
||||
export default plugin;
|
||||
|
||||
Reference in New Issue
Block a user