ESLint Plugin Filenames Simple
raw JSON → 0.9.0 verified Sat Apr 25 auth: no javascript
An ESLint plugin for enforcing filename conventions with straightforward configuration. Current stable version 0.9.0 (last updated 2024). Supports ESLint 7.x and 8.x, Node.js >=14.17.0. Provides six rules: extension, named-export, naming-convention, no-index, pluralize, and typescript-module-declaration. Offers pre-configured recommended presets for plain JavaScript/TypeScript, React, and Vue projects. Inspired by eslint-plugin-filenames but with a simpler configuration model and additional rules like named-export and typescript-module-declaration. Does not support ESLint 9.x or flat config yet.
Common errors
error ESLint couldn't find the plugin "eslint-plugin-filenames-simple". ↓
cause Plugin not installed or ESLint config not recognizing it.
fix
Run 'npm install -D eslint-plugin-filenames-simple' and ensure .eslintrc uses 'plugins: ["filenames-simple"]'.
error Configuration for rule "filenames-simple/naming-convention" is invalid: Value ["error",{}] is invalid. Option 'rule' is required. ↓
cause Missing 'rule' option in the rule configuration.
fix
Add a 'rule' property: ["error", { "rule": "kebab-case" }].
Warnings
gotcha Plugin does not support ESLint 9.x or flat config yet. Using with ESLint 9.x will fail. ↓
fix Use ESLint 7.x or 8.x until the plugin is updated.
gotcha The 'naming-convention' rule requires a 'rule' option (e.g., 'kebab-case', 'camelCase'). Omitting it defaults to 'camelCase' which may not be intended. ↓
fix Always explicitly set the 'rule' option to avoid unexpected defaults.
gotcha The 'no-index' rule forbids 'index.js' or 'index.ts' files by default. This may conflict with module resolution patterns in Node.js. ↓
fix If you need index files, set the rule to 'off' or configure exceptions.
gotcha The 'named-export' rule requires that a file have exactly one named export matching a convention. Multiple named exports will cause an error. ↓
fix Ensure each file exports only one named symbol, or disable the rule.
Install
npm install eslint-plugin-filenames-simple yarn add eslint-plugin-filenames-simple pnpm add eslint-plugin-filenames-simple Imports
- plugin wrong
const plugin = require('eslint-plugin-filenames-simple')correct// In .eslintrc: { "plugins": ["filenames-simple"] } - recommended config wrong
{ "extends": ["eslint-plugin-filenames-simple/recommended"] }correct// In .eslintrc: { "extends": ["plugin:filenames-simple/recommended"] } - rules wrong
{ "rules": { "naming-convention": "error" } }correct// In .eslintrc: { "rules": { "filenames-simple/naming-convention": "error" } }
Quickstart
// .eslintrc.json
{
"extends": ["plugin:filenames-simple/recommended"],
"rules": {
"filenames-simple/naming-convention": ["error", { "rule": "kebab-case" }],
"filenames-simple/extension": ["error", { "extensions": [".js", ".ts"] }]
}
}
// Install: npm i -D eslint eslint-plugin-filenames-simple
// Run: npx eslint --ext .js,.ts .