Skip to content

Shareable `eslint` config enforcing our lint and style guidelines

License

Notifications You must be signed in to change notification settings

malcolmhire/eslint-config-base

 
 

Repository files navigation

@dwp/eslint-config-base

Build Status Known Vulnerabilities

Shareable eslint config enforcing our lint and style convention.

Getting started

npm install --save-dev @dwp/eslint-config-base eslint

Rules

Add an .eslintrc.js file that looks something like:

module.exports = require('@dwp/eslint-config-base');

You can add your own rules to enhance this, but in doing so please ensure you don't weaken the baseline ruleset.

Don't use .eslintrc (low precedence) or package.json (even lower, and just plain bad!), lest you incur the wrath of a patient adversary.

Linting

Add eslint to your test suite like this, or see our package.json for an example of how we do it:

"test": "eslint ."

Recommendations

Unary operators

It is recommended that developers use the ++/-- operators as pre (++variable) rather than post (variable++), unless explicitly required in the statement.

Dangling commas

This config enforces dangling commas in multiline function arguments, which is supported from node version 8 onwards. If you're using an older version of node, you'll need to ignore this rule for functions according to the documentation here: https://eslint.org/docs/rules/comma-dangle.

About

Shareable `eslint` config enforcing our lint and style guidelines

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%