-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/
Copy patheslint.config.mjs
162 lines (149 loc) · 2.66 KB
/
eslint.config.mjs
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import jqueryConfig from "eslint-config-jquery";
import globals from "globals";
export default [
{
ignores: [
"dist/**/*",
"!dist/jquery-ui.js",
"!dist/jquery-ui.min.js",
"external/**/*",
"tests/lib/vendor/**/*",
"ui/vendor/**/*"
]
},
{
ignores: [ "dist/**/*" ],
rules: {
...jqueryConfig.rules,
"no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
]
}
},
{
files: [ "Gruntfile.js" ],
languageOptions: {
ecmaVersion: "latest",
sourceType: "commonjs",
globals: {
...globals.node
}
},
rules: {
strict: [ "error", "global" ]
}
},
{
files: [ "eslint.config.mjs" ],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.node
}
},
rules: {
strict: [ "error", "global" ]
}
},
// Source, demos
{
files: [ "ui/**/*.js", "demos/**/*.js" ],
languageOptions: {
ecmaVersion: 5,
sourceType: "script",
globals: {
...globals.browser,
...globals.jquery,
define: false,
Globalize: false
}
},
rules: {
strict: [ "error", "function" ],
// The following rule is relaxed due to too many violations:
"no-unused-vars": [
"error",
{
args: "after-used",
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
],
// Too many violations:
camelcase: "off",
"no-nested-ternary": "off"
}
},
{
files: [ "ui/i18n/**/*.js" ],
rules: {
// We want to keep all the strings in separate single lines
"max-len": "off"
}
},
// Dist files
// For dist files, we don't include any jQuery rules on purpose.
// We just want to make sure the files are correct ES5.
{
files: [ "dist/jquery-ui.js", "dist/jquery-ui.min.js" ],
languageOptions: {
ecmaVersion: 5,
sourceType: "script"
},
linterOptions: {
reportUnusedDisableDirectives: "off"
}
},
// Build
{
files: [ "build/**/*.js" ],
languageOptions: {
ecmaVersion: "latest",
sourceType: "commonjs",
globals: {
...globals.node
}
},
rules: {
"no-implicit-globals": "error",
strict: [ "error", "global" ]
}
},
// Demos
{
files: [ "demos/**/*.js" ],
languageOptions: {
globals: {
require: true
}
}
},
// Tests
{
files: [ "tests/**/*.js" ],
languageOptions: {
ecmaVersion: 5,
sourceType: "script",
globals: {
...globals.browser,
...globals.jquery,
define: false,
Globalize: false,
QUnit: false,
require: true,
requirejs: true
}
},
"rules": {
// Too many violations:
"max-len": "off",
"no-unused-vars": "off",
strict: "off" // ideally, `[ "error", "function" ]`
}
}
];