eslint-config-ns

4.0.0 • Public • Published

eslint-config-ns

npm version GitHub license

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

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.0.0
    506
    • latest

Version History

Package Sidebar

Install

npm i eslint-config-ns

Weekly Downloads

514

Version

4.0.0

License

MIT

Unpacked Size

11.6 kB

Total Files

13

Last publish

Collaborators

  • natterstefan