|
1 |
| -const nxPlugin = require('@nx/eslint-plugin') |
2 |
| -const { FlatCompat } = require('@eslint/eslintrc') |
3 |
| -const eslintPluginReact = require('eslint-plugin-react') |
4 |
| -const eslintPluginReactHooks = require('eslint-plugin-react-hooks') |
5 |
| -const eslintPluginImport = require('eslint-plugin-import') |
6 |
| -const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin') |
7 |
| -const typescriptEslintParser = require('@typescript-eslint/parser') |
8 |
| -const globals = require('globals') |
9 |
| -const js = require('@eslint/js') |
10 |
| -const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended') |
| 1 | +import nxPlugin from '@nx/eslint-plugin' |
| 2 | +import { FlatCompat } from '@eslint/eslintrc' |
| 3 | +import eslintPluginReact from 'eslint-plugin-react' |
| 4 | +import eslintPluginReactHooks from 'eslint-plugin-react-hooks' |
| 5 | +import eslintPluginImport from 'eslint-plugin-import' |
| 6 | +import typescriptEslintEslintPlugin from '@typescript-eslint/eslint-plugin' |
| 7 | +import typescriptEslintParser from '@typescript-eslint/parser' |
| 8 | +import globals from 'globals' |
| 9 | +import eslintJs from '@eslint/js' |
| 10 | +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' |
11 | 11 |
|
12 | 12 | const compat = new FlatCompat({
|
13 |
| - baseDirectory: __dirname, |
14 |
| - recommendedConfig: js.configs.recommended, |
| 13 | + baseDirectory: import.meta.dirname, |
| 14 | + recommendedConfig: eslintJs.configs.recommended, |
15 | 15 | })
|
16 | 16 |
|
17 |
| -module.exports = [ |
| 17 | +export default [ |
18 | 18 | ...compat.extends('plugin:@typescript-eslint/recommended', 'plugin:react/recommended'),
|
19 | 19 | eslintPluginPrettierRecommended,
|
20 | 20 | {
|
@@ -42,16 +42,12 @@ module.exports = [
|
42 | 42 | {
|
43 | 43 | rules: {
|
44 | 44 | ...typescriptEslintEslintPlugin.configs.recommended.rules,
|
| 45 | + ...typescriptEslintEslintPlugin.configs['recommended-requiring-type-checking'].rules, |
45 | 46 | ...eslintPluginReact.configs.recommended.rules,
|
46 | 47 | 'react-hooks/rules-of-hooks': 'error',
|
47 | 48 | 'react/jsx-filename-extension': [1, { extensions: ['.tsx'] }],
|
48 |
| - ...typescriptEslintEslintPlugin.configs['eslint-recommended'].rules, |
49 |
| - ...typescriptEslintEslintPlugin.configs['recommended'].rules, |
50 |
| - ...typescriptEslintEslintPlugin.configs['recommended-requiring-type-checking'].rules, |
51 |
| - ...eslintPluginReact.configs['recommended'].rules, |
52 | 49 | 'react/react-in-jsx-scope': 'off',
|
53 | 50 | '@typescript-eslint/no-explicit-any': 'warn',
|
54 |
| - // ...eslintPluginImport.configs.recommended.rules, |
55 | 51 | '@typescript-eslint/no-unsafe-call': 'off',
|
56 | 52 | '@typescript-eslint/no-unsafe-member-access': 'off',
|
57 | 53 | '@typescript-eslint/no-floating-promises': 'off',
|
|
0 commit comments