-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcodely-js.js
101 lines (97 loc) · 2.92 KB
/
codely-js.js
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
92
93
94
95
96
97
98
99
100
101
import babelParser from "@babel/eslint-parser";
import js from "@eslint/js";
import eslintPluginImportX from "eslint-plugin-import-x";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort";
import eslintPluginUnusedImports from "eslint-plugin-unused-imports";
import globals from "globals";
export default [
js.configs.recommended,
eslintPluginPrettierRecommended,
{
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parser: babelParser,
parserOptions: {
requireConfigFile: false,
},
globals: {
...globals.browser,
...globals.node,
},
},
plugins: {
"simple-import-sort": eslintPluginSimpleImportSort,
import: eslintPluginImportX,
"unused-imports": eslintPluginUnusedImports,
},
rules: {
// error prevention
"array-callback-return": ["error", { checkForEach: true }],
"no-await-in-loop": "error",
"no-constant-binary-expression": "error",
"no-constructor-return": "error",
"no-promise-executor-return": "error",
"no-self-compare": "error",
"no-template-curly-in-string": "error",
"no-unmodified-loop-condition": "error",
"no-unreachable-loop": "error",
"no-unused-private-class-members": "error",
"no-use-before-define": [
"error",
{
functions: false,
classes: true,
variables: true,
allowNamedExports: false,
},
],
"require-atomic-updates": "error",
// good practises
camelcase: ["error", { properties: "never" }],
eqeqeq: "error",
"new-cap": ["error", { capIsNew: false }],
"no-array-constructor": "error",
"no-console": ["error", { allow: ["error"] }],
"no-else-return": ["error", { allowElseIf: false }],
"no-extend-native": "error",
"no-lonely-if": "error",
"no-param-reassign": "error",
"no-return-assign": "error",
"no-throw-literal": "error",
"no-var": "error",
"object-shorthand": "error",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
radix: "error",
yoda: "error",
// style
curly: "error",
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
"padding-line-between-statements": ["error", { blankLine: "always", prev: "*", next: "return" }],
// plugins
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/no-unresolved": "error",
"import/no-webpack-loader-syntax": "error",
"prettier/prettier": ["error", { printWidth: 100, useTabs: true }],
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error",
"unused-imports/no-unused-imports": "error",
"no-unused-vars": "off",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
},
},
];