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