eslint-plugin-factorial
raw JSON → 2.0.30 verified Sat Apr 25 auth: no javascript
eslint-plugin-factorial is a collection of custom ESLint rules for JavaScript and TypeScript projects. Version 2.0.30 is the latest stable release. It enforces code quality and consistency, particularly in Factorial projects. Differentiators include opinionated rules tailored to specific coding standards. Installation requires ESLint as a peer dependency. The plugin follows standard ESLint plugin conventions for configuration.
Common errors
error Error: Failed to load plugin 'factorial' declared in '.eslintrc': Cannot find module 'eslint-plugin-factorial' ↓
cause eslint-plugin-factorial is not installed or missing from node_modules.
fix
Run 'npm install eslint-plugin-factorial --save-dev'.
error Error: Failed to load config 'factorial/recommended' to extend from. ↓
cause Incorrect extends format; using 'factorial/recommended' without 'plugin:' prefix.
fix
Use extends: ['plugin:factorial/recommended'].
error Definition for rule 'factorial/rule-name' was not found. ↓
cause The rule name is misspelled or does not exist in the plugin.
fix
Check available rules in documentation or node_modules/eslint-plugin-factorial/lib/rules/.
Warnings
gotcha All rule names must be prefixed with 'factorial/' ↓
fix In .eslintrc rules, use 'factorial/rule-name'.
gotcha Plugin configs are only accessible via 'plugin:factorial/...' shorthand ↓
fix Use extends: ['plugin:factorial/recommended'] (or other config name) instead of the full package name.
deprecated Possible use of 'eslint-plugin-factorial' as a prefix is unsupported ↓
fix Do not include 'eslint-plugin-' prefix in plugin or extends config.
gotcha Rule options documentation may be outdated; check source for each rule ↓
fix Refer to the actual rule implementation in node_modules/eslint-plugin-factorial/lib/rules/.
Install
npm install eslint-plugin-factorial yarn add eslint-plugin-factorial pnpm add eslint-plugin-factorial Imports
- plugin wrong
const factorial = require('eslint-plugin-factorial'); module.exports = { plugins: ['factorial'] }; // unnecessary requirecorrectmodule.exports = { plugins: ['factorial'] }; - rules wrong
"rule-name": "error"correct"factorial/rule-name": "error" - configs wrong
module.exports = { extends: ['eslint-plugin-factorial/recommended'] };correctmodule.exports = { extends: ['plugin:factorial/recommended'] };
Quickstart
// Install dependencies
// npm install eslint eslint-plugin-factorial --save-dev
// .eslintrc.js
module.exports = {
plugins: ['factorial'],
rules: {
'factorial/rule-name': 'error',
},
};