eslint-config-nodejs-recommended
v2.1.2
Published
ESLint config for nodejs with babel
Downloads
17
Maintainers
Readme
Recommended ESLint config for node.js (with babel)
This package contains an extensible shared config for nodejs apps written using babel.
It contains plugins:
- eslint-plugin-lodash - ESLint rules for lodash (
underscore
is forbidden) - eslint-plugin-import - ESLint plugin with rules that help validate proper imports (
require
is forbidden)
It extends eslint-config-airbnb-base with a few changes (only the most important):
Added rules:
- no-restricted-syntax - loops (
for
,while
) are not allowed (uselodash
orbluebird
for promises) - complexity - max complexity is
20
- no-magic-numbers - disallow magic numbers, all numbers must be defined as constants (except:
-1
,0
,1
) - callback-return - require return statements after callbacks
- handle-callback-err - require error handling in callbacks
- no-process-exit - disallow the use of
process.exit()
(some people use it for debugging) - no-sync - disallow synchronous methods
- require-jsdoc - require JSDoc comments
- valid-jsdoc - enforce valid JSDoc comments (description for params and return is not required, types are required)
- max-len - max line length is
120
, ignored for string and comments - max-lines - max lines per file is
500
- max-nested-callbacks - max callback depth is
5
- max-params - max parameters in functions is
5
- max-statements - max statements in functions is
50
Removed rules:
- no-param-reassign - reassigning function parameters is enabled, it's useful in private methods
- no-plusplus -
++
and--
are allowed
Installation
npm install --save-dev eslint eslint-config-nodejs-recommended eslint-plugin-lodash eslint-plugin-import eslint-plugin-babel babel-eslint
Usage
Configure .eslintrc
{
"extends": "nodejs-recommended"
}
MIT License
Copyright (c) 2016 Łukasz Sentkiewicz