ESLint plugin for enforcing consistent naming conventions for files and folders. Current stable version is 3.3.1, requiring Node >=18 and ESLint >=9 with flat config. Provides five rules: no-index, filename-blocklist, folder-match-with-fex, filename-naming-convention (supports built-in cases like PASCAL_CASE, CAMEL_CASE, NEXT_JS_PAGE_ROUTER_FILENAME_CASE), and folder-naming-convention. Unlike generic naming tools, it uses glob patterns to target specific file paths and supports linting non-JS/TS files via a dedicated processor. Ships TypeScript definitions.
npm install eslint-plugin-check-fileVerified import paths — ran on the pinned version, not inferred.
Shows the minimal flat config setup with two rules to enforce PascalCase for JSX/TSX files and CamelCase for JS/TS files, plus a folder naming rule.
Upgrade Node to >=18, ESLint to >=9, and use flat config syntax (eslint.config.js).
Convert .eslintrc.* to eslint.config.js using plugins array with object syntax.
Use ESM imports (import) or dynamic import() in CJS contexts.
Add 'processor: "check-file/eslint-processor-check-file"' to the file config block.
Test patterns using ESLint's --debug flag or run with a single file to verify matching.
Run 'npm install eslint-plugin-check-file --save-dev' and ensure the import uses ESM syntax or a bundler.
Upgrade ESLint to >=9 and switch to flat config (eslint.config.js).
Rename eslint.config.js to eslint.config.mjs or add 'type': 'module' to package.json.
Add a 'files' pattern that includes the file's path (e.g., ['**/*.js']).