xo 2.0.1 → 2.0.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/dist/cli.js
CHANGED
|
@@ -119,7 +119,7 @@ const linterOptions = {
|
|
|
119
119
|
// Make data types for `options.space` match those of the API
|
|
120
120
|
if (typeof cliOptions.space === 'string') {
|
|
121
121
|
cliOptions.space = cliOptions.space.trim();
|
|
122
|
-
if (/^\d+$/
|
|
122
|
+
if (/^\d+$/v.test(cliOptions.space)) {
|
|
123
123
|
baseXoConfigOptions.space = Number.parseInt(cliOptions.space, 10);
|
|
124
124
|
}
|
|
125
125
|
else if (cliOptions.space === 'true') {
|
|
@@ -29,7 +29,8 @@ export async function resolveXoConfig(options) {
|
|
|
29
29
|
});
|
|
30
30
|
options.filePath &&= path.resolve(options.cwd, options.filePath);
|
|
31
31
|
const searchPath = options.filePath ?? options.cwd;
|
|
32
|
-
let { config: flatOptions = [], filepath: flatConfigPath = '',
|
|
32
|
+
let { config: flatOptions = [], filepath: flatConfigPath = '', // eslint-disable-line @typescript-eslint/no-useless-default-assignment
|
|
33
|
+
} = await (options.configPath
|
|
33
34
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
34
35
|
? flatConfigExplorer.load(path.resolve(options.cwd, options.configPath))
|
|
35
36
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
@@ -41,6 +42,7 @@ export async function resolveXoConfig(options) {
|
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
catch (error) {
|
|
45
|
+
// eslint-disable-next-line preserve-caught-error
|
|
44
46
|
throw new AggregateError([error], 'Error resolving XO config, there is likely an issue with your config file. Please check the file for mistakes.');
|
|
45
47
|
}
|
|
46
48
|
}
|
package/dist/lib/xo-to-eslint.js
CHANGED
|
@@ -107,12 +107,12 @@ export function xoToEslintConfig(flatXoConfig, { prettierOptions = {} } = {}) {
|
|
|
107
107
|
if (xoConfigItem.react) {
|
|
108
108
|
// Ensure the files applied to the React config are the same as the config they are derived from
|
|
109
109
|
// TODO: Remove `fixupConfigRules` wrapping when eslint-config-xo-react supports ESLint 10 natively.
|
|
110
|
-
baseConfig.push({ ...fixupConfigRules(configReact)[0], files: eslintConfigItem.files, name: 'xo/react' });
|
|
110
|
+
baseConfig.push({ ...fixupConfigRules(configReact)[0], ...(eslintConfigItem.files ? { files: eslintConfigItem.files } : {}), name: 'xo/react' });
|
|
111
111
|
}
|
|
112
112
|
// Prettier should generally be the last config in the array
|
|
113
113
|
if (xoConfigItem.prettier) {
|
|
114
114
|
if (xoConfigItem.prettier === 'compat') {
|
|
115
|
-
baseConfig.push({ ...eslintConfigPrettier, files: eslintConfigItem.files });
|
|
115
|
+
baseConfig.push({ ...eslintConfigPrettier, ...(eslintConfigItem.files ? { files: eslintConfigItem.files } : {}) });
|
|
116
116
|
}
|
|
117
117
|
else {
|
|
118
118
|
// Validate that Prettier options match other `xoConfig` options.
|