eslint-config-ns

eslint-config-ns
lints your JavaScript projects with ease, and is mainly based
on the popular
JavaScript code style from Airbnb
with further customizations derived on my own experience.
Contents
Related Configs
Background Story
In August 2018, I published an article with the title
"How to create your own shared esLint, prettier and stylelint configuration"
on Medium. One of the results of the article, is this
shareable eslint-config (and one for stylelint).
Features
The config is built upon Airbnb's ESLint rules with additional rules and
optimizations (see assumptions).
Installation
Install the package with
npm install eslint-config-ns --save-dev
yarn add eslint-config-ns -D
eslint-config-ns
requires you to take care of it's peerDependencies
. Install
the correct version of each peerDependencies
package, which are listed with
the following command:
npm info "eslint-config-ns@latest" peerDependencies
If using npm 5+, use this shortcut:
npx install-peerdeps --dev eslint-config-ns
yarn add eslint-config-ns -D --peer
Usage
Now add eslint-config-ns
to either your package.json
:
{
"eslintConfig": {
"extends": "eslint-config-ns"
}
}
to your .eslintrc
:
{
"extends": "eslint-config-ns"
}
or .eslintrc.js
:
module.exports = {
extends: 'eslint-config-ns',
}
Prettier Config
This is how you can use or extend the eslint-config-ns
prettier config in your
app:
module.exports = require('eslint-config-ns/prettier.config')
Assumptions
eslint-config-ns
comes with some fundamental assumptions:
- React and/or Node.js environment
- Browser and/or Node.js environment
- Jest as the selected test-suite
- it uses the
@babel/eslint-parser
parser
Even though I made some assumptions,
you can easily overwrite, extend and unset rules and any other setting in your custom eslint config.
LICENSE
MIT
Maintainers