eslint-override-paths-exist
eslint-override-paths-exist
- Package
- lint-meta-rules v1.1.0
- Runs under
@noctcore/harnesslint-meta, not ESLint- Factory
createEslintOverridePathsExistRule- Entry point
@noctcore/lint-meta-rules- Category
config- Fails CI by default
- Yes
Every path written in an ESLint flat config files or ignores entry exists, so a moved folder cannot leave an override that applies to nothing.
An override is a set of patterns, and ESLint says nothing about a pattern that matches nothing. Move
src/legacy/ to src/compat/, and the block that turned a rule off for the old folder, or switched
on a stricter one for it, stops applying without a word: the new folder is linted with the wrong
rules, and the stale block stays in the config looking deliberate.
What it flags
Section titled “What it flags”In every eslint.config.{js,mjs,cjs,ts,mts,cts} (at any depth, resolved against that config’s own
directory):
- A literal
filesentry that does not exist. - A
filesglob whose literal directory does not exist (legacyinlegacy/**/*.ts). - A literal
ignoresorglobalIgnores([...])entry that names one file (a directory and an extension, such assrc/routeTree.gen.ts) that does not exist.
// apps/web/eslint.config.js, with src/legacy moved away: reported twiceexport default [ { files: ['src/legacy/**/*.ts'], rules: { 'no-console': 'off' } }, { files: ['src/routeTree.gen.ts'], rules: { 'max-lines': 'off' } },];What it does not flag
Section titled “What it does not flag”- A glob with no literal directory (
**/*.test.ts): it matches zero or more files by design. - Directory and glob
ignores(dist,coverage/,**/*.gen.ts): they usually name build output that a clean checkout does not have yet. - A negated entry (
!src/keep.ts): it only narrows what another entry matched. - Paths in comments, in imports, under any other key, and computed template strings.
Options
Section titled “Options”createEslintOverridePathsExistRule(options?: EslintOverridePathsExistOptions): IMetaRule| Option | Type | Default | Meaning |
|---|---|---|---|
configGlobs |
string[] |
['**/eslint.config.{js,mjs,cjs,ts,mts,cts}'] |
Flat config files to read. node_modules, dist and similar are always skipped. |
checkGlobPrefixes |
boolean |
true |
Also require the literal directory a files glob starts in to exist. |
checkIgnores |
boolean |
true |
Also check one-file ignores entries. |
ciCritical |
boolean |
true |
Whether a violation fails CI. |
The config is read as text, not run: an entry built in code (a variable, a .map()) is not seen,
and an object with its own basePath is still resolved against the config’s directory.
When not to use it
Section titled “When not to use it”If your overrides are all generated (a shared preset with no paths of your own), there is nothing for it to check.