Skip to content

Commit f80e3f2

Browse files
authored
fix(eslint): Cleanup some TS cruft in the eslint.config.mjs file (#83468)
<!-- Describe your PR here. -->
1 parent ee682ed commit f80e3f2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

eslint.config.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import {builtinModules} from 'node:module';
2828
import typescript from 'typescript-eslint';
2929

3030
invariant(react.configs.flat, 'For typescript');
31+
invariant(react.configs.flat.recommended, 'For typescript');
32+
invariant(react.configs.flat['jsx-runtime'], 'For typescript');
3133

3234
const restrictedImportPatterns = [
3335
{
@@ -262,7 +264,7 @@ export default typescript.config([
262264
'no-sequences': 'error',
263265
'no-throw-literal': 'error',
264266
'object-shorthand': ['error', 'properties'],
265-
'require-await': 'error', // TODO: see also @typescript-eslint/require-await
267+
'require-await': 'error', // Enabled in favor of @typescript-eslint/require-await, which requires type info
266268
'spaced-comment': [
267269
'error',
268270
'always',
@@ -316,8 +318,7 @@ export default typescript.config([
316318
name: 'plugin/react',
317319
// https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules
318320
plugins: {
319-
...(react.configs.flat.recommended?.plugins ?? {}),
320-
// @ts-ignore noUncheckedIndexedAccess
321+
...react.configs.flat.recommended.plugins,
321322
...react.configs.flat['jsx-runtime'].plugins,
322323
},
323324
rules: {
@@ -333,8 +334,7 @@ export default typescript.config([
333334
'react/sort-comp': 'error',
334335

335336
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/index.js
336-
...(react.configs.flat.recommended?.rules ?? {}),
337-
// @ts-ignore noUncheckedIndexedAccess
337+
...react.configs.flat.recommended.rules,
338338
...react.configs.flat['jsx-runtime'].rules,
339339
'react/display-name': 'off', // TODO(ryan953): Fix violations and delete this line
340340
'react/no-unescaped-entities': 'off', // TODO(ryan953): Fix violations and delete this line
@@ -358,7 +358,7 @@ export default typescript.config([
358358
name: 'plugin/typescript-eslint/custom',
359359
rules: {
360360
'no-shadow': 'off', // Disabled in favor of @typescript-eslint/no-shadow
361-
'no-use-before-define': 'off',
361+
'no-use-before-define': 'off', // See also @typescript-eslint/no-use-before-define
362362

363363
'@typescript-eslint/naming-convention': [
364364
'error',
@@ -387,7 +387,7 @@ export default typescript.config([
387387
},
388388
],
389389
'@typescript-eslint/no-shadow': 'error',
390-
'@typescript-eslint/no-use-before-define': 'off', // TODO(ryan953): Configure this and enable it
390+
'@typescript-eslint/no-use-before-define': 'off', // Enabling this will cause a lot of thrash to the git history
391391
},
392392
},
393393
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/base.ts

0 commit comments

Comments
 (0)