Export the whole overrides array from project-lint and document the lint config
Check / check (pull_request) Successful in 1m28s

This commit is contained in:
Danny Kim
2026-10-19 16:49:57 +09:00
parent df66bea5e4
commit f2de92067f
9 changed files with 77 additions and 120 deletions
+16 -5
View File
@@ -10,7 +10,7 @@
import type { LanguageOptions, RuleDefinition, RuleVisitor, TextSourceCode } from "@eslint/core";
import { AST_NODE_TYPES, type TSESTree } from "@typescript-eslint/types";
import type { DummyRuleMap } from "vite-plus/lint";
import type { DummyRuleMap, OxlintOverride } from "vite-plus/lint";
/** The source code both hosts hand a rule, with the comment list. */
interface ProjectSourceCode extends TextSourceCode {
@@ -291,7 +291,7 @@ const rules: DummyRuleMap = {
"no-continue": "off",
};
/** Node code (`vite.config.ts` and `scripts/`), spread into `overrides`. */
/** Node code (`vite.config.ts` and `scripts/`): the first `projectOverrides` entry. */
const nodeRules: DummyRuleMap = {
// Vite and the Oxlint plugin host read a default export.
"import/no-default-export": "off",
@@ -303,10 +303,21 @@ const nodeRules: DummyRuleMap = {
"no-console": "off",
};
/**
* The whole `overrides` array of `vite.config.ts`: the Node code entry first,
* then each per-file exception, each with a comment saying why. Later entries
* win over earlier ones, and all of them over `rules`.
*/
export const projectOverrides: OxlintOverride[] = [
{
files: ["vite.config.ts", "scripts/**"],
rules: nodeRules,
},
];
/**
* The repo-local plugin, namespace `project`: its own rules, enabled as
* `project/<rule>`, `configs.project`, the rule list above, and
* `configs.node`, the Node code offs.
* `project/<rule>`, and `configs.project`, the rule list above.
*/
const plugin = {
meta: { name: "project" },
@@ -314,7 +325,7 @@ const plugin = {
"no-disable-comments": noDisableCommentsRule,
"no-asset-imports": noAssetImportsRule,
},
configs: { project: { rules }, node: { rules: nodeRules } },
configs: { project: { rules } },
};
export default plugin;