NTARelix's ESLint Config
A set of opinionated ESLint (https://eslint.org) rules
Usage
Base Setup (or just JavaScript)
npm install --save-dev @ntarelix/eslint-config
- Create a file named
.eslintrc.js
in your project+ module.exports = { + root: true, + extends: [ + '@ntarelix/eslint-config/base', + ], + rules: { + // your rule overrides + }, + }
TypeScript Setup
Equivalent to adding TypeScript linting: https://github.com/typescript-eslint/typescript-eslint/blob/dac8845c6821d51cea5bafdc0be2e9a399cea68c/docs/getting-started/linting/README.md
- Follow "Base Setup"
npm install --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser
- Modify
.eslintrc.js
module.exports = { root: true, + parser: '@typescript-eslint/parser', + plugins: [ + '@typescript-eslint', + ], extends: [ '@ntarelix/eslint-config/base', + '@ntarelix/eslint-config/typescript', ], rules: { // your rule overrides }, }
TypeScript Setup with Type Information
Equivalent to adding TypeScript's type-aware linting: https://github.com/typescript-eslint/typescript-eslint/blob/dac8845c6821d51cea5bafdc0be2e9a399cea68c/docs/getting-started/linting/TYPED_LINTING.md
- Follow "TypeScript Setup"
- Modify
.eslintrc.js
module.exports = { root: true, parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: __dirname, + project: ['./tsconfig.json'], + }, plugins: [ '@typescript-eslint', ], extends: [ '@ntarelix/eslint-config/base', '@ntarelix/eslint-config/typescript', ], rules: { // your rule overrides }, }
React Setup
- Follow "TypeScript Setup"
npm install --save-dev eslint-plugin-react eslint-plugin-react-hooks
- Modify
.eslintrc.js
module.exports = { root: true, parser: '@typescript-eslint/parser', plugins: [ '@typescript-eslint', + 'react', + 'react-hooks', ], extends: [ '@ntarelix/eslint-config/base', '@ntarelix/eslint-config/typescript', + '@ntarelix/eslint-config/react', ], rules: { // your rule overrides }, }