forked from JaapvanEkris/openrowingmonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
91 lines (90 loc) · 3.41 KB
/
eslint.config.js
File metadata and controls
91 lines (90 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import globals from "globals"
import pluginJs from "@eslint/js"
import js from "@eslint/js"
import stylistic from '@stylistic/eslint-plugin'
import { defineConfig } from "eslint/config"
import babelParser from "@babel/eslint-parser"
/** @type {import('eslint').Linter.Config[]} */
export default defineConfig([
stylistic.configs.recommended,
{
plugins: {
'@stylistic': stylistic,
js
},
extends: ["js/recommended"],
languageOptions: {
parser: babelParser,
globals: {
...globals.browser,
...globals.node
},
ecmaVersion: 13,
sourceType: "module"
},
rules: {
...js.configs.recommended.rules,
// Coding issues that have a high chance of leading to errors
'no-new': ['error'],
'no-var': ['error'],
'no-implicit-coercion': ['error', {'allow': ['!!']}],
'curly': ['error', 'all'],
'block-scoped-var': ['error'],
'default-case': ['error'],
'no-fallthrough': ['error', {'allowEmptyCase': true}],
'no-continue': ['error'],
'eqeqeq': ['error', 'always'],
'no-cond-assign': ['error', 'always'],
'no-unreachable': ['error'],
'no-unreachable-loop': ['error'],
'no-unmodified-loop-condition': ['error'],
'no-await-in-loop': ['warn'],
'no-useless-catch': ['error'],
'no-console': ['error'],
'arrow-body-style': ['warn', 'as-needed'],
'@stylistic/no-confusing-arrow': ['error', {'allowParens': false, 'onlyOneSimpleParam': false}],
'@stylistic/arrow-parens': ['warn', 'always'],
'@stylistic/quote-props': ['error', 'as-needed'],
// Bad code smells
'complexity': ['warn', {'max': 20, 'variant': 'modified'}],
'max-depth': ['warn', {'max': 3}],
'max-lines': ['warn', {'max': 300, 'skipBlankLines': true, 'skipComments': true}],
'max-statements': ['warn', { 'max': 30} , {'ignoreTopLevelFunctions': true }],
'max-statements-per-line': ['warn', { 'max': 2 }],
'@stylistic/max-statements-per-line': ['warn', { 'max': 2 }],
'max-params': ['warn', { 'max': 5 }],
'no-warning-comments' : ['warn'],
// More stylistic code issues
'@stylistic/semi': ['warn', 'never'],
'camelcase': ['warn', { 'properties': 'always', 'ignoreImports': true }],
'no-array-constructor': ['warn'],
'@stylistic/indent': ['warn', 2, { 'SwitchCase': 1 }],
'@stylistic/no-trailing-spaces': ['warn', {'skipBlankLines': false, 'ignoreComments': false}],
'@stylistic/no-multi-spaces': ['warn', {'ignoreEOLComments': false, 'ignoreEOLComments': false}],
'@stylistic/no-tabs': ['warn'],
'@stylistic/no-multiple-empty-lines': ['warn', {'max': 1, 'maxEOF': 0, 'maxBOF': 0}],
'@stylistic/quotes': ['warn','single'],
'@stylistic/space-before-function-paren': ['warn', {'anonymous': 'never', 'named': 'always'}],
'@stylistic/one-var-declaration-per-line': ['warn', 'always'],
'@stylistic/comma-dangle': ['warn', 'never'],
'@stylistic/brace-style': ['warn', '1tbs', { 'allowSingleLine': true }],
'@stylistic/operator-linebreak': ['warn', 'after']
},
},
{
// Automated tests, here more tests is always better
files: ['*/**/*.test.js'],
rules: {
'max-depth': ['off'],
'max-lines': ['off'],
'max-statements': ['off']
}
},
{
files: ['*/client/**/*.js'],
rules: {
'@stylistic/indent': ['off']
}
},
pluginJs.configs.recommended,
]);