Skip to content

Commit ca72ed0

Browse files
committed
lint, sidebar
1 parent acf3e08 commit ca72ed0

File tree

12 files changed

+2134
-151
lines changed

12 files changed

+2134
-151
lines changed

eslint.config.mjs

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
import pluginJs from '@eslint/js';
2+
import { defineConfig } from 'eslint/config';
23
import importX from 'eslint-plugin-import-x';
34
import jsdoc from 'eslint-plugin-jsdoc';
5+
import react from 'eslint-plugin-react';
46
import globals from 'globals';
57

6-
export default [
8+
export default defineConfig([
79
pluginJs.configs.recommended,
810
importX.flatConfigs.recommended,
911
{
1012
ignores: ['out/', 'src/generators/api-links/__tests__/fixtures/'],
1113
},
1214
{
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+
},
1429
rules: {
30+
'react/jsx-uses-react': 'error',
31+
'react/jsx-uses-vars': 'error',
1532
'import-x/namespace': 'off',
1633
'import-x/no-named-as-default': 'off',
1734
'import-x/no-named-as-default-member': 'off',
@@ -34,18 +51,6 @@ export default [
3451
},
3552
},
3653
],
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: {
4954
'jsdoc/check-alignment': 'error',
5055
'jsdoc/check-indentation': 'error',
5156
'jsdoc/require-jsdoc': [
@@ -78,6 +83,14 @@ export default [
7883
'src/generators/legacy-html/assets/*.js',
7984
'src/generators/web/client/**/*',
8085
],
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+
},
8295
},
83-
];
96+
]);

0 commit comments

Comments
 (0)