This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.eslintrc.js
64 lines (56 loc) · 3.02 KB
/
.eslintrc.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
module.exports = {
"env": {
"es6": true,
"browser": true,
"commonjs": true
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2017
},
"extends": [
"eslint:recommended"
],
"rules": {
// basics
"indent": [ "error", 2, { // indentation should be 2 spaces
"flatTernaryExpressions": true, // ternary should be performed in flat
"MemberExpression": 0 // member chain should be performed in flat
} ], // it forces 2 spaces indentation
"linebreak-style": [ "error", "unix" ], // fuck you, CRLF
"quotes": [ "error", "single" ], // quotes must be single
"eqeqeq": [ "error", "always" ], // fuck you, `==`
// variables
"no-unused-vars": [ "off" ], // unused vars are okay
"no-undef": [ "warn" ], // draws yellow line below undefined vars
// omittables
"semi": [ "error", "always" ], // semicolon is required
"curly": [ "error" ], // it kills `if (foo) bar++;`
"arrow-parens": [ "error", "always" ], // it kills `arg => { func(); }`
// force spacing (I prefer super sparse code!)
"array-bracket-spacing": [ "error", "always" ], // it kills `[val1, val2]`
"arrow-spacing": [ "error", { "before": true, "after": true } ], // it kills `( arg )=>{ func(); }`
"block-spacing": [ "error", "always" ], // it kills `if ( cond ) {func();}`
"comma-spacing": [ "error", { "before": false, "after": true } ], // it kills `func( arg1,arg2 )`
"computed-property-spacing": [ "error", "always" ], // it kills `arr[i]`
"key-spacing": [ "error", { "beforeColon": false, "afterColon": true } ], // it kills `{ key:val }`
"keyword-spacing": [ "error", { "before": true, "after": true } ], // it kills `}else{`
"object-curly-spacing": [ "error", "always" ], // it kills `{key: val}`
"semi-spacing": [ "error", { "before": false, "after": true } ], // it kills `func1();func2();`
"space-before-blocks": [ "error", "always" ], // it kills `if (cond){`
"space-in-parens": [ "error", "always" ], // it kills `func (arg)`
"space-infix-ops": [ "error" ], // it kills val1+val2
"space-unary-ops": [ "error", { "words": true, "nonwords": false, "overrides": { "++": true, "--": true } } ], // it kills `val++`
"spaced-comment": [ "error", "always" ], // it kills `//this is comment`
// ban spacing
"func-call-spacing": [ "error", "never" ], // no-trailing-spaces. yea.
"no-trailing-spaces": [ "error", { "ignoreComments": true } ], // no-trailing-spaces. yea.
"no-whitespace-before-property": [ "error" ], // it kills `obj .key`
"space-before-function-paren": [ "error", { "anonymous": "never", "named": "never", "asyncArrow": "always" } ], // it kills `func()`
// others
"no-eval": [ "warn" ], // wow, are you really going to use `eval()`? are you mad lol
"no-implied-eval": [ "warn" ], // ok don't
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', // here is nodejs, console.log is innocent
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' // debuggerとか使う?
}
};