-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
97 lines (92 loc) · 3.09 KB
/
Copy patheslint.config.js
File metadata and controls
97 lines (92 loc) · 3.09 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
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import react from 'eslint-plugin-react'
import tailwindcss from 'eslint-plugin-tailwindcss'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import tseslint from 'typescript-eslint'
export default tseslint.config([
{
ignores: ['dist', 'node_modules', '*.config.js', '*.config.ts'],
},
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
...tseslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
],
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
'jsx-a11y': jsxA11y,
tailwindcss,
},
languageOptions: {
ecmaVersion: 2022,
globals: globals.browser,
parserOptions: {
project: ['./tsconfig.app.json'],
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: 'detect',
},
tailwindcss: {
callees: ['cn', 'cva'],
config: 'tailwind.config.js',
},
},
rules: {
// TypeScript specific rules
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/no-unnecessary-condition': 'off', // Can be too strict
'@typescript-eslint/no-confusing-void-expression': 'off',
// React specific rules
'react/prop-types': 'off', // TypeScript handles this
'react/react-in-jsx-scope': 'off', // Not needed with React 17+
'react/jsx-uses-react': 'off', // Not needed with React 17+
'react/jsx-key': 'error',
'react/no-array-index-key': 'warn',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
// Tailwind CSS rules
'tailwindcss/classnames-order': 'warn',
'tailwindcss/no-custom-classname': 'off', // Allow custom classes for shadcn/ui
'tailwindcss/no-contradicting-classname': 'error',
'tailwindcss/enforces-negative-arbitrary-values': 'warn',
'tailwindcss/enforces-shorthand': 'warn',
// Accessibility rules
'jsx-a11y/alt-text': 'error',
'jsx-a11y/anchor-has-content': 'error',
'jsx-a11y/click-events-have-key-events': 'warn',
'jsx-a11y/no-static-element-interactions': 'warn',
'jsx-a11y/no-noninteractive-element-interactions': 'warn',
'jsx-a11y/role-supports-aria-props': 'error',
// General code quality
'no-console': 'warn',
'no-debugger': 'error',
'prefer-const': 'error',
'no-var': 'error',
'eqeqeq': ['error', 'always'],
'curly': ['error', 'multi-line'],
},
},
{
files: ['**/*.{js,mjs}'],
extends: [js.configs.recommended],
languageOptions: {
globals: globals.node,
},
},
])