xo 0.31.0 → 0.33.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 +23 -9
- package/config/plugins.js +3 -1
- package/lib/options-manager.js +3 -4
- package/package.json +26 -19
package/cli-main.js
CHANGED
|
@@ -46,6 +46,7 @@ const cli = meow(`
|
|
|
46
46
|
- Add XO to your project with \`npm init xo\`.
|
|
47
47
|
- Put options in package.json instead of using flags so other tools can read it.
|
|
48
48
|
`, {
|
|
49
|
+
autoVersion: false,
|
|
49
50
|
booleanDefault: undefined,
|
|
50
51
|
flags: {
|
|
51
52
|
fix: {
|
|
@@ -55,13 +56,16 @@ const cli = meow(`
|
|
|
55
56
|
type: 'string'
|
|
56
57
|
},
|
|
57
58
|
env: {
|
|
58
|
-
type: 'string'
|
|
59
|
+
type: 'string',
|
|
60
|
+
isMultiple: true
|
|
59
61
|
},
|
|
60
62
|
global: {
|
|
61
|
-
type: 'string'
|
|
63
|
+
type: 'string',
|
|
64
|
+
isMultiple: true
|
|
62
65
|
},
|
|
63
66
|
ignore: {
|
|
64
|
-
type: 'string'
|
|
67
|
+
type: 'string',
|
|
68
|
+
isMultiple: true
|
|
65
69
|
},
|
|
66
70
|
space: {
|
|
67
71
|
type: 'string'
|
|
@@ -76,10 +80,12 @@ const cli = meow(`
|
|
|
76
80
|
type: 'string'
|
|
77
81
|
},
|
|
78
82
|
plugin: {
|
|
79
|
-
type: 'string'
|
|
83
|
+
type: 'string',
|
|
84
|
+
isMultiple: true
|
|
80
85
|
},
|
|
81
86
|
extend: {
|
|
82
|
-
type: 'string'
|
|
87
|
+
type: 'string',
|
|
88
|
+
isMultiple: true
|
|
83
89
|
},
|
|
84
90
|
open: {
|
|
85
91
|
type: 'boolean'
|
|
@@ -88,7 +94,8 @@ const cli = meow(`
|
|
|
88
94
|
type: 'boolean'
|
|
89
95
|
},
|
|
90
96
|
extension: {
|
|
91
|
-
type: 'string'
|
|
97
|
+
type: 'string',
|
|
98
|
+
isMultiple: true
|
|
92
99
|
},
|
|
93
100
|
esnext: {
|
|
94
101
|
type: 'boolean'
|
|
@@ -100,15 +107,14 @@ const cli = meow(`
|
|
|
100
107
|
type: 'boolean'
|
|
101
108
|
},
|
|
102
109
|
stdinFilename: {
|
|
103
|
-
type: 'string'
|
|
104
|
-
alias: 'filename'
|
|
110
|
+
type: 'string'
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
113
|
});
|
|
108
114
|
|
|
109
115
|
updateNotifier({pkg: cli.pkg}).notify();
|
|
110
116
|
|
|
111
|
-
const {input, flags: options} = cli;
|
|
117
|
+
const {input, flags: options, showVersion} = cli;
|
|
112
118
|
|
|
113
119
|
// Make data types for `options.space` match those of the API
|
|
114
120
|
// Check for string type because `xo --no-space` sets `options.space` to `false`
|
|
@@ -141,6 +147,10 @@ if (input[0] === '-') {
|
|
|
141
147
|
input.shift();
|
|
142
148
|
}
|
|
143
149
|
|
|
150
|
+
if (options.version) {
|
|
151
|
+
showVersion();
|
|
152
|
+
}
|
|
153
|
+
|
|
144
154
|
if (options.nodeVersion) {
|
|
145
155
|
if (options.nodeVersion === 'false') {
|
|
146
156
|
options.nodeVersion = false;
|
|
@@ -154,6 +164,10 @@ if (options.nodeVersion) {
|
|
|
154
164
|
if (options.stdin) {
|
|
155
165
|
const stdin = await getStdin();
|
|
156
166
|
|
|
167
|
+
if (options.stdinFilename) {
|
|
168
|
+
options.filename = options.stdinFilename;
|
|
169
|
+
}
|
|
170
|
+
|
|
157
171
|
if (options.fix) {
|
|
158
172
|
const result = xo.lintText(stdin, options).results[0];
|
|
159
173
|
// If there is no output, pass the stdin back out
|
package/config/plugins.js
CHANGED
package/lib/options-manager.js
CHANGED
|
@@ -99,7 +99,7 @@ const mergeWithFileConfig = options => {
|
|
|
99
99
|
({options} = applyOverrides(options.filename, options));
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
const prettierOptions = options.prettier ? prettier.resolveConfig.sync(searchPath) || {} : {};
|
|
102
|
+
const prettierOptions = options.prettier ? prettier.resolveConfig.sync(searchPath, {editorconfig: true}) || {} : {};
|
|
103
103
|
|
|
104
104
|
if (options.filename && isTypescript(options.filename)) {
|
|
105
105
|
const tsConfigExplorer = cosmiconfigSync([], {searchPlaces: ['tsconfig.json'], loaders: {'.json': (_, content) => JSON5.parse(content)}});
|
|
@@ -133,8 +133,7 @@ const mergeWithFileConfigs = async (files, options, configFiles) => {
|
|
|
133
133
|
const {hash, options: optionsWithOverrides} = applyOverrides(file, fileOptions);
|
|
134
134
|
fileOptions = optionsWithOverrides;
|
|
135
135
|
|
|
136
|
-
const
|
|
137
|
-
const prettierOptions = prettierConfigPath ? await prettier.resolveConfig(file, {config: prettierConfigPath}) : {};
|
|
136
|
+
const prettierOptions = fileOptions.prettier ? await prettier.resolveConfig(file, {editorconfig: true}) || {} : {};
|
|
138
137
|
|
|
139
138
|
let tsConfigPath;
|
|
140
139
|
if (isTypescript(file)) {
|
|
@@ -147,7 +146,7 @@ const mergeWithFileConfigs = async (files, options, configFiles) => {
|
|
|
147
146
|
fileOptions.ts = true;
|
|
148
147
|
}
|
|
149
148
|
|
|
150
|
-
const cacheKey = stringify({xoConfigPath, enginesConfigPath,
|
|
149
|
+
const cacheKey = stringify({xoConfigPath, enginesConfigPath, prettierOptions, hash, tsConfigPath: fileOptions.tsConfigPath, ts: fileOptions.ts});
|
|
151
150
|
const cachedGroup = configs.get(cacheKey);
|
|
152
151
|
|
|
153
152
|
configs.set(cacheKey, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.1",
|
|
4
4
|
"description": "JavaScript/TypeScript linter with great defaults",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "xojs/xo",
|
|
@@ -51,25 +51,25 @@
|
|
|
51
51
|
"typescript"
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^3.
|
|
55
|
-
"@typescript-eslint/parser": "^3.
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^3.9.0",
|
|
55
|
+
"@typescript-eslint/parser": "^3.9.0",
|
|
56
56
|
"arrify": "^2.0.1",
|
|
57
|
-
"cosmiconfig": "^
|
|
57
|
+
"cosmiconfig": "^7.0.0",
|
|
58
58
|
"debug": "^4.1.1",
|
|
59
|
-
"eslint": "^7.
|
|
59
|
+
"eslint": "^7.6.0",
|
|
60
60
|
"eslint-config-prettier": "^6.11.0",
|
|
61
|
-
"eslint-config-xo": "^0.
|
|
62
|
-
"eslint-config-xo-typescript": "^0.
|
|
63
|
-
"eslint-formatter-pretty": "^
|
|
61
|
+
"eslint-config-xo": "^0.32.1",
|
|
62
|
+
"eslint-config-xo-typescript": "^0.32.0",
|
|
63
|
+
"eslint-formatter-pretty": "^4.0.0",
|
|
64
64
|
"eslint-import-resolver-webpack": "^0.12.1",
|
|
65
|
-
"eslint-plugin-ava": "^10.
|
|
65
|
+
"eslint-plugin-ava": "^10.5.0",
|
|
66
66
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
67
67
|
"eslint-plugin-import": "^2.20.2",
|
|
68
68
|
"eslint-plugin-no-use-extend-native": "^0.5.0",
|
|
69
69
|
"eslint-plugin-node": "^11.1.0",
|
|
70
70
|
"eslint-plugin-prettier": "^3.1.3",
|
|
71
71
|
"eslint-plugin-promise": "^4.2.1",
|
|
72
|
-
"eslint-plugin-unicorn": "^
|
|
72
|
+
"eslint-plugin-unicorn": "^21.0.0",
|
|
73
73
|
"find-cache-dir": "^3.3.1",
|
|
74
74
|
"find-up": "^4.1.0",
|
|
75
75
|
"fs-extra": "^9.0.0",
|
|
@@ -80,8 +80,8 @@
|
|
|
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
|
-
"lodash": "^4.17.
|
|
84
|
-
"meow": "^
|
|
83
|
+
"lodash": "^4.17.19",
|
|
84
|
+
"meow": "^7.0.1",
|
|
85
85
|
"micromatch": "^4.0.2",
|
|
86
86
|
"open-editor": "^2.0.1",
|
|
87
87
|
"p-reduce": "^2.1.0",
|
|
@@ -92,26 +92,33 @@
|
|
|
92
92
|
"semver": "^7.3.2",
|
|
93
93
|
"slash": "^3.0.0",
|
|
94
94
|
"to-absolute-glob": "^2.0.2",
|
|
95
|
-
"typescript": "^3.
|
|
95
|
+
"typescript": "^3.9.7",
|
|
96
96
|
"update-notifier": "^4.1.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"ava": "^
|
|
99
|
+
"ava": "^3.9.0",
|
|
100
100
|
"coveralls": "^3.1.0",
|
|
101
101
|
"eslint-config-xo-react": "^0.23.0",
|
|
102
|
-
"eslint-plugin-react": "^7.20.
|
|
103
|
-
"eslint-plugin-react-hooks": "^4.0.
|
|
104
|
-
"
|
|
102
|
+
"eslint-plugin-react": "^7.20.5",
|
|
103
|
+
"eslint-plugin-react-hooks": "^4.0.8",
|
|
104
|
+
"esm": "^3.2.25",
|
|
105
|
+
"execa": "^4.0.3",
|
|
105
106
|
"nyc": "^15.1.0",
|
|
106
107
|
"pify": "^5.0.0",
|
|
107
108
|
"proxyquire": "^2.1.3",
|
|
108
109
|
"temp-write": "^4.0.0",
|
|
109
|
-
"webpack": "^4.
|
|
110
|
+
"webpack": "^4.44.1"
|
|
110
111
|
},
|
|
111
112
|
"eslintConfig": {
|
|
112
113
|
"extends": "eslint-config-xo"
|
|
113
114
|
},
|
|
114
115
|
"eslintIgnore": [
|
|
115
116
|
"test/fixtures"
|
|
116
|
-
]
|
|
117
|
+
],
|
|
118
|
+
"ava": {
|
|
119
|
+
"require": [
|
|
120
|
+
"esm"
|
|
121
|
+
],
|
|
122
|
+
"timeout": "1m"
|
|
123
|
+
}
|
|
117
124
|
}
|