ESLint Config React
ESLint shared configuration package for Digital Thinkers.
Use it in other projects like this (.eslintrc.js
):
module.exports = {
extends: '@digitalthinkers/eslint-config-react'
}
Use these rules if the project is based on Next.js:
module.exports = {
extends: '@digitalthinkers/eslint-config-react',
rules: {
'react/react-in-jsx-scope': 'off',
'jsx-a11y/anchor-is-valid': 'off'
}
}
VSCode prerequisites
ESLint extension must be enabled.
Insert the following snippet into settings.json
. (This is required by ESLint, so it can run it's formatting rules)
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.fixAll.eslint": true
}
The following editor options are proven to work with the current setup. If you have problems with the linter, try setting these:
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.detectIndentation": false,
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],