Skip to content

Commit ed166e4

Browse files
committed
Add support for Vue, Svelte, and Astro file extensions
XO now automatically discovers and lints `.vue`, `.svelte`, and `.astro` files when running without arguments. This resolves the limitation where users had to explicitly pass these file patterns on the command line even when they were configured in the config file. Fixes #843
1 parent c4a13e1 commit ed166e4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ export const tsExtensions = ['ts', 'tsx', 'cts', 'mts'];
2222

2323
export const jsExtensions = ['js', 'jsx', 'mjs', 'cjs'];
2424

25+
export const frameworkExtensions = ['vue', 'svelte', 'astro'];
26+
2527
export const jsFilesGlob = `**/*.{${jsExtensions.join(',')}}`;
2628

2729
export const tsFilesGlob = `**/*.{${tsExtensions.join(',')}}`;
2830

29-
export const allExtensions = [...jsExtensions, ...tsExtensions];
31+
export const allExtensions = [...jsExtensions, ...tsExtensions, ...frameworkExtensions];
3032

3133
export const allFilesGlob = `**/*.{${allExtensions.join(',')}}`;
3234

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Simply run `$ npm init xo` (with any options) to add XO to create an `xo.config.
108108

109109
## Config
110110

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.
112112

113113
### Config types
114114

@@ -137,7 +137,7 @@ export default [...] satisfies import('xo').FlatXoConfig
137137
### files
138138

139139
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}`
141141

142142
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).
143143

0 commit comments

Comments
 (0)