1.1.6 • Published 3 years ago
@hellobetter/eslint-config v1.1.6
Usage
This package contains configuration for prettier, eslint and lint-staged.
Install
First, all the dependencies need to be added to the project.
npx install-peerdeps --dev @hellobetter/eslint-config
Setup
For simplicity every config could be re-exported from the shared package.
- Prettier
// .prettierrc.js
module.exports = require('@hellobetter/eslint-config/.prettierrc.js');
- Lint-staged
// .lintstagedrc.js
module.exports = require('@hellobetter/eslint-config/.lintstaged.js');
- Eslint
// .eslintrc.js
const config = require('@hellobetter/eslint-config');
module.exports = {
...config,
extends: ['@hellobetter'],
// project specific rules
rules: {
'no-undef': 'off',
'no-prototype-builtins': 'off',
},
};
Activate Lintstaged with Husky
Install Husky
npm i --save-dev husky
Bind lint-staged to pre-commit hook using Husky
"husky": {
"hooks": {
"pre-commit": "lint-staged",
}
}
Project structure
The project is structured similar to airbnb-eslint-config.
There is an index.js
which includes most of the parameters, except rules
and extends
.
Rules are localed in the ./rules
directory and separated into multiple files in the same way as Airbnb does.
There can be multiple configs exported apart from default:
- all
- base