-
Notifications
You must be signed in to change notification settings - Fork 94
/
eslint.config.js
91 lines (89 loc) · 3.01 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const nxPlugin = require('@nx/eslint-plugin')
const { FlatCompat } = require('@eslint/eslintrc')
const eslintPluginReact = require('eslint-plugin-react')
const eslintPluginReactHooks = require('eslint-plugin-react-hooks')
const eslintPluginImport = require('eslint-plugin-import')
const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin')
const typescriptEslintParser = require('@typescript-eslint/parser')
const globals = require('globals')
const js = require('@eslint/js')
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended')
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
})
module.exports = [
...compat.extends('plugin:@typescript-eslint/recommended', 'plugin:react/recommended'),
eslintPluginPrettierRecommended,
{
plugins: {
react: eslintPluginReact,
'react-hooks': eslintPluginReactHooks,
'@typescript-eslint': typescriptEslintEslintPlugin,
'@nx': nxPlugin,
import: eslintPluginImport,
},
},
{
settings: { 'import/resolver': { typescript: {} }, react: { version: 'detect' } },
languageOptions: {
parser: typescriptEslintParser,
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 12,
sourceType: 'module',
project: './tsconfig.json',
},
globals: { ...globals.browser, ...globals.es2021 },
},
},
{
rules: {
...typescriptEslintEslintPlugin.configs.recommended.rules,
...eslintPluginReact.configs.recommended.rules,
'react-hooks/rules-of-hooks': 'error',
'react/jsx-filename-extension': [1, { extensions: ['.tsx'] }],
...typescriptEslintEslintPlugin.configs['eslint-recommended'].rules,
...typescriptEslintEslintPlugin.configs['recommended'].rules,
...typescriptEslintEslintPlugin.configs['recommended-requiring-type-checking'].rules,
...eslintPluginReact.configs['recommended'].rules,
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
// ...eslintPluginImport.configs.recommended.rules,
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'import/no-unused-modules': 'error',
'import/order': 'error',
'prettier/prettier': [
'error',
{
semi: false,
tabWidth: 2,
printWidth: 100,
singleQuote: true,
trailingComma: 'all',
bracketSameLine: true,
jsxSingleQuote: false,
endOfLine: 'auto',
},
],
},
},
{
ignores: [
'dist',
'coverage',
'test-results',
'playwright-report',
'storybook-static',
'eslint.config.js',
'.nx',
'jest.config.ts',
'public',
],
},
]