create-eslint-index
raw JSON → 1.0.0 verified Sat Apr 25 auth: no javascript
Simplify the creation of an index file for your ESLint plugin. Version 1.0.0 is stable, with no recent updates. It helps generate recommended configurations and rule descriptions from rule metadata. Key differentiators: automates index generation for ESLint plugins, extracts metadata like recommended severity and descriptions. Requires Node >=4.0.0 and typically used with req-all library to load rules.
Common errors
error TypeError: Cannot read property 'recommended' of undefined ↓
cause The path in settings.path is incorrect, or the rule object does not have meta.docs.recommended.
fix
Double-check the path string and that your rule exports follow the correct format (meta.docs.recommended).
error createIndex.createConfig is not a function ↓
cause Incorrect import: using destructuring or wrong module path.
fix
Use const createIndex = require('create-eslint-index') then call createIndex.createConfig().
Warnings
gotcha settings.path must exactly match the dot-notation path to the recommended severity field (e.g., 'meta.docs.recommended'). A typo will silently produce an empty config. ↓
fix Ensure the path is correct and that the rule objects have the field at that path.
gotcha The rules object keys must be the rule names (without plugin prefix). createConfig prepends the plugin name automatically. ↓
fix Use rule names as keys, e.g., 'rule-1' not 'myplugin/rule-1'.
gotcha The function createConfig does not throw if a rule lacks the specified recommended field; it simply omits that rule from output. ↓
fix Ensure all rules have the required metadata or validate before calling createConfig.
Install
npm install create-eslint-index yarn add create-eslint-index pnpm add create-eslint-index Imports
- createIndex
const createIndex = require('create-eslint-index') - createConfig wrong
createIndex.createConfig(settings) (missing rules argument)correctcreateIndex.createConfig(settings, rules) - createRulesDescription
createIndex.createRulesDescription(settings, rules)
Quickstart
const createIndex = require('create-eslint-index');
const reqAll = require('req-all');
const rules = reqAll('rules', {camelize: false});
const recommendedRules = createIndex.createConfig({ plugin: 'myplugin', path: 'meta.docs.recommended' }, rules);
module.exports = { rules, configs: { recommended: { rules: recommendedRules } } };