Skip to content

ESLint config ready to be used in multiple projects. Based on Airbnb's code style with prettier, jest and react support.

License

Notifications You must be signed in to change notification settings

pedroapfilho/eslint-config-ns

 
 

Repository files navigation

eslint-config-ns

npm version GitHub license Commitizen friendly

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).

It lints your javascript projects with ease, based on the popular javascript code style from Airbnb.

Features

Installation

The default export contains all default Airbnb ESLint rules, including ECMAScript 6+, and the ones listed below. It requires some peerDependencies as well.

Install the package with

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

# or
yarn add eslint-config-ns -D

Then install the correct versions of each peerDependency package, which are listed by the 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 the config 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 use or extend the eslint-config-ns prettier config in your app:

// prettier.config.js
module.exports = require('eslint-config-ns/prettier.config')

Assumptions

This ESLint configuration comes with some fundamental assumptions:

  • react and/or node environment
  • jest as the selected test-suite
  • browser and/or node environment
  • parser: babel (used 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.

How to release

This repository uses GitHub Actions (debug locally) to create a release and update the CHANGELOG. The implementation is inspired and based on github.com/babel/actions.

yarn lerna:version

Once the release was created, all you need to do is to publish the packages manually to npm.

LICENSE

MIT

Maintainers


Stefan Natter

About

ESLint config ready to be used in multiple projects. Based on Airbnb's code style with prettier, jest and react support.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%