{"id":19708,"library":"eslint-plugin-check-file","title":"eslint-plugin-check-file","description":"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.","status":"active","version":"3.3.1","language":"javascript","source_language":"en","source_url":"https://github.com/dukeluo/eslint-plugin-check-file","tags":["javascript","eslint","eslintplugin","eslint-plugin","folder","path","file","filename","glob-matching","typescript"],"install":[{"cmd":"npm install eslint-plugin-check-file","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-check-file","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-check-file","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: v3.x requires ESLint >=9.0.0 with flat config","package":"eslint","optional":false}],"imports":[{"note":"Plugin is ESM-only in v3. CommonJS require will fail.","wrong":"const checkFile = require('eslint-plugin-check-file')","symbol":"checkFile","correct":"import checkFile from 'eslint-plugin-check-file'"},{"note":"Access rules object if needed for custom configuration.","wrong":"import { rules } from 'eslint-plugin-check-file'","symbol":"rules","correct":"import { rules } from 'eslint-plugin-check-file'"},{"note":"v3 only supports flat config. Legacy .eslintrc style not supported.","wrong":"module.exports = {\n  plugins: ['check-file']\n}","symbol":"FlatConfig","correct":"import checkFile from 'eslint-plugin-check-file';\nexport default [\n  { plugins: { 'check-file': checkFile } }\n]"}],"quickstart":{"code":"// eslint.config.js\nimport checkFile from 'eslint-plugin-check-file';\n\nexport default [\n  {\n    files: ['src/**/*.{js,ts,jsx,tsx}'],\n    plugins: {\n      'check-file': checkFile,\n    },\n    rules: {\n      'check-file/filename-naming-convention': [\n        'error',\n        {\n          '**/*.{jsx,tsx}': 'PASCAL_CASE',\n          '**/*.{js,ts}': 'CAMEL_CASE',\n        },\n      ],\n      'check-file/folder-naming-convention': [\n        'error',\n        {\n          'src/components/*': 'PASCAL_CASE',\n        },\n      ],\n      'check-file/no-index': 'error',\n    },\n  },\n];\n\n// Run: npx eslint src/","lang":"javascript","description":"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."},"warnings":[{"fix":"Upgrade Node to >=18, ESLint to >=9, and use flat config syntax (eslint.config.js).","message":"v3 migrated to ESM-only and flat config; Node <18 and ESLint <9 not supported.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Convert .eslintrc.* to eslint.config.js using plugins array with object syntax.","message":"v3 requires ESLint flat config; legacy .eslintrc.* files are ignored.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use ESM imports (import) or dynamic import() in CJS contexts.","message":"v3 removes support for CommonJS; require() will throw.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Add 'processor: \"check-file/eslint-processor-check-file\"' to the file config block.","message":"The 'processor' field is required for non-JS/TS files like .yaml, .webp. Without it, those files are skipped.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Test patterns using ESLint's --debug flag or run with a single file to verify matching.","message":"Glob patterns in rules must match file paths relative to the project root; incorrect patterns cause rules to silently not apply.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install eslint-plugin-check-file --save-dev' and ensure the import uses ESM syntax or a bundler.","cause":"Missing dependency or wrong import path when using ESM in non-module context.","error":"Error: Cannot find module 'eslint-plugin-check-file'"},{"fix":"Upgrade ESLint to >=9 and switch to flat config (eslint.config.js).","cause":"Using v3 with ESLint <9 or legacy .eslintrc config.","error":"TypeError: eslint.PLUGIN_VERSION is not a function"},{"fix":"Rename eslint.config.js to eslint.config.mjs or add 'type': 'module' to package.json.","cause":"Attempting to use ESM import in a CommonJS file without .mjs extension or type:'module' in package.json.","error":"Parsing error: The keyword 'import' is reserved"},{"fix":"Add a 'files' pattern that includes the file's path (e.g., ['**/*.js']).","cause":"File does not match any 'files' pattern in eslint config.","error":"Error: No configuration found for file '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}