root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
yarn add eslint -D
yarn eslint --init
- To check syntax, find problems and enforce code style
- Javascript modules (import/export)
- React
- Typescript? Yes
- Browser
- Use a popular style guide
- Airbnb
- JSON
- Would you like to install them now with npm? No
yarn add -D eslint-plugin-react@^7.20.0 @typescript-eslint/eslint-plugin@latest eslint-config-airbnb@latest eslint-plugin-import@^2.21.2 eslint-plugin-jsx-a11y@^6.3.0 eslint-plugin-react-hooks@^4 @typescript-eslint/parser@latest
**/*.js
node_modules
build
/src/react-app-env.d.ts
/src/reportWebVitals.ts
- Adicione em
extends
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
- Adicione em
plugins
"react-hooks"
- Adicione em
rules
"no-use-before-define": "off",
"no-unused-expressions": "off",
"react/jsx-props-no-spreading": "off",
"react/prop-types": "off",
"no-console": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }],
"import/prefer-default-export": "off",
"camelcase": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unused-vars": "off",
// "@typescript-eslint/explicit-functtion-return-type": [
// "error",
// {
// "allowExpressios": true
// }
// ],
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never",
"tsx": "never"
}
],
"prettier/prettier": "error"
// "max-len": ["error", { "code": 80 }]
// "semi": ["error", "always"]
- Adicione depois de
rules
"settings": {
"import/resolver": {
"typescript": {}
}
}
yarn add eslint-import-resolver-typescript -D
yarn add prettier eslint-config-prettier eslint-plugin-prettier -D
- Adicione em
extends
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
- Adicione em
plugins
"prettier"
- Adicione em
rules
"prettier/prettier": "error"
module.exports = {
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
}