ESLint configuration
This package includes 4 ESLint shareable configs:
- Base: Configures general rules and the ones that come in the import and prettier eslint plugins
- TypeScript: Configures typescript parser and typescript eslint plugin (This config requires in addition of extending from it to configure parserOptions.project in the eslint configuration file).
- React: Configures react related rules (react and react-hooks eslint plugins)
- Next: Configures next.js related rules (next eslint config)
Using npm
$ npm install --save-dev lzinik/eslint-config
Using yarn
$ yarn add --dev lzinik/eslint-config
- Create a project eslint configuration file (
.eslintrc.js) - Depending on the use case, extend from the corresponding config(s)
- Pure JS project: extend from Base
module.exports = {
extends: ["lzinik/eslint-config/base"]
};- Pure TS project: extend from TypeScript and configure
parserOptions.projectvalue
module.exports = {
"parserOptions": {
"project": "./tsconfig.json"
},
extends: ["lzinik/eslint-config/typescript"]
};module.exports = {
extends: ["lzinik/eslint-config/base", "lzinik/eslint-config/react"]
};- React TS project: extend from Typescript, React and configure
parserOptions.projectvalue and
module.exports = {
"parserOptions": {
"project": "./tsconfig.json"
},
extends: ["lzinik/eslint-config/typescript", "lzinik/eslint-config/react"]
};module.exports = {
extends: ["lzinik/eslint-config/base", "lzinik/eslint-config/next"]
};- Next TS project: extend from TypeScript, Next and configure
parserOptions.projectvalue
module.exports = {
"parserOptions": {
"project": "./tsconfig.json"
},
extends: ["lzinik/eslint-config/typescript", "lzinik/eslint-config/next"]
};