xo 0.37.0 → 0.38.2
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 +9 -0
- package/config/plugins.js +27 -3
- package/lib/constants.js +2 -0
- package/lib/options-manager.js +1 -0
- package/package.json +16 -16
- package/readme.md +8 -6
package/cli-main.js
CHANGED
|
@@ -116,6 +116,15 @@ updateNotifier({pkg: cli.pkg}).notify();
|
|
|
116
116
|
|
|
117
117
|
const {input, flags: options, showVersion} = cli;
|
|
118
118
|
|
|
119
|
+
// TODO: Fix this properly instead of the below workaround.
|
|
120
|
+
// Revert behavior of meow >8 to pre-8 (7.1.1) for flags using `isMultiple: true`.
|
|
121
|
+
// Otherwise, options defined in package.json can't be merged by lib/options-manager.js `mergeOptions()`.
|
|
122
|
+
for (const key in options) {
|
|
123
|
+
if (Array.isArray(options[key]) && options[key].length === 0) {
|
|
124
|
+
delete options[key];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
119
128
|
// Make data types for `options.space` match those of the API
|
|
120
129
|
// Check for string type because `xo --no-space` sets `options.space` to `false`
|
|
121
130
|
if (typeof options.space === 'string') {
|
package/config/plugins.js
CHANGED
|
@@ -152,12 +152,18 @@ module.exports = {
|
|
|
152
152
|
}
|
|
153
153
|
],
|
|
154
154
|
|
|
155
|
-
// TODO:
|
|
156
|
-
'unicorn/
|
|
155
|
+
// TODO: Disabled for now until it becomes more stable: https://github.com/sindresorhus/eslint-plugin-unicorn/search?q=consistent-destructuring+is:issue&state=open&type=issues
|
|
156
|
+
'unicorn/consistent-destructuring': 'off',
|
|
157
157
|
|
|
158
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.
|
|
159
159
|
'unicorn/no-null': 'off',
|
|
160
160
|
|
|
161
|
+
// We only enforce it for single-line statements to not be too opinionated.
|
|
162
|
+
'unicorn/prefer-ternary': [
|
|
163
|
+
'error',
|
|
164
|
+
'only-single-line'
|
|
165
|
+
],
|
|
166
|
+
|
|
161
167
|
// TODO: Remove this override when the rule is more stable.
|
|
162
168
|
'unicorn/consistent-function-scoping': 'off',
|
|
163
169
|
|
|
@@ -184,7 +190,12 @@ module.exports = {
|
|
|
184
190
|
'error',
|
|
185
191
|
'always',
|
|
186
192
|
{
|
|
187
|
-
ignorePackages: true
|
|
193
|
+
ignorePackages: true,
|
|
194
|
+
// TypeScript doesn't yet support using extensions and fails with error TS2691.
|
|
195
|
+
pattern: {
|
|
196
|
+
ts: 'never',
|
|
197
|
+
tsx: 'never'
|
|
198
|
+
}
|
|
188
199
|
}
|
|
189
200
|
],
|
|
190
201
|
|
|
@@ -250,7 +261,9 @@ module.exports = {
|
|
|
250
261
|
allow: [
|
|
251
262
|
'@babel/polyfill',
|
|
252
263
|
'**/register',
|
|
264
|
+
'**/register.*',
|
|
253
265
|
'**/register/**',
|
|
266
|
+
'**/register/**.*',
|
|
254
267
|
'**/*.css',
|
|
255
268
|
'**/*.scss',
|
|
256
269
|
'**/*.sass',
|
|
@@ -268,6 +281,17 @@ module.exports = {
|
|
|
268
281
|
// 'node/no-missing-require': 'error',
|
|
269
282
|
|
|
270
283
|
'node/no-unpublished-bin': 'error',
|
|
284
|
+
|
|
285
|
+
// We have this enabled in addition to `import/extensions` as this one has an auto-fix.
|
|
286
|
+
'node/file-extension-in-import': [
|
|
287
|
+
'error',
|
|
288
|
+
'always',
|
|
289
|
+
{
|
|
290
|
+
// TypeScript doesn't yet support using extensions and fails with error TS2691.
|
|
291
|
+
'.ts': 'never',
|
|
292
|
+
'.tsx': 'never'
|
|
293
|
+
}
|
|
294
|
+
],
|
|
271
295
|
'node/no-mixed-requires': [
|
|
272
296
|
'error',
|
|
273
297
|
{
|
package/lib/constants.js
CHANGED
package/lib/options-manager.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.2",
|
|
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.15.1",
|
|
55
|
+
"@typescript-eslint/parser": "^4.15.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": "^7.
|
|
61
|
-
"eslint-config-xo": "^0.
|
|
62
|
-
"eslint-config-xo-typescript": "^0.
|
|
59
|
+
"eslint": "^7.20.0",
|
|
60
|
+
"eslint-config-prettier": "^7.2.0",
|
|
61
|
+
"eslint-config-xo": "^0.35.0",
|
|
62
|
+
"eslint-config-xo-typescript": "^0.38.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,21 +67,21 @@
|
|
|
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.3.
|
|
71
|
-
"eslint-plugin-promise": "^4.
|
|
72
|
-
"eslint-plugin-unicorn": "^
|
|
70
|
+
"eslint-plugin-prettier": "^3.3.1",
|
|
71
|
+
"eslint-plugin-promise": "^4.3.1",
|
|
72
|
+
"eslint-plugin-unicorn": "^28.0.2",
|
|
73
73
|
"find-cache-dir": "^3.3.1",
|
|
74
74
|
"find-up": "^5.0.0",
|
|
75
|
-
"fs-extra": "^9.0
|
|
75
|
+
"fs-extra": "^9.1.0",
|
|
76
76
|
"get-stdin": "^8.0.0",
|
|
77
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
|
-
"json5": "^2.
|
|
82
|
+
"json5": "^2.2.0",
|
|
83
83
|
"lodash": "^4.17.20",
|
|
84
|
-
"meow": "^
|
|
84
|
+
"meow": "^9.0.0",
|
|
85
85
|
"micromatch": "^4.0.2",
|
|
86
86
|
"open-editor": "^3.0.0",
|
|
87
87
|
"p-reduce": "^2.1.0",
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"semver": "^7.3.4",
|
|
93
93
|
"slash": "^3.0.0",
|
|
94
94
|
"to-absolute-glob": "^2.0.2",
|
|
95
|
-
"typescript": "^4.1.
|
|
96
|
-
"update-notifier": "^5.0
|
|
95
|
+
"typescript": "^4.1.5",
|
|
96
|
+
"update-notifier": "^5.1.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"ava": "^3.15.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"pify": "^5.0.0",
|
|
107
107
|
"proxyquire": "^2.1.3",
|
|
108
108
|
"temp-write": "^4.0.0",
|
|
109
|
-
"webpack": "^5.
|
|
109
|
+
"webpack": "^5.23.0"
|
|
110
110
|
},
|
|
111
111
|
"eslintConfig": {
|
|
112
112
|
"extends": "eslint-config-xo",
|
package/readme.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> JavaScript/TypeScript linter with great defaults
|
|
10
10
|
|
|
11
|
-
[](https://codecov.io/gh/xojs/xo/branch/main)
|
|
12
12
|
[](https://github.com/xojs/xo)
|
|
13
13
|
|
|
14
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!
|
|
@@ -19,7 +19,7 @@ Uses [ESLint](https://eslint.org) underneath, so issues regarding rules should b
|
|
|
19
19
|
|
|
20
20
|
*Vue components are not supported by default. You'll need [eslint-config-xo-vue](https://github.com/ChocPanda/eslint-config-xo-vue#use-with-xo) for specific linting in a Vue app.*
|
|
21
21
|
|
|
22
|
-

|
|
23
23
|
|
|
24
24
|
## Highlights
|
|
25
25
|
|
|
@@ -101,7 +101,7 @@ $ xo --help
|
|
|
101
101
|
- Space after keyword `if (condition) {}`
|
|
102
102
|
- Always `===` instead of `==`
|
|
103
103
|
|
|
104
|
-
Check out an [example](index.js) and the [ESLint rules](https://github.com/xojs/eslint-config-xo/blob/
|
|
104
|
+
Check out an [example](index.js) and the [ESLint rules](https://github.com/xojs/eslint-config-xo/blob/main/index.js).
|
|
105
105
|
|
|
106
106
|
## Workflow
|
|
107
107
|
|
|
@@ -193,7 +193,7 @@ This option exists for pragmatic reasons, but I would strongly recommend you rea
|
|
|
193
193
|
|
|
194
194
|
Type: `object`
|
|
195
195
|
|
|
196
|
-
Override any of the [default rules](https://github.com/xojs/eslint-config-xo/blob/
|
|
196
|
+
Override any of the [default rules](https://github.com/xojs/eslint-config-xo/blob/main/index.js). See the [ESLint docs](https://eslint.org/docs/rules/) for more info on each rule.
|
|
197
197
|
|
|
198
198
|
Please take a moment to consider if you really need to use this option.
|
|
199
199
|
|
|
@@ -247,7 +247,7 @@ Use one or more [shareable configs](https://eslint.org/docs/developer-guide/shar
|
|
|
247
247
|
|
|
248
248
|
Type: `string[]`
|
|
249
249
|
|
|
250
|
-
Allow more extensions to be linted besides `.js
|
|
250
|
+
Allow more extensions to be linted besides `.js`, `.jsx`, `.mjs`, and `.cjs`. Make sure they're supported by ESLint or an ESLint plugin.
|
|
251
251
|
|
|
252
252
|
### settings
|
|
253
253
|
|
|
@@ -303,6 +303,8 @@ See [eslint-config-xo-flow#use-with-xo](https://github.com/xojs/eslint-config-xo
|
|
|
303
303
|
|
|
304
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
305
|
|
|
306
|
+
**Note**: For this to work, the [setup-node](https://github.com/actions/setup-node) action must be run before XO.
|
|
307
|
+
|
|
306
308
|
## Config Overrides
|
|
307
309
|
|
|
308
310
|
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:
|
|
@@ -394,7 +396,7 @@ This way your `package.json` will contain the actual minimum Node.js version sup
|
|
|
394
396
|
|
|
395
397
|
### Including files ignored by default
|
|
396
398
|
|
|
397
|
-
To include files that XO [ignores by default](
|
|
399
|
+
To include files that XO [ignores by default](lib/constants.js#L1), add them as negative globs in the `ignores` option:
|
|
398
400
|
|
|
399
401
|
```json
|
|
400
402
|
{
|