add eslint

This commit is contained in:
Romulus21
2023-09-15 00:06:52 +02:00
parent 076c87b016
commit 1e39c1b79f
10 changed files with 1333 additions and 28 deletions

48
.eslintrc.json Normal file
View File

@@ -0,0 +1,48 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"react-hooks",
"tailwindcss"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react/react-in-jsx-scope": "off",
"react/button-has-type": "error",
"react/prop-types": "error",
"react/require-default-props": "off",
"react/no-array-index-key": "error",
"react/jsx-uses-react": "error",
"react/display-name": "error",
"react/no-danger-with-children": "error",
// "react-hooks/exhaustive-deps": "warn",
// "react/jsx-no-bind": "error",
"react/jsx-uses-vars": "error",
"no-restricted-syntax": ["warn", {
"selector": "CallExpression[callee.object.name='console'][callee.property.name!=/^(warn|info)$/]",
"message": "Unexpected property on console object was called"
}],
"semi": [2, "never"],
"tailwindcss/classnames-order": "warn",
"tailwindcss/enforces-negative-arbitrary-values": "warn",
"tailwindcss/enforces-shorthand": "warn",
"tailwindcss/migration-from-tailwind-2": "warn",
"tailwindcss/no-arbitrary-value": "off",
"tailwindcss/no-contradicting-classname": "error"
}
}
// https://dev.to/logrocket/12-essential-eslint-rules-for-react-5doc