xo 1.2.1 → 1.2.3
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/lib/constants.d.ts +1 -0
- package/dist/lib/constants.js +2 -1
- package/dist/lib/xo-to-eslint.js +4 -1
- package/package.json +1 -1
- package/readme.md +2 -2
package/dist/lib/constants.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ Only applies to options defined as an Array.
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const tsExtensions: string[];
|
|
9
9
|
export declare const jsExtensions: string[];
|
|
10
|
+
export declare const frameworkExtensions: string[];
|
|
10
11
|
export declare const jsFilesGlob: string;
|
|
11
12
|
export declare const tsFilesGlob: string;
|
|
12
13
|
export declare const allExtensions: string[];
|
package/dist/lib/constants.js
CHANGED
|
@@ -16,9 +16,10 @@ Only applies to options defined as an Array.
|
|
|
16
16
|
*/
|
|
17
17
|
export const tsExtensions = ['ts', 'tsx', 'cts', 'mts'];
|
|
18
18
|
export const jsExtensions = ['js', 'jsx', 'mjs', 'cjs'];
|
|
19
|
+
export const frameworkExtensions = ['vue', 'svelte', 'astro'];
|
|
19
20
|
export const jsFilesGlob = `**/*.{${jsExtensions.join(',')}}`;
|
|
20
21
|
export const tsFilesGlob = `**/*.{${tsExtensions.join(',')}}`;
|
|
21
|
-
export const allExtensions = [...jsExtensions, ...tsExtensions];
|
|
22
|
+
export const allExtensions = [...jsExtensions, ...tsExtensions, ...frameworkExtensions];
|
|
22
23
|
export const allFilesGlob = `**/*.{${allExtensions.join(',')}}`;
|
|
23
24
|
export const moduleName = 'xo';
|
|
24
25
|
export const tsconfigDefaults = {
|
package/dist/lib/xo-to-eslint.js
CHANGED
|
@@ -49,11 +49,13 @@ export function xoToEslintConfig(flatXoConfig, { prettierOptions = {} } = {}) {
|
|
|
49
49
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
50
50
|
{ SwitchCase: 1 },
|
|
51
51
|
];
|
|
52
|
+
eslintConfigItem.rules['@stylistic/indent-binary-ops'] = ['error', spaces];
|
|
52
53
|
}
|
|
53
54
|
else if (xoConfigItem.space === false) {
|
|
54
55
|
// If a user sets this to false for a small subset of files for some reason,
|
|
55
56
|
// then we need to set them back to their original values.
|
|
56
57
|
eslintConfigItem.rules['@stylistic/indent'] = configXoTypescript[1]?.rules?.['@stylistic/indent'];
|
|
58
|
+
eslintConfigItem.rules['@stylistic/indent-binary-ops'] = configXoTypescript[1]?.rules?.['@stylistic/indent-binary-ops'];
|
|
57
59
|
}
|
|
58
60
|
if (xoConfigItem.react) {
|
|
59
61
|
// Ensure the files applied to the React config are the same as the config they are derived from
|
|
@@ -66,7 +68,8 @@ export function xoToEslintConfig(flatXoConfig, { prettierOptions = {} } = {}) {
|
|
|
66
68
|
}
|
|
67
69
|
else {
|
|
68
70
|
// Validate that Prettier options match other `xoConfig` options.
|
|
69
|
-
|
|
71
|
+
/* eslint-disable-next-line */
|
|
72
|
+
if ((xoConfigItem.semicolon && prettierOptions.semi === false) || (!xoConfigItem.semicolon && prettierOptions.semi === true)) {
|
|
70
73
|
throw new Error(`The Prettier config \`semi\` is ${prettierOptions.semi} while Xo \`semicolon\` is ${xoConfigItem.semicolon}, also check your .editorconfig for inconsistencies.`);
|
|
71
74
|
}
|
|
72
75
|
if (((xoConfigItem.space ?? typeof xoConfigItem.space === 'number') && prettierOptions.useTabs === true) || (!xoConfigItem.space && prettierOptions.useTabs === false)) {
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -108,7 +108,7 @@ Simply run `$ npm init xo` (with any options) to add XO to create an `xo.config.
|
|
|
108
108
|
|
|
109
109
|
## Config
|
|
110
110
|
|
|
111
|
-
You can configure XO options by creating an `xo.config.js` or an `xo.config.ts` file in the root directory of your project, or you can add an `xo` field to your `package.json`. XO supports all js/ts file extensions (js,cjs,mjs,ts,cts,mts) automatically. A XO config is an extension of ESLint's Flat Config. Like ESLint, an XO config exports an array of XO config objects. XO config objects extend [ESLint Configuration Objects](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects). This means all the available configuration params for ESLint also work for `XO`. However, `XO` enhances and adds extra params to the configuration objects to make them easier to work with.
|
|
111
|
+
You can configure XO options by creating an `xo.config.js` or an `xo.config.ts` file in the root directory of your project, or you can add an `xo` field to your `package.json`. XO supports all js/ts file extensions (js,cjs,mjs,ts,cts,mts) and popular framework extensions (vue,svelte,astro) automatically. A XO config is an extension of ESLint's Flat Config. Like ESLint, an XO config exports an array of XO config objects. XO config objects extend [ESLint Configuration Objects](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects). This means all the available configuration params for ESLint also work for `XO`. However, `XO` enhances and adds extra params to the configuration objects to make them easier to work with.
|
|
112
112
|
|
|
113
113
|
### Config types
|
|
114
114
|
|
|
@@ -137,7 +137,7 @@ export default [...] satisfies import('xo').FlatXoConfig
|
|
|
137
137
|
### files
|
|
138
138
|
|
|
139
139
|
Type: `string | string[] | undefined`\
|
|
140
|
-
Default: `**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}`
|
|
140
|
+
Default: `**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue,svelte,astro}`
|
|
141
141
|
|
|
142
142
|
A glob or array of glob strings which the config object will apply. By default `XO` will apply the configuration to [all files](lib/constants.ts).
|
|
143
143
|
|