@kachkaev/eslint-config-react
v0.6.0
Published
Compatible with [ESLint](https://www.npmjs.com/package/eslint) v8. Requires [TypeScript](https://www.npmjs.com/package/typescript) and [React](https://www.npmjs.com/package/react) to be present as a dependency.
Downloads
284
Readme
@kachkaev → eslint config (react)
Compatible with ESLint v8. Requires TypeScript and React to be present as a dependency.
See also @kachkaev/eslint-config-base.
Adding to project
Install the package:
npm install -D @kachkaev/eslint-config-react ## or yarn add -D @kachkaev/eslint-config-react
If you use Next.js:
npm install -D @kachkaev/eslint-config-react @next/eslint-plugin-next ## or yarn add -D @kachkaev/eslint-config-react @next/eslint-plugin-next
Create
.eslintrc.js
with the following contents:module.exports = { extends: ["@kachkaev/eslint-config-react"], };
If you use Next.js:
module.exports = { extends: [ "@kachkaev/eslint-config-react", "plugin:@next/next/recommended", ], };
If you want extra typechecking (
tsconfig.json
needs to exist in repo dir):module.exports = { extends: [ "@kachkaev/eslint-config-react", "@kachkaev/eslint-config-react/extra-type-checking", ], };
Create
.eslintignore
. For example,##################### ## Specific to ESLint ##################### ## Ignore all files (but still allow sub-folder scanning) * !*/ ## Allow certain file types !*.cjs !*.cts !*.js !*.json !*.jsx !*.mjs !*.mts !*.ts !*.tsx ######################## ## Same as in .gitignore ######################## # (paste lines from .gitignore here)
Optionally, configure package scripts and a pre-commit hook to make sure that all project files are always formatted. See example in
njt
→package.json
.