{"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,"search_vec":"'/ts':89 '18':24 '3.3.1':21 '9':27 'blocklist':39 'built':51 'built-in':50 'camel':57 'case':53,56,58,64 'check':4 'config':30 'consist':10 'convent':12,48,69 'current':17 'dedic':93 'definit':97 'enforc':9 'eslint':2,6,26,99,102 'eslint-plugin':101 'eslint-plugin-check-fil':1 'eslintplugin':100 'fex':44 'file':5,14,81,90,106 'filenam':38,46,63,107 'filename-blocklist':37 'filename-naming-convent':45 'five':32 'flat':29 'folder':16,41,67,104 'folder-match-with-fex':40 'folder-naming-convent':66 'generic':71 'glob':76,109 'glob-match':108 'index':36 'javascript':98 'js':60,88 'like':54 'lint':85 'match':42,110 'name':11,47,68,72 'next':59 'no-index':34 'node':23 'non':87 'non-j':86 'page':61 'pascal':55 'path':82,105 'pattern':77 'plugin':3,7,103 'processor':94 'provid':31 'requir':22 'router':62 'rule':33 'ship':95 'specif':80 'stabl':18 'support':49,84 'target':79 'tool':73 'typescript':96,111 'unlik':70 'use':75 'version':19 'via':91","created_at":"2026-04-25T11:19:13.772981+00:00","updated_at":"2026-04-25T11:19:13.772981+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/dukeluo/eslint-plugin-check-file","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-check-file","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}