eslint-config-ns

eslint config ready to be used in multiple projects

Usage no npm install needed!

<script type="module">
  import eslintConfigNs from 'https://cdn.skypack.dev/eslint-config-ns';
</script>

README

eslint-config-ns

npm version GitHub license

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 the one for stylelint).

eslint-config-ns lints your javascript projects with ease, based on the popular javascript code style from Airbnb.

The config is built upon Airbnb's ESLint rules with additional rules and optimizations (see assumptions).

Features

Installation

Install the package with

npm install eslint-config-ns --save-dev

# or
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

# or
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:

// prettier.config.js
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

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


Stefan Natter