1.0.0 • Published 9 years ago
eslint-plugin-xo v1.0.0
eslint-plugin-xo

ESLint rules for XO
This plugin is bundled with XO, but can still be useful if you don't use XO.
Install
$ npm install --save-dev eslint eslint-plugin-xoUsage
Configure it in package.json.
{
"name": "my-awesome-project",
"eslintConfig": {
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
},
"plugins": [
"xo"
],
"rules": {
"xo/catch-error-name": ["error", {"name": "err"}],
"xo/explicit-length-check": "error",
"xo/filename-case": ["error", {"case": "kebabCase"}],
"xo/no-abusive-eslint-disable": "error",
"xo/no-process-exit": "error",
"xo/throw-new-error": "error"
}
}
}Rules
- catch-error-name - Enforce a specific parameter name in catch clauses.
- explicit-length-check - Enforce explicitly comparing the
lengthproperty of a value. - filename-case - Enforce a case style for filenames.
- no-abusive-eslint-disable - Enforce specifying rules to disable in
eslint-disablecomments. - no-process-exit - Disallow
process.exit(). - throw-new-error - Require
newwhen throwing an error. (fixable)
Recommended config
This plugin exports a recommended config that enforces good practices.
Enable it in your package.json with the extends option:
{
"name": "my-awesome-project",
"eslintConfig": {
"plugins": [
"xo"
],
"extends": "plugin:xo/recommended"
}
}See the ESLint docs for more information about extending config files.
Note: This config will also enable the correct parser options and environment.
Created by
License
MIT © Sindre Sorhus