1
1
import js from '@eslint/js' ;
2
- import tseslint from '@typescript-eslint/eslint-plugin' ;
3
2
import tsparser from '@typescript-eslint/parser' ;
4
- import prettierConfig from 'eslint-config-prettier' ;
5
- import prettierPlugin from 'eslint-plugin-prettier' ;
3
+ import tseslint from '@typescript-eslint/eslint-plugin' ;
6
4
import globals from 'globals' ;
5
+ import importPlugin from 'eslint-plugin-import' ;
6
+ import react from 'eslint-plugin-react' ;
7
7
8
- export default [
9
- // Base JavaScript configuration
10
- js . configs . recommended ,
11
-
12
- // Global ignore patterns
8
+ export default tseslint . config (
9
+ // Global ignores (no changes here)
13
10
{
14
11
ignores : [
15
12
'**/node_modules/**' ,
@@ -26,86 +23,98 @@ export default [
26
23
] ,
27
24
} ,
28
25
29
- // Universal TypeScript configuration for the entire monorepo
26
+ // Base recommended configurations
27
+ js . configs . recommended ,
28
+ ...tseslint . configs . recommended ,
29
+
30
+ // Main configuration object
30
31
{
31
32
files : [ '**/*.ts' , '**/*.tsx' ] ,
32
33
languageOptions : {
33
34
parser : tsparser ,
34
- parserOptions : {
35
- ecmaVersion : 2021 ,
36
- sourceType : 'module' ,
37
- // Don't use project-based parsing to avoid config issues
38
- ecmaFeatures : {
39
- jsx : true ,
40
- } ,
41
- } ,
42
- globals : {
43
- // Universal globals that work everywhere
44
- ...globals . node ,
45
- ...globals . browser ,
46
- ...globals . es2021 ,
47
- console : 'readonly' ,
48
- process : 'readonly' ,
49
- Buffer : 'readonly' ,
50
- __dirname : 'readonly' ,
51
- __filename : 'readonly' ,
52
- global : 'readonly' ,
53
- React : 'readonly' ,
54
- JSX : 'readonly' ,
55
- } ,
35
+ globals : { ...globals . node , ...globals . es2021 , ...globals . bun } ,
56
36
} ,
57
37
plugins : {
58
- '@typescript-eslint' : tseslint ,
59
- prettier : prettierPlugin ,
38
+ import : importPlugin ,
39
+ } ,
40
+ settings : {
41
+ 'import/resolver' : {
42
+ typescript : {
43
+ project : [
44
+ 'apps/*/tsconfig.json' ,
45
+ 'packages/*/tsconfig.json' ,
46
+ './tsconfig.json' ,
47
+ ] ,
48
+ } ,
49
+ node : true ,
50
+ } ,
51
+ 'import/core-modules' : [ 'bun:test' , 'bun:sqlite' , 'bun' ] ,
60
52
} ,
61
53
rules : {
62
- // Turn off rules that conflict with TypeScript
63
- 'no-undef' : 'off' , // TypeScript handles this
64
- 'no-unused-vars' : 'off' , // Use TypeScript version instead
65
- 'no-redeclare' : 'off' , // TypeScript handles this better
66
-
67
- // Turn off rules that don't exist or cause issues
68
- 'react-hooks/exhaustive-deps' : 'off' ,
69
- '@next/next/no-sync-scripts' : 'off' ,
70
- 'no-shadow-restricted-names' : 'off' ,
54
+ ...importPlugin . configs . recommended . rules ,
55
+ ...importPlugin . configs . typescript . rules ,
71
56
72
- // TypeScript specific rules - simplified and lenient
57
+ // Core and TypeScript rules
58
+ 'no-console' : 'warn' ,
59
+ '@typescript-eslint/no-explicit-any' : 'warn' ,
60
+ '@typescript-eslint/no-require-imports' : 'warn' ,
61
+ '@typescript-eslint/ban-ts-comment' : 'warn' ,
73
62
'@typescript-eslint/no-unused-vars' : [
74
63
'warn' ,
75
64
{
76
- argsIgnorePattern : '^_ ' ,
65
+ vars : 'all ' ,
77
66
varsIgnorePattern : '^_' ,
78
- caughtErrorsIgnorePattern : '^_ ' ,
79
- ignoreRestSiblings : true ,
67
+ args : 'after-used ' ,
68
+ argsIgnorePattern : '^_' ,
80
69
} ,
81
70
] ,
82
- '@typescript-eslint/no-explicit-any' : 'off' ,
83
- '@typescript-eslint/explicit-function-return-type' : 'off' ,
84
- '@typescript-eslint/explicit-module-boundary-types' : 'off' ,
85
- '@typescript-eslint/no-inferrable-types' : 'off' ,
86
-
87
- // Prettier integration
88
- 'prettier/prettier' : [
71
+ 'lines-between-class-members' : [
89
72
'warn' ,
73
+ 'always' ,
74
+ { exceptAfterSingleLine : true } ,
75
+ ] ,
76
+
77
+ // Import rules
78
+ 'import/order' : [
79
+ 'error' ,
90
80
{
91
- endOfLine : 'auto' ,
92
- trailingComma : 'all' ,
81
+ groups : [
82
+ 'builtin' ,
83
+ 'external' ,
84
+ 'internal' ,
85
+ 'parent' ,
86
+ 'sibling' ,
87
+ 'index' ,
88
+ 'object' ,
89
+ 'unknown' ,
90
+ ] ,
91
+ pathGroups : [ { pattern : '@/**' , group : 'internal' } ] ,
92
+ pathGroupsExcludedImportTypes : [ 'builtin' ] ,
93
+ 'newlines-between' : 'always' ,
94
+ alphabetize : { order : 'asc' , caseInsensitive : true } ,
93
95
} ,
94
96
] ,
97
+ 'import/newline-after-import' : 'error' ,
98
+ 'import/no-duplicates' : 'error' ,
99
+ } ,
100
+ } ,
95
101
96
- // Relaxed rules for monorepo compatibility
97
- 'no-console' : 'off' ,
98
- 'prefer-const' : 'warn' ,
99
- 'no-constant-condition' : 'warn' ,
100
- 'no-constant-binary-expression' : 'warn' ,
102
+ // React specific configuration
103
+ {
104
+ files : [ '**/*.{js,jsx,mjs,cjs,ts,tsx}' ] ,
105
+ plugins : {
106
+ react,
107
+ } ,
108
+ rules : {
109
+ ...react . configs . recommended . rules ,
110
+ 'react/react-in-jsx-scope' : 'off' ,
111
+ 'react/no-unknown-property' : [
112
+ 'error' ,
113
+ { ignore : [ 'custom-prop' , 'cmdk-input-wrapper' , 'cmdk-group-heading' ] } ,
114
+ ] ,
101
115
} ,
102
116
settings : {
103
- react : {
104
- version : 'detect' ,
105
- } ,
117
+ react : { version : 'detect' } ,
106
118
} ,
107
119
} ,
108
-
109
- // Prettier config (must be last to override conflicting rules)
110
- prettierConfig ,
111
- ] ;
120
+ ) ;
0 commit comments