A shareable ESLint configuration that enforces a consistent JavaScript/React coding style across all your projects.
- Installation
- Usage
- Adding to Your Project
- Using the
helpshift
config witheslint:recommended
- Editor Integration
- Contributing
- License
First, install the package along with its peer dependencies:
npm install --save-dev eslint-config-helpshift
Or if you're using yarn:
yarn add --dev eslint-config-helpshift
Create or modify your .eslintrc.js
file:
module.exports = {
extends: "eslint-config-helpshift",
// Your project-specific rules/overrides can go here
};
Or if you're using JSON:
{
"extends": "eslint-config-helpshift"
}
We recommend adding the following scripts to your package.json
:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix"
}
}
There are several rules in the eslint:recommended
ruleset that Helpshift style is not opinionated about that you might want to enforce in your project.
To use Helpshift style in conjunction with ESLint's recommended rule set, extend them both, making sure to list eslint-config-helpshift
last:
{
"extends": ["eslint:recommended", "eslint-config-helpshift"],
"rules": {
// Additional, per-project rules...
}
}
To see how the helpshift
config compares with eslint:recommended
, refer to the source code of index.js, which lists every ESLint rule along with whether (and how) it is enforced by the helpshift
config.
For the best experience, we recommend integrating ESLint with your editor:
VS Code
- Install the ESLint extension
- Add the following to your VS Code settings:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript", "javascriptreact"]
}
If you'd like to contribute to this ESLint config, please see our Contributing Guidelines.
MIT © Helpshift