Skip to content

Commit 66fef06

Browse files
committed
fix: include .jsx files when the options set to true
1 parent 21459bc commit 66fef06

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

scripts/typegen.ts

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
javascript,
1010
jsdoc,
1111
jsonc,
12+
jsx,
1213
node,
1314
perfectionist,
1415
react,
@@ -38,6 +39,7 @@ const configs = await combine(
3839
javascript(),
3940
jsdoc(),
4041
jsonc(),
42+
jsx(),
4143
node(),
4244
perfectionist(),
4345
react(),

src/configs/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ export * from './svelte'
1919
export * from './tailwindcss'
2020
export * from './command'
2121
export * from './regexp'
22+
export * from './jsx'

src/configs/javascript.ts

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export async function javascript(
3636
linterOptions: {
3737
reportUnusedDisableDirectives: true,
3838
},
39+
name: 'coderwyd/javascript/setup',
40+
},
41+
{
3942
name: 'coderwyd/javascript/rules',
4043
plugins: {
4144
'unused-imports': pluginUnusedImports,

src/configs/jsx.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { GLOB_JSX, GLOB_TSX } from '../constants/glob'
2+
import type { TypedFlatConfigItem } from '../types'
3+
4+
export async function jsx(): Promise<TypedFlatConfigItem[]> {
5+
return [
6+
{
7+
files: [GLOB_JSX, GLOB_TSX],
8+
languageOptions: {
9+
parserOptions: {
10+
ecmaFeatures: {
11+
jsx: true,
12+
},
13+
},
14+
},
15+
name: 'coderwyd/jsx/setup',
16+
},
17+
]
18+
}

src/index.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
javascript,
99
jsdoc,
1010
jsonc,
11+
jsx,
1112
node,
1213
perfectionist,
1314
react,
@@ -89,6 +90,7 @@ export async function defineConfig(
8990
},
9091
gitignore: enableGitignore = true,
9192
isInEditor = defaultIsInEditor,
93+
jsx: enableJsx = true,
9294
react: enableReact = false,
9395
regexp: enableRegexp = true,
9496
svelte: enableSvelte = false,
@@ -106,7 +108,7 @@ export async function defineConfig(
106108
: {}
107109

108110
if (stylisticOptions && !('jsx' in stylisticOptions))
109-
stylisticOptions.jsx = options.jsx ?? true
111+
stylisticOptions.jsx = enableJsx
110112

111113
const configs: Awaitable<TypedFlatConfigItem[]>[] = []
112114

@@ -157,6 +159,10 @@ export async function defineConfig(
157159
if (enableVue)
158160
componentExts.push('vue')
159161

162+
if (enableJsx) {
163+
configs.push(jsx())
164+
}
165+
160166
if (enableTypeScript) {
161167
configs.push(
162168
typescript({

0 commit comments

Comments
 (0)