Skip to content

r2d2bzh/eslint-config

Repository files navigation

ESLINT-CONFIG

The r2d2bzh product stack is composed of multiple NodeJS micro-services. They need to be written with the same eslint rules thus the need to share these rules in order to avoid developers to maintain them in each project.

Current set of rules

The current set of rules provided by this shared configuration follows:

link:./index.js[role=include]

Install

You need to add the following NPM development dependency to the project that needs to be checked:

npm install --save-dev eslint @r2d2bzh/eslint-config#<VERSION>

Note
Replace <VERSION> with a git tag of the eslint-config repository.

This will add the package eslint-config in your repo.

In order to instruct eslint to apply these rules, you need to create an eslint.config.js file close to the package.json file:

eslintrc.js
import { defineConfig } from 'eslint/config';
import r2d2bzhEslintConfig from '@r2d2bzh/eslint-config';

export default defineConfig([
  {
    extends: [r2d2bzhEslintConfig],
  },
]);
Warning
This package has peer dependencies that you need to install manually. This is to follow eslint recommendations.

Ensuring linting

To ensure that the eslint rules are followed, the current recommendation is to add husky and lint-staged to the project:

npm install --save-dev husky lint-staged

package.json
{
  "eslint-staged": {
    "*.js": ["eslint"]
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  }
}

About

r2d2bzh eslint rules

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •