1
1
import pluginJs from '@eslint/js' ;
2
+ import { defineConfig } from 'eslint/config' ;
2
3
import importX from 'eslint-plugin-import-x' ;
3
4
import jsdoc from 'eslint-plugin-jsdoc' ;
5
+ import react from 'eslint-plugin-react' ;
4
6
import globals from 'globals' ;
5
7
6
- export default [
8
+ export default defineConfig ( [
7
9
pluginJs . configs . recommended ,
8
10
importX . flatConfigs . recommended ,
9
11
{
10
12
ignores : [ 'out/' , 'src/generators/api-links/__tests__/fixtures/' ] ,
11
13
} ,
12
14
{
13
- files : [ '**/*.mjs' ] ,
15
+ files : [ '**/*.{mjs,jsx}' ] ,
16
+ plugins : {
17
+ jsdoc,
18
+ react,
19
+ } ,
20
+ languageOptions : {
21
+ ecmaVersion : 'latest' ,
22
+ parserOptions : {
23
+ ecmaFeatures : {
24
+ jsx : true ,
25
+ } ,
26
+ } ,
27
+ globals : { ...globals . nodeBuiltin } ,
28
+ } ,
14
29
rules : {
30
+ 'react/jsx-uses-react' : 'error' ,
31
+ 'react/jsx-uses-vars' : 'error' ,
15
32
'import-x/namespace' : 'off' ,
16
33
'import-x/no-named-as-default' : 'off' ,
17
34
'import-x/no-named-as-default-member' : 'off' ,
@@ -34,18 +51,6 @@ export default [
34
51
} ,
35
52
} ,
36
53
] ,
37
- } ,
38
- } ,
39
- {
40
- files : [ 'src/**/*.mjs' , 'bin/**/*.mjs' ] ,
41
- plugins : {
42
- jsdoc : jsdoc ,
43
- } ,
44
- languageOptions : {
45
- ecmaVersion : 'latest' ,
46
- globals : { ...globals . nodeBuiltin } ,
47
- } ,
48
- rules : {
49
54
'jsdoc/check-alignment' : 'error' ,
50
55
'jsdoc/check-indentation' : 'error' ,
51
56
'jsdoc/require-jsdoc' : [
@@ -78,6 +83,14 @@ export default [
78
83
'src/generators/legacy-html/assets/*.js' ,
79
84
'src/generators/web/client/**/*' ,
80
85
] ,
81
- languageOptions : { globals : { ...globals . browser } } ,
86
+ languageOptions : {
87
+ globals : {
88
+ ...globals . browser ,
89
+ // SERVER and CLIENT denote server-only and client-only
90
+ // codepaths in our web generator
91
+ CLIENT : 'readonly' ,
92
+ SERVER : 'readonly' ,
93
+ } ,
94
+ } ,
82
95
} ,
83
- ] ;
96
+ ] ) ;
0 commit comments