-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
90 lines (81 loc) · 2.65 KB
/
eslint.config.mjs
File metadata and controls
90 lines (81 loc) · 2.65 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
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import prettierPlugin from 'eslint-plugin-prettier/recommended';
import testingLibraryPlugin from 'eslint-plugin-testing-library';
import figmaPlugin from '@figma/eslint-plugin-figma-plugins';
import globals from 'globals';
export default tseslint.config(
// Global ignores (replaces ignorePatterns)
{
ignores: ['node_modules/', 'dist/', '**/*.js', '!eslint.config.mjs', 'src/test/setup.ts'],
},
// Base JS recommended rules
js.configs.recommended,
// TypeScript recommended rules
...tseslint.configs.recommended,
// Global settings for all TS/TSX files
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
globals: {
...globals.browser,
...globals.jest,
},
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 2021,
sourceType: 'module',
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin,
'@figma/figma-plugins': figmaPlugin,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
// React
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-react': 'off',
'react/require-default-props': 'off',
// Figma plugin rules
...figmaPlugin.configs.recommended.rules,
// TypeScript
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', caughtErrors: 'none' }],
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-loop-func': 'off',
// General JS rules relaxed for this codebase
'no-param-reassign': 'off',
'no-await-in-loop': 'off',
'no-restricted-syntax': 'off',
'no-control-regex': 'off',
'no-useless-escape': 'off',
'no-continue': 'off',
'no-promise-executor-return': 'off',
'no-case-declarations': 'off',
'no-restricted-globals': 'off',
},
},
// Testing library - test files only
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
...testingLibraryPlugin.configs['flat/react'],
},
// Prettier must be last
prettierPlugin
);