xo 0.35.0 → 0.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-main.js +5 -1
- package/config/plugins.js +35 -18
- package/lib/options-manager.js +4 -0
- package/package.json +29 -21
- package/readme.md +12 -1
package/cli-main.js
CHANGED
|
@@ -135,6 +135,10 @@ if (typeof options.space === 'string') {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
if (process.env.GITHUB_ACTIONS && !options.fix && !options.reporter) {
|
|
139
|
+
options.quiet = true;
|
|
140
|
+
}
|
|
141
|
+
|
|
138
142
|
const log = report => {
|
|
139
143
|
const reporter = options.reporter || process.env.GITHUB_ACTIONS ? xo.getFormatter(options.reporter || 'compact') : formatterPretty;
|
|
140
144
|
process.stdout.write(reporter(report.results));
|
|
@@ -171,7 +175,7 @@ if (options.nodeVersion) {
|
|
|
171
175
|
if (options.fix) {
|
|
172
176
|
const result = xo.lintText(stdin, options).results[0];
|
|
173
177
|
// If there is no output, pass the stdin back out
|
|
174
|
-
process.stdout.write(result.output || stdin);
|
|
178
|
+
process.stdout.write((result && result.output) || stdin);
|
|
175
179
|
return;
|
|
176
180
|
}
|
|
177
181
|
|
package/config/plugins.js
CHANGED
|
@@ -42,6 +42,20 @@ module.exports = {
|
|
|
42
42
|
checkShorthandImports: false,
|
|
43
43
|
extendDefaultReplacements: false,
|
|
44
44
|
replacements: {
|
|
45
|
+
// https://thenextweb.com/dd/2020/07/13/linux-kernel-will-no-longer-use-terms-blacklist-and-slave/
|
|
46
|
+
whitelist: {
|
|
47
|
+
allowList: true
|
|
48
|
+
},
|
|
49
|
+
blacklist: {
|
|
50
|
+
denyList: true
|
|
51
|
+
},
|
|
52
|
+
master: {
|
|
53
|
+
main: true
|
|
54
|
+
},
|
|
55
|
+
slave: {
|
|
56
|
+
secondary: true
|
|
57
|
+
},
|
|
58
|
+
|
|
45
59
|
// Not part of `eslint-plugin-unicorn`
|
|
46
60
|
application: {
|
|
47
61
|
app: true
|
|
@@ -109,6 +123,9 @@ module.exports = {
|
|
|
109
123
|
},
|
|
110
124
|
val: {
|
|
111
125
|
value: true
|
|
126
|
+
},
|
|
127
|
+
err: {
|
|
128
|
+
error: true
|
|
112
129
|
}
|
|
113
130
|
}
|
|
114
131
|
}
|
|
@@ -135,6 +152,9 @@ module.exports = {
|
|
|
135
152
|
}
|
|
136
153
|
],
|
|
137
154
|
|
|
155
|
+
// TODO: Remove this when https://github.com/sindresorhus/eslint-plugin-unicorn/pull/977 is out.
|
|
156
|
+
'unicorn/import-index': 'off',
|
|
157
|
+
|
|
138
158
|
// TODO: Disabled for now as I don't have time to deal with the backslash that might come from this. Try to enable this rule in 2021.
|
|
139
159
|
'unicorn/no-null': 'off',
|
|
140
160
|
|
|
@@ -162,20 +182,22 @@ module.exports = {
|
|
|
162
182
|
'import/export': 'error',
|
|
163
183
|
'import/extensions': [
|
|
164
184
|
'error',
|
|
185
|
+
'always',
|
|
165
186
|
{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
187
|
+
ignorePackages: true,
|
|
188
|
+
// TypeScript doesn't yet support using extensions and fails with error TS2691.
|
|
189
|
+
pattern: {
|
|
190
|
+
ts: 'never',
|
|
191
|
+
tsx: 'never'
|
|
192
|
+
}
|
|
171
193
|
}
|
|
172
194
|
],
|
|
173
195
|
|
|
174
|
-
// Disabled as it causes problems with TypeScript when you use mixed ESM and CommonJS
|
|
175
|
-
// TODO: Enable again when I target only ESM
|
|
196
|
+
// Disabled as it causes problems with TypeScript when you use mixed ESM and CommonJS.
|
|
197
|
+
// TODO: Enable again when I target only ESM.
|
|
176
198
|
// 'import/first': 'error',
|
|
177
199
|
|
|
178
|
-
// Disabled as it doesn't work with TypeScript
|
|
200
|
+
// Disabled as it doesn't work with TypeScript.
|
|
179
201
|
// This issue and some others: https://github.com/benmosher/eslint-plugin-import/issues/1341
|
|
180
202
|
// 'import/named': 'error',
|
|
181
203
|
|
|
@@ -194,12 +216,7 @@ module.exports = {
|
|
|
194
216
|
// Enable this sometime in the future when Node.js has ES2015 module support
|
|
195
217
|
// 'import/no-cycle': 'error'
|
|
196
218
|
|
|
197
|
-
'import/no-useless-path-segments':
|
|
198
|
-
'error',
|
|
199
|
-
{
|
|
200
|
-
noUselessIndex: true
|
|
201
|
-
}
|
|
202
|
-
],
|
|
219
|
+
'import/no-useless-path-segments': 'error',
|
|
203
220
|
|
|
204
221
|
// Disabled as it doesn't work with TypeScript
|
|
205
222
|
// 'import/newline-after-import': 'error',
|
|
@@ -225,7 +242,7 @@ module.exports = {
|
|
|
225
242
|
// 'import/no-unresolved': [
|
|
226
243
|
// 'error',
|
|
227
244
|
// {
|
|
228
|
-
// commonjs:
|
|
245
|
+
// commonjs: false
|
|
229
246
|
// }
|
|
230
247
|
// ],
|
|
231
248
|
|
|
@@ -247,11 +264,11 @@ module.exports = {
|
|
|
247
264
|
}
|
|
248
265
|
],
|
|
249
266
|
|
|
250
|
-
// Redundant with import/no-extraneous-dependencies
|
|
267
|
+
// Redundant with `import/no-extraneous-dependencies`.
|
|
251
268
|
// 'node/no-extraneous-import': 'error',
|
|
252
269
|
// 'node/no-extraneous-require': 'error',
|
|
253
270
|
|
|
254
|
-
// Redundant with import/no-unresolved
|
|
271
|
+
// Redundant with `import/no-unresolved`.
|
|
255
272
|
// 'node/no-missing-import': 'error',
|
|
256
273
|
// 'node/no-missing-require': 'error',
|
|
257
274
|
|
|
@@ -340,7 +357,7 @@ module.exports = {
|
|
|
340
357
|
'eslint-comments/no-aggregating-enable': 'error',
|
|
341
358
|
'eslint-comments/no-duplicate-disable': 'error',
|
|
342
359
|
|
|
343
|
-
// Disabled as it's already covered by the `unicorn/no-abusive-eslint-disable` rule
|
|
360
|
+
// Disabled as it's already covered by the `unicorn/no-abusive-eslint-disable` rule.
|
|
344
361
|
// 'eslint-comments/no-unlimited-disable': 'error',
|
|
345
362
|
|
|
346
363
|
'eslint-comments/no-unused-disable': 'error',
|
package/lib/options-manager.js
CHANGED
|
@@ -327,6 +327,10 @@ const buildXOConfig = options => config => {
|
|
|
327
327
|
config.baseConfig.parser = options.parser;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
if (options.processor) {
|
|
331
|
+
config.baseConfig.processor = options.processor;
|
|
332
|
+
}
|
|
333
|
+
|
|
330
334
|
config.baseConfig.settings = options.settings || {};
|
|
331
335
|
config.baseConfig.settings['import/resolver'] = gatherImportResolvers(options);
|
|
332
336
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.1",
|
|
4
4
|
"description": "JavaScript/TypeScript linter with great defaults",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "xojs/xo",
|
|
@@ -51,15 +51,15 @@
|
|
|
51
51
|
"typescript"
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
55
|
-
"@typescript-eslint/parser": "^4.
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^4.11.1",
|
|
55
|
+
"@typescript-eslint/parser": "^4.11.1",
|
|
56
56
|
"arrify": "^2.0.1",
|
|
57
57
|
"cosmiconfig": "^7.0.0",
|
|
58
58
|
"debug": "^4.3.1",
|
|
59
|
-
"eslint": "^7.
|
|
60
|
-
"eslint-config-prettier": "^
|
|
61
|
-
"eslint-config-xo": "^0.
|
|
62
|
-
"eslint-config-xo-typescript": "^0.
|
|
59
|
+
"eslint": "^7.17.0",
|
|
60
|
+
"eslint-config-prettier": "^7.1.0",
|
|
61
|
+
"eslint-config-xo": "^0.34.0",
|
|
62
|
+
"eslint-config-xo-typescript": "^0.37.0",
|
|
63
63
|
"eslint-formatter-pretty": "^4.0.0",
|
|
64
64
|
"eslint-import-resolver-webpack": "^0.13.0",
|
|
65
65
|
"eslint-plugin-ava": "^11.0.0",
|
|
@@ -67,50 +67,52 @@
|
|
|
67
67
|
"eslint-plugin-import": "^2.22.1",
|
|
68
68
|
"eslint-plugin-no-use-extend-native": "^0.5.0",
|
|
69
69
|
"eslint-plugin-node": "^11.1.0",
|
|
70
|
-
"eslint-plugin-prettier": "^3.
|
|
70
|
+
"eslint-plugin-prettier": "^3.3.0",
|
|
71
71
|
"eslint-plugin-promise": "^4.2.1",
|
|
72
|
-
"eslint-plugin-unicorn": "^
|
|
72
|
+
"eslint-plugin-unicorn": "^25.0.1",
|
|
73
73
|
"find-cache-dir": "^3.3.1",
|
|
74
74
|
"find-up": "^5.0.0",
|
|
75
75
|
"fs-extra": "^9.0.1",
|
|
76
76
|
"get-stdin": "^8.0.0",
|
|
77
|
-
"globby": "^9.
|
|
77
|
+
"globby": "^9.2.0",
|
|
78
78
|
"has-flag": "^4.0.0",
|
|
79
79
|
"imurmurhash": "^0.1.4",
|
|
80
80
|
"is-path-inside": "^3.0.2",
|
|
81
81
|
"json-stable-stringify-without-jsonify": "^1.0.1",
|
|
82
82
|
"json5": "^2.1.3",
|
|
83
83
|
"lodash": "^4.17.20",
|
|
84
|
-
"meow": "^8.
|
|
84
|
+
"meow": "^8.1.0",
|
|
85
85
|
"micromatch": "^4.0.2",
|
|
86
|
-
"open-editor": "^
|
|
86
|
+
"open-editor": "^3.0.0",
|
|
87
87
|
"p-reduce": "^2.1.0",
|
|
88
88
|
"path-exists": "^4.0.0",
|
|
89
|
-
"prettier": "^2.1
|
|
89
|
+
"prettier": "^2.2.1",
|
|
90
90
|
"resolve-cwd": "^3.0.0",
|
|
91
91
|
"resolve-from": "^5.0.0",
|
|
92
|
-
"semver": "^7.3.
|
|
92
|
+
"semver": "^7.3.4",
|
|
93
93
|
"slash": "^3.0.0",
|
|
94
94
|
"to-absolute-glob": "^2.0.2",
|
|
95
|
-
"typescript": "^4.1.
|
|
95
|
+
"typescript": "^4.1.3",
|
|
96
96
|
"update-notifier": "^5.0.1"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"ava": "^3.
|
|
100
|
-
"coveralls": "^3.1.0",
|
|
99
|
+
"ava": "^3.15.0",
|
|
101
100
|
"eslint-config-xo-react": "^0.23.0",
|
|
102
|
-
"eslint-plugin-react": "^7.
|
|
101
|
+
"eslint-plugin-react": "^7.22.0",
|
|
103
102
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
104
103
|
"esm": "^3.2.25",
|
|
105
|
-
"execa": "^
|
|
104
|
+
"execa": "^5.0.0",
|
|
106
105
|
"nyc": "^15.1.0",
|
|
107
106
|
"pify": "^5.0.0",
|
|
108
107
|
"proxyquire": "^2.1.3",
|
|
109
108
|
"temp-write": "^4.0.0",
|
|
110
|
-
"webpack": "^5.
|
|
109
|
+
"webpack": "^5.11.1"
|
|
111
110
|
},
|
|
112
111
|
"eslintConfig": {
|
|
113
|
-
"extends": "eslint-config-xo"
|
|
112
|
+
"extends": "eslint-config-xo",
|
|
113
|
+
"rules": {
|
|
114
|
+
"unicorn/import-index": "off"
|
|
115
|
+
}
|
|
114
116
|
},
|
|
115
117
|
"eslintIgnore": [
|
|
116
118
|
"test/fixtures"
|
|
@@ -120,5 +122,11 @@
|
|
|
120
122
|
"esm"
|
|
121
123
|
],
|
|
122
124
|
"timeout": "1m"
|
|
125
|
+
},
|
|
126
|
+
"nyc": {
|
|
127
|
+
"reporter": [
|
|
128
|
+
"text",
|
|
129
|
+
"lcov"
|
|
130
|
+
]
|
|
123
131
|
}
|
|
124
132
|
}
|
package/readme.md
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
> JavaScript/TypeScript linter with great defaults
|
|
10
10
|
|
|
11
|
-
[](https://codecov.io/gh/xojs/xo/branch/master)
|
|
12
|
+
[](https://github.com/xojs/xo)
|
|
12
13
|
|
|
13
14
|
Opinionated but configurable ESLint wrapper with lots of goodies included. Enforces strict and readable code. Never discuss code style on a pull request again! No decision-making. No `.eslintrc` or `.jshintrc` to manage. It just works!
|
|
14
15
|
|
|
@@ -260,6 +261,12 @@ Type: `string`
|
|
|
260
261
|
|
|
261
262
|
ESLint parser. For example, [`babel-eslint`](https://github.com/babel/babel-eslint) if you're using language features that ESLint doesn't yet support.
|
|
262
263
|
|
|
264
|
+
### processor
|
|
265
|
+
|
|
266
|
+
Type: `string`
|
|
267
|
+
|
|
268
|
+
[ESLint processor.](https://eslint.org/docs/user-guide/configuring#specifying-processor)
|
|
269
|
+
|
|
263
270
|
### esnext
|
|
264
271
|
|
|
265
272
|
Type: `boolean`\
|
|
@@ -292,6 +299,10 @@ XO will handle the [@typescript-eslint/parser `project` option](https://github.c
|
|
|
292
299
|
|
|
293
300
|
See [eslint-config-xo-flow#use-with-xo](https://github.com/xojs/eslint-config-xo-flow#use-with-xo)
|
|
294
301
|
|
|
302
|
+
## GitHub Actions
|
|
303
|
+
|
|
304
|
+
XO uses a different formatter when running in a GitHub Actions workflow to be able to get [inline annotations](https://developer.github.com/changes/2019-09-06-more-check-annotations-shown-in-files-changed-tab/). XO also disables warnings here.
|
|
305
|
+
|
|
295
306
|
## Config Overrides
|
|
296
307
|
|
|
297
308
|
XO makes it easy to override configs for specific files. The `overrides` property must be an array of override objects. Each override object must contain a `files` property which is a glob string, or an array of glob strings, relative to the config file. The remaining properties are identical to those described above, and will override the settings of the base config. If multiple override configs match the same file, each matching override is applied in the order it appears in the array. This means the last override in the array takes precedence over earlier ones. Consider the following example:
|