|
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: { |
15 | 30 | 'object-shorthand': 'error', |
| 31 | + 'react/jsx-uses-react': 'error', |
| 32 | + 'react/jsx-uses-vars': 'error', |
16 | 33 | 'import-x/namespace': 'off', |
17 | 34 | 'import-x/no-named-as-default': 'off', |
18 | 35 | 'import-x/no-named-as-default-member': 'off', |
@@ -75,7 +92,19 @@ export default [ |
75 | 92 | }, |
76 | 93 | }, |
77 | 94 | { |
78 | | - files: ['src/generators/legacy-html/assets/*.js'], |
79 | | - languageOptions: { globals: { ...globals.browser }, ecmaVersion: 'latest' }, |
| 95 | + files: [ |
| 96 | + 'src/generators/legacy-html/assets/*.js', |
| 97 | + 'src/generators/web/ui/**/*', |
| 98 | + ], |
| 99 | + languageOptions: { |
| 100 | + globals: { |
| 101 | + ...globals.browser, |
| 102 | + // SERVER and CLIENT denote server-only and client-only |
| 103 | + // codepaths in our web generator |
| 104 | + CLIENT: 'readonly', |
| 105 | + SERVER: 'readonly', |
| 106 | + }, |
| 107 | + ecmaVersion: 'latest', |
| 108 | + }, |
80 | 109 | }, |
81 | | -]; |
| 110 | +]); |
0 commit comments