-
Notifications
You must be signed in to change notification settings - Fork 2
/
javascript.js
113 lines (108 loc) · 3.23 KB
/
javascript.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
107
108
109
110
111
112
113
const confusingBrowserGlobals = require('confusing-browser-globals');
const {ERROR, OFF} = require('./config');
module.exports = {
parserOptions: {
ecmaVersion: 'latest'
},
plugins: ['import', 'prettier', 'unicorn'],
settings: {
'import/resolver': 'node'
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings'
],
rules: {
'array-callback-return': ERROR,
'arrow-body-style': [ERROR, 'as-needed'],
curly: [ERROR, 'multi-line'],
'dot-notation': ERROR,
eqeqeq: [ERROR, 'always', {null: 'ignore'}],
'func-names': [ERROR, 'as-needed'],
// See discussion in https://github.com/molindo/eslint-config-molindo/issues/27
'func-style': [ERROR, 'declaration', {allowArrowFunctions: false}],
'import/newline-after-import': ERROR,
'import/no-unresolved': [ERROR, {commonjs: true}],
'import/no-named-as-default': OFF,
'import/no-extraneous-dependencies': ERROR,
'import/order': [
ERROR,
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index'
],
'newlines-between': 'never',
alphabetize: {order: 'asc'}
}
],
'no-console': [ERROR, {allow: ['warn', 'error']}],
'no-restricted-globals': [ERROR].concat(confusingBrowserGlobals),
'no-restricted-syntax': [
ERROR,
{
selector: 'ForInStatement',
message:
'for … in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries} and iterate over the resulting array. Iteration based on arrays usually shows the intent of the loop clearer and works better with chaining. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#Iteration_methods'
}
],
'no-shadow': ERROR,
'no-throw-literal': ERROR,
'no-unneeded-ternary': ERROR,
'no-unused-expressions': ERROR,
'no-use-before-define': [ERROR, {functions: false}],
'no-useless-rename': ERROR,
'no-var': ERROR,
'object-shorthand': ERROR,
'prefer-arrow-callback': ERROR,
'prefer-const': ERROR,
'prettier/prettier': [
ERROR,
{singleQuote: true, bracketSpacing: false, trailingComma: 'none'}
],
'spaced-comment': [
ERROR,
'always',
// Allow TypeScript reference imports with tripple slashes
// https://github.com/molindo/eslint-config-molindo/issues/69
{
line: {
markers: ['/'],
exceptions: ['/']
}
}
],
'unicorn/explicit-length-check': ERROR,
'unicorn/import-index': ERROR,
'unicorn/no-abusive-eslint-disable': ERROR,
'valid-jsdoc': [
ERROR,
{
prefer: {
returns: 'return'
},
preferType: {
array: 'Array',
boolean: 'Boolean',
function: 'Function',
number: 'Number',
string: 'String',
object: 'Object',
any: '*',
Any: '*',
Undefined: 'undefined',
Null: 'null'
},
requireReturn: false,
requireReturnType: false,
requireParamDescription: false,
requireReturnDescription: false
}
]
}
};