-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.mjs
More file actions
102 lines (90 loc) · 2.63 KB
/
Copy patheslint.config.mjs
File metadata and controls
102 lines (90 loc) · 2.63 KB
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
import importPlugin from 'eslint-plugin-import'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import storybook from 'eslint-plugin-storybook'
import { defineConfig, globalIgnores } from 'eslint/config'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import js from '@eslint/js'
import localRules from './eslint-rules/no-implicit-story-actions.mjs'
export default defineConfig([
globalIgnores([
'dist/**/*',
'build/**/*',
'storybook-static/**/*',
'public/mockServiceWorker.js',
]),
js.configs.recommended,
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
reactHooks.configs.flat['recommended-latest'],
jsxA11y.flatConfigs.recommended,
importPlugin.flatConfigs.recommended,
...storybook.configs['flat/recommended'],
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
},
},
settings: {
react: {
version: '18.2.0',
},
'import/resolver': {
typescript: true,
},
},
rules: {
'no-unused-vars': 'off',
'react/no-unescaped-entities': 'off',
},
},
{
files: ['**/*.ts?(x)'],
extends: [
tseslint.configs.recommended,
importPlugin.flatConfigs.typescript,
],
rules: {
'no-undef': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
// tsc already validates these; the plugin has to parse every
// imported module (including inside node_modules) to check them,
// which is slow and chokes on some .d.ts files.
'import/namespace': 'off',
'import/default': 'off',
},
},
{
files: ['**/*.stories.*'],
rules: {
'import/no-anonymous-default-export': 'off',
},
},
{
files: ['**/*.stories.@(ts|tsx)'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
local: localRules,
},
rules: {
'local/no-implicit-story-actions': 'error',
},
},
])