0.3.1 • Published 3 years ago
@envisagesoftware/eslint-config v0.3.1
Envisage ESLint Shareable Config
Basic setup
- Install the following dev dependencies (
npm i -D <package>
):
eslint
@typescript-eslint/eslint-plugin
@typescript-eslint/parser
eslint-plugin-jest
eslint-plugin-only-warn
@envisagesoftware/eslint-config
Create an
.eslintrc.json
file in the root of the project (not/src
).Add the following:
{
"extends": [
"@envisagesoftware/eslint-config",
"plugin:jest/recommended",
"plugin:jest/style",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"rules": {
"import/no-unresolved": "off",
"import/order": [
"warn",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
],
"newlines-between": "always-and-inside-groups"
}
]
}
}
3a. If you're using webpack, add the following setting:
"settings": {
"import/resolver": "webpack",
...
}
3b. If you are using @/
paths, add the following setting:
"settings": {
"import/internal-regex": "^@/.*",
...
}
Setup in React projects
- Add the following extensions to your
.eslintrc.json
:
"extends": [
"plugin:react/recommended",
"plugin:react-hooks/recommended",
]
- Add the following setting:
"settings": {
"react": {
"version": "detect"
},
...
}