1
+ import js from '@eslint/js' ;
2
+ import tseslint from '@typescript-eslint/eslint-plugin' ;
3
+ import tsparser from '@typescript-eslint/parser' ;
4
+ import cypress from 'eslint-plugin-cypress' ;
5
+ import importPlugin from 'eslint-plugin-import' ;
6
+ import eslintConfigPrettier from 'eslint-config-prettier' ;
7
+
8
+ export default [
9
+ // Global ignores
10
+ {
11
+ ignores : [ 'node_modules/**' , 'dist/**' , 'cypress.config.ts' , 'eslint.config.mjs' ] ,
12
+ } ,
13
+ js . configs . recommended ,
14
+ {
15
+ files : [ 'cypress/**/*.{js,ts}' ] ,
16
+ languageOptions : {
17
+ parser : tsparser ,
18
+ parserOptions : {
19
+ project : './tsconfig.json' ,
20
+ ecmaVersion : 'latest' ,
21
+ sourceType : 'module' ,
22
+ } ,
23
+ globals : {
24
+ cy : 'readonly' ,
25
+ Cypress : 'readonly' ,
26
+ describe : 'readonly' ,
27
+ it : 'readonly' ,
28
+ before : 'readonly' ,
29
+ after : 'readonly' ,
30
+ beforeEach : 'readonly' ,
31
+ afterEach : 'readonly' ,
32
+ expect : 'readonly' ,
33
+ context : 'readonly' ,
34
+ setTimeout : 'readonly' ,
35
+ } ,
36
+ } ,
37
+ plugins : {
38
+ '@typescript-eslint' : tseslint ,
39
+ 'import' : importPlugin ,
40
+ 'cypress' : cypress ,
41
+ } ,
42
+ rules : {
43
+ // Base JavaScript recommended rules
44
+ ...js . configs . recommended . rules ,
45
+
46
+ // TypeScript ESLint recommended rules
47
+ ...tseslint . configs . recommended . rules ,
48
+
49
+ // Import plugin rules (mimicking airbnb-base behavior)
50
+ 'import/no-unresolved' : 'error' ,
51
+ 'import/named' : 'error' ,
52
+ 'import/default' : 'error' ,
53
+ 'import/namespace' : 'error' ,
54
+ 'import/no-absolute-path' : 'error' ,
55
+ 'import/no-self-import' : 'error' ,
56
+ 'import/no-cycle' : 'error' ,
57
+ 'import/no-useless-path-segments' : 'error' ,
58
+ 'import/newline-after-import' : 'error' ,
59
+ 'import/no-duplicates' : 'error' ,
60
+
61
+ // Custom rules from the original config
62
+ '@typescript-eslint/array-type' : [ 'error' , { default : 'array-simple' } ] ,
63
+ '@typescript-eslint/await-thenable' : 'error' ,
64
+ '@typescript-eslint/explicit-function-return-type' : 'off' ,
65
+ '@typescript-eslint/explicit-module-boundary-types' : 'off' ,
66
+ '@typescript-eslint/naming-convention' : [
67
+ 'error' ,
68
+ {
69
+ selector : 'default' ,
70
+ format : [ 'camelCase' ] ,
71
+ leadingUnderscore : 'allow' ,
72
+ } ,
73
+ {
74
+ selector : 'variable' ,
75
+ format : [ 'camelCase' , 'UPPER_CASE' ] ,
76
+ } ,
77
+ {
78
+ selector : [ 'typeLike' , 'enumMember' ] ,
79
+ format : [ 'PascalCase' ] ,
80
+ } ,
81
+ {
82
+ selector : [ 'objectLiteralProperty' ] ,
83
+ format : null ,
84
+ } ,
85
+ ] ,
86
+ '@typescript-eslint/no-base-to-string' : 'error' ,
87
+ '@typescript-eslint/no-extra-non-null-assertion' : 'error' ,
88
+ '@typescript-eslint/no-floating-promises' : 'error' ,
89
+ '@typescript-eslint/no-namespace' : 'error' ,
90
+ '@typescript-eslint/no-non-null-assertion' : 'error' ,
91
+ '@typescript-eslint/no-unused-vars' : [
92
+ 'error' ,
93
+ {
94
+ argsIgnorePattern : '^_' ,
95
+ varsIgnorePattern : '^_' ,
96
+ } ,
97
+ ] ,
98
+ '@typescript-eslint/no-use-before-define' : [
99
+ 'error' ,
100
+ {
101
+ classes : false ,
102
+ functions : false ,
103
+ } ,
104
+ ] ,
105
+ '@typescript-eslint/prefer-interface' : 'off' ,
106
+ '@typescript-eslint/prefer-nullish-coalescing' : [ 'warn' ] ,
107
+ '@typescript-eslint/prefer-optional-chain' : 'error' ,
108
+ '@typescript-eslint/prefer-string-starts-ends-with' : 'error' ,
109
+ '@typescript-eslint/promise-function-async' : 'error' ,
110
+
111
+ // Import rules
112
+ 'import/prefer-default-export' : 'off' ,
113
+
114
+ // Base JavaScript rules
115
+ 'no-plusplus' : [ 'error' , { allowForLoopAfterthoughts : true } ] ,
116
+ 'no-sequences' : 'error' ,
117
+ 'no-underscore-dangle' : 'off' ,
118
+ 'no-use-before-define' : [ 'error' , { classes : false , functions : false } ] ,
119
+
120
+ // Cypress rules
121
+ 'cypress/no-unnecessary-waiting' : 'warn' ,
122
+
123
+ } ,
124
+ settings : {
125
+ 'import/resolver' : {
126
+ typescript : {
127
+ project : './tsconfig.json' ,
128
+ } ,
129
+ node : {
130
+ extensions : [ '.js' , '.jsx' , '.ts' , '.tsx' ] ,
131
+ paths : [ 'cypress' ] ,
132
+ } ,
133
+ } ,
134
+ } ,
135
+ } ,
136
+ // Prettier config to disable formatting rules
137
+ eslintConfigPrettier ,
138
+ ] ;
0 commit comments