Skip to main content
Version: 1.14

REGARDS ESLint rules

Presentation

The module @regardsoss/eslint-config-es6-rules (webapp/eslint-config-es6-rules/) provides REGARDS' ESLint configuration. It is referenced by root webapp/.eslintrc file, which is the root ESLint configuration file for REGARDS front-end project.

Usage

We export here under ESLint configurations for your usage.

rules packageimport modecomment
eslintrecommendedStandard Javascript rules provided by eslint
eslint-config-airbnballAdditional standard and ES6 Javascript rules
plugin:reactrecommendedSpecific rules for react library
plugin:react-perfrecommendedSpecific good practices rules for react library
plugin:lodashrecommendedSpecific rules for lodash library
plugin:promiserecommendedEnforce best practices for JavaScript promises

To use our configuration package add the code here under to your .eslintrc configuration file

{
"parser": "babel-eslint",
"extends": [
"@regardsoss/eslint-config-es6-rules"
]
}

You need to add the following dependencies to your package.json :

{
"eslint": "^5.9.0",
"eslint-config-airbnb": "~17.1.0",
"eslint-plugin-import": "~2.14.0",
"eslint-plugin-jsx-a11y": "~6.1.2",
"eslint-plugin-lodash": "^3.1.0",
"eslint-plugin-mocha": "^5.2.0",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "~7.11.1",
"eslint-plugin-react-perf": "^2.0.9"
}

Imported rules

In the next sections you can find for each rules package the custom configuration made for REGARDS project. By default, all rules are imported without modification from each package the references rules here are disabled or modified.

eslint rules

To see all javascript rules set by eslint : http://eslint.org/docs/rules/

Special configuration for eslint rules :

ruleConfigurationcomment
func-namesDisabledAllow anonymous functions
global-requireDisabled
max-lenDisabled
no-consoleDisabled
spaced-commentDisabled
no-unused-varsActivatedDo not check arguments. Ignore unused variable on functions arguments
no-confusing-arrowDisabled
no-warning-commentsActivatedRaise a warning if a TODO or FIXME is find in comments
semiActivatedDisallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)
no-mixed-operatorsActivated
prefer-destructuringActivated
function-paren-newlineDisabled

eslint-config-airbnb

To see all javascript rules set by eslint-config-airbnb : https://github.com/airbnb/javascript

Special configuration for eslint-config-airbnb rules :

ruleConfigurationcomment
import/no-extraneous-dependenciesDisabled
import/no-named-as-defaultDisabled
import/no-named-as-default-memberDisabled
import/prefer-default-exportDisabled
import/namedDisabled
import/no-commonjsActivatedPrevent the usage of CommonJS, ignore for node

plugin:react

To see all javascript rules set by plugin:react : https://github.com/yannickcr/eslint-plugin-react

Special configuration for plugin:react rules :

ruleConfigurationcomment
prefer-es6-classDisabled
require-extensionDisabled
require-default-propsDisabled
prefer-stateless-functionDisabled
react/display-nameDisabledOnly detect sipaly names of components during debug
jsx-uses-reactActivated
jsx-uses-varsActivated
react-in-jsx-scopeActivated
jsx-no-undefActivated
destructuring-assignmentDisabled
jsx-wrap-multilinesDisabled
no-access-state-in-setstateDisabled
jsx-closing-tag-locationDisabled

plugin:react-perf

To see all javascript rules set by plugin:react-perf : https://github.com/cvazac/eslint-plugin-react-perf

Special configuration for plugin:react-perf rules : None

plugin:lodash

To see all javascript rules set by plugin:lodash : https://github.com/wix/eslint-plugin-lodash

Special configuration for plugin:lodash rules :

ruleConfigurationcomment
import-scopeActivatedFor single method imports
prefer-noopDisabledDisable useless rule (_.noop instead of empty annonnymous function)
prefer-lodash-methodDisabledThis rule is not satisfying
prefer-constantDisabledWe do not use lodash constants factory
prop-shorthandDisabledNot so readable
matches-prop-shorthandDisabledWe prefer the explicit declaration
no-exclusive-testsActivated
max-top-level-suitesActivated
handle-done-callbackActivated
no-top-level-hooksActivated
no-return-and-callbackActivated
no-sibling-hooksActivated
no-global-testsActivated
no-hooks-for-single-caseDisabledAll React tests contains before and after whether having 1 or more tests
no-mocha-arrowsDisabled
mocha/no-nested-testsActivatedWe do not use mocha context so we can use lambdas
mocha/no-skipped-testsActivated
mocha/no-nested-testsActivated
mocha/no-identical-titleActivated
mocha/no-synchronous-testsDisabledWe wrote sync tests

plugin:promise

To see all javascript rules set by plugin:promise : https://github.com/xjamundx/eslint-plugin-promise

Special configuration for plugin:promise rules :

ruleConfigurationcomment
no-callback-in-promiseDisabledWe call done from Mocha inside async tests
no-nestingDisabledRule is not adequate without async / await
avoid-newDisabledThis is handy to create custom promises!
catch-or-returnDisabledWe do not always return a promise on react component since most of the time nobody consumes them
always-returnDisabled