-
-
Notifications
You must be signed in to change notification settings - Fork 267
/
Copy patheslint.config.mjs
104 lines (101 loc) · 2.77 KB
/
eslint.config.mjs
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
92
93
94
95
96
97
98
99
100
101
102
103
104
import eslint from '@eslint/js'
import tsParser from '@typescript-eslint/parser'
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import eslintPluginReact from 'eslint-plugin-react'
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
import globals from 'globals'
import typescriptEslint from 'typescript-eslint'
export default typescriptEslint.config(
{ ignores: ['**/*.d.ts', '**/coverage', '**/dist', 'eslint.config.mjs'] },
{
extends: [
eslint.configs.recommended,
...typescriptEslint.configs.recommended,
eslintPluginUnicorn.configs['flat/recommended'],
eslintPluginReact.configs.flat.recommended,
eslintPluginReact.configs.flat['jsx-runtime'],
],
plugins: {
'react-hooks': eslintPluginReactHooks,
},
files: ['packages/**/src/**/*.{js,ts,tsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
pragma: 'React',
version: 'detect',
},
},
rules: {
...eslintPluginReactHooks.configs.recommended.rules,
'no-console': 'off',
'no-debugger': 'off',
'unicorn/filename-case': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/no-null': 'off',
'unicorn/prefer-dom-node-append': 'off',
'unicorn/prefer-export-from': 'off',
'unicorn/prefer-query-selector': 'off',
'unicorn/prevent-abbreviations': 'off',
'vue/require-default-prop': 'off',
},
},
{
files: ['**/*.mjs'],
languageOptions: {
globals: {
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, 'off'])),
...globals.node,
},
ecmaVersion: 5,
sourceType: 'module',
},
},
{
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
languageOptions: {
globals: {
...globals.jest,
},
},
},
{
files: ['packages/docs/build/**'],
languageOptions: {
globals: {
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, 'off'])),
...globals.node,
},
ecmaVersion: 5,
sourceType: 'commonjs',
},
rules: {
'@typescript-eslint/no-var-requires': 'off',
'no-console': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-top-level-await': 'off',
},
},
{
files: ['packages/docs/**'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'unicorn/prefer-module': 'off',
},
},
eslintPluginPrettierRecommended,
)