forked from elementor/elementor
/
.eslintrc.js
137 lines (137 loc) · 3.9 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
module.exports = {
extends: [
'wordpress',
'plugin:wordpress/esnext',
//'plugin:react/recommended',
],
plugins: [
'wordpress',
//'react',
],
globals: {
wp: true,
window: true,
document: true,
'_': false,
'jQuery': false,
'JSON': false,
elementorFrontend: true,
require: true,
elementor: true,
DialogsManager: true,
module: true,
},
'parserOptions': {
'sourceType': 'module',
},
rules: {
// custom canceled rules
'no-var': 'off',
'vars-on-top': 'off',
'wrap-iife': 'off',
'computed-property-spacing': [ 'error', 'always' ],
'comma-dangle': [ 'error', 'always-multiline' ],
'no-undef': 'off',
'no-unused-vars': 'error',
'dot-notation': 'error',
'no-shadow': 'error',
'no-lonely-if': 'error',
'no-mixed-operators': 'error',
'no-nested-ternary': 'error',
'no-cond-assign': 'error',
'space-in-parens': [ 'error', 'always', { 'exceptions': [ 'empty' ] } ],
'no-multi-spaces': 'error',
'semi-spacing': 'error',
'quote-props': [ 'error', 'as-needed' ],
indent: [ 'off', 'tab', { SwitchCase: 1 } ],
'no-mixed-spaces-and-tabs': 'error',
'padded-blocks': [ 'error', 'never' ],
'one-var-declaration-per-line': 'error',
'no-extra-semi': 'error',
'key-spacing': 'error',
'array-bracket-spacing': [ 'error', 'always' ],
'no-else-return': 'error',
'no-console': 'error',
//end of custom canceled rules
'arrow-parens': [ 'error', 'always' ],
'arrow-spacing': 'error',
'brace-style': [ 'error', '1tbs' ],
camelcase: [ 'error', { properties: 'never' } ],
'comma-spacing': 'error',
'comma-style': 'error',
'eol-last': 'error',
eqeqeq: 'error',
'func-call-spacing': 'error',
'jsx-quotes': 'error',
'keyword-spacing': 'error',
'lines-around-comment': 'off',
'no-bitwise': 'error',
'no-caller': 'error',
'no-debugger': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-eval': 'error',
'no-fallthrough': 'error',
'no-multiple-empty-lines': [ 'error', { max: 1 } ],
'no-multi-str': 'off',
'no-negated-in-lhs': 'error',
'no-redeclare': 'error',
'no-restricted-syntax': [
'error',
{
selector: 'CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])',
message: 'Translate function arguments must be string literals.',
},
{
selector: 'CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])',
message: 'Translate function arguments must be string literals.',
},
{
selector: 'CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])',
message: 'Translate function arguments must be string literals.',
},
],
'no-trailing-spaces': 'error',
'no-undef-init': 'error',
'no-unreachable': 'error',
'no-unsafe-negation': 'error',
'no-unused-expressions': 'error',
'no-useless-return': 'error',
'no-whitespace-before-property': 'error',
'object-curly-spacing': [ 'error', 'always' ],
'prefer-const': 'warn',
quotes: [ 'error', 'single', { allowTemplateLiterals: true, avoidEscape: true } ],
semi: 'error',
'space-before-blocks': [ 'error', 'always' ],
'space-before-function-paren': [ 'error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
} ],
'space-infix-ops': [ 'error', { int32Hint: false } ],
'space-unary-ops': [ 'error', {
overrides: {
'!': true,
yield: true,
},
} ],
'valid-typeof': 'error',
yoda: [ 'error', 'always', {
'onlyEquality': true,
} ],
// 'react/display-name': 'off',
// 'react/jsx-curly-spacing': [ 'error', {
// when: 'always',
// children: true,
// } ],
// 'react/jsx-equals-spacing': 'error',
// 'react/jsx-indent': [ 'error', 'tab' ],
// 'react/jsx-indent-props': [ 'error', 'tab' ],
// 'react/jsx-key': 'error',
// 'react/jsx-tag-spacing': 'error',
// 'react/no-children-prop': 'off',
// 'react/prop-types': 'off',
// 'react/react-in-jsx-scope': 'off',
},
};