-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.js
More file actions
73 lines (70 loc) · 2.18 KB
/
eslint.config.js
File metadata and controls
73 lines (70 loc) · 2.18 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
import { defineConfig } from 'eslint/config';
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
import storybook from 'eslint-plugin-storybook';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
export default defineConfig([
{
ignores: [
'**/dist/**',
'**/node_modules/**',
'**/.next/**',
'**/build/**',
'**/packages/pxweb2-api-client/**',
'**/storybook-static/**',
'**/.cache/**',
],
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
plugins: {
'@typescript-eslint': tseslint,
react: reactPlugin,
'react-hooks': reactHooksPlugin,
'unused-imports': unusedImportsPlugin,
},
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
// TypeScript rules
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/no-unused-vars': 'error',
// React rules
'react/function-component-definition': [
'error',
{
namedComponents: ['function-declaration', 'arrow-function'],
unnamedComponents: 'arrow-function',
},
],
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/react-in-jsx-scope': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// General rules
curly: ['error', 'all'], // Enforce curly braces for all control statements
'no-extra-semi': 'off', // Turned off in favor of @typescript-eslint/no-extra-semi
'unused-imports/no-unused-imports': 'error',
},
},
...storybook.configs['flat/recommended'],
//reactHooksPlugin.configs.flat.recommended,
]);