style: add eslint configuration and fixed linter issues (#35)
* style: add eslint configuration as per bee-js * chore: add `plugin:react/reocommended` in `.eslintrc` Co-authored-by: nugaon <50576770+nugaon@users.noreply.github.com> * chore: add `consistent` to `array-bracket-newline` as per review * style: after automatic fixes with `npm run lint` * style: fixed all linter errors * refactor: fixed all linter warnings * chore: added missing new line at end of `.prettierrc` file Co-authored-by: nugaon <50576770+nugaon@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"extends": [
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier",
|
||||
"plugin:prettier/recommended",
|
||||
"plugin:react/recommended"
|
||||
],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"jest": true,
|
||||
"node": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
"plugins": ["jest"],
|
||||
"rules": {
|
||||
"array-bracket-newline": ["error", "consistent"],
|
||||
"strict": ["error", "safe"],
|
||||
"block-scoped-var": "error",
|
||||
"complexity": "warn",
|
||||
"default-case": "error",
|
||||
"dot-notation": "warn",
|
||||
"eqeqeq": "error",
|
||||
"guard-for-in": "warn",
|
||||
"linebreak-style": ["warn", "unix"],
|
||||
"no-alert": "error",
|
||||
"no-case-declarations": "error",
|
||||
"no-console": "error",
|
||||
"no-constant-condition": "error",
|
||||
"no-continue": "warn",
|
||||
"no-div-regex": "error",
|
||||
"no-empty": "warn",
|
||||
"no-empty-pattern": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
"prefer-arrow-callback": "warn",
|
||||
"no-labels": "error",
|
||||
"no-loop-func": "error",
|
||||
"no-nested-ternary": "warn",
|
||||
"no-script-url": "error",
|
||||
"quote-props": ["error", "as-needed"],
|
||||
"require-yield": "error",
|
||||
"max-nested-callbacks": ["error", 4],
|
||||
"max-depth": ["error", 4],
|
||||
"require-await": "error",
|
||||
"space-before-function-paren": [
|
||||
"error",
|
||||
{
|
||||
"anonymous": "never",
|
||||
"named": "never",
|
||||
"asyncArrow": "always"
|
||||
}
|
||||
],
|
||||
"padding-line-between-statements": [
|
||||
"error",
|
||||
{ "blankLine": "always", "prev": "*", "next": "if" },
|
||||
{ "blankLine": "always", "prev": "*", "next": "function" },
|
||||
{ "blankLine": "always", "prev": "*", "next": "return" }
|
||||
],
|
||||
"no-useless-constructor": "off",
|
||||
"no-dupe-class-members": "off",
|
||||
"no-unused-expressions": "off",
|
||||
"curly": ["error", "multi-line"],
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"@typescript-eslint/no-useless-constructor": "error",
|
||||
"@typescript-eslint/no-unused-expressions": "error",
|
||||
"@typescript-eslint/member-delimiter-style": [
|
||||
"error",
|
||||
{
|
||||
"multiline": {
|
||||
"delimiter": "none",
|
||||
"requireLast": true
|
||||
},
|
||||
"singleline": {
|
||||
"delimiter": "semi",
|
||||
"requireLast": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"react/react-in-jsx-scope": "off" // React v17+ does not need React in scope for JSX elements
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.spec.ts", "*.spec.tsx", "*.test.ts", "*.test.tsx"],
|
||||
"rules": {
|
||||
"max-nested-callbacks": ["error", 10] // allow describe/it/test nesting
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user