-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
executable file
·106 lines (87 loc) · 3.43 KB
/
index.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
102
103
104
105
106
module.exports = {
root: true,
env: {
node: true,
},
extends: [
// This doesn't have to get defined in package.json because it
// is imported automatically by cli-plugin-eslint in Vue CLI 3.0
'plugin:vue/essential',
// Required in package.json as an external dependency
'@vue/airbnb',
],
rules: {
// disable max line length
'max-len': 'off',
// allow console.logs, base airbnb warns
'no-console': 'off',
// allow padded blocks
'padded-blocks': 'off',
// dissallow semi colons
semi: ['error', 'never'],
// allow variables that begin with _
'no-underscore-dangle': 'off',
// auto-add semi colons in front of lines that could cause problems (e.g.
// open parens)
'semi-style': ['error', 'first'],
// this is actually redundant, already in base airbnb... will leave in case
// they change it
'no-mixed-spaces-and-tabs': 'error',
// always requires parens around arrow function params
'arrow-parens': ['error', 'always'],
// always requires arrow function bodies {}
'arrow-body-style': ['error', 'always'],
// this could be removed I suppose. it allows you to write shorter while()
// loops and such, which never really happens much anyway
'no-cond-assign': ['error', 'except-parens'],
// this is actually redundant, already in base airbnb... will leave in case
// they change it
'comma-dangle': ['error', 'always-multiline'],
// allows unused vars in arguments, (e.g.
// `new Promise((resolve, reject) => {} )` but you never use the reject)
//
// this is useful because it lets you know that an argument is available and
// what it is even if you're not using it right now
'no-unused-vars': ['error', { args: 'none' }],
// they actually changed the base airbnb to be this exact rule, but they
// haven't published it to npm yet?
'function-paren-newline': ['error', 'consistent'],
// this require you to write multiline comments with // like these comments
'multiline-comment-style': ['error', 'separate-lines'],
// allow i++ in for loops, base airbnb has this error for every use of ++
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
// do not force array destructuring so you don't have to do
// const [yeah] = response.result
//
// instead of
//
// const yeah = response.result[0]
//
// this also becomes a pain in the ass when you want the value at index 1
// instead of 0
'prefer-destructuring': ['error', { array: false, object: true }],
// I think this basically allows you to write a single-line object with more
// than 4 keys. airbnb default is this, but forces you to line break if
// there are more than 4 keys
'object-curly-newline': ['error', { ObjectExpression: { multiline: true, consistent: true } }],
// don't require .vue extension when importing
'import/extensions': ['error', 'always', {
js: 'never',
vue: 'never',
}],
// disallow reassignment of function parameters
// disallow parameter object manipulation except for specific exclusions
'no-param-reassign': ['error', {
props: true,
ignorePropertyModificationsFor: [
'currentState', // for vuex state
'state', // for vuex state
'acc', // for reduce accumulators
'e', // for e.returnvalue
],
}],
},
parserOptions: {
parser: 'babel-eslint',
},
}