-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy patheslint.config.js
More file actions
124 lines (116 loc) · 2.97 KB
/
eslint.config.js
File metadata and controls
124 lines (116 loc) · 2.97 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// eslint.config.js
const js = require('@eslint/js');
const reactPlugin = require('eslint-plugin-react');
const prettierPlugin = require('eslint-plugin-prettier');
const detoxPlugin = require('eslint-plugin-detox');
const jestPlugin = require('eslint-plugin-jest');
const tseslint = require('@typescript-eslint/eslint-plugin');
const tsParser = require('@typescript-eslint/parser');
module.exports = [
// Use ESLint's recommended rules as a base
js.configs.recommended,
// React plugin configuration
{
plugins: {
react: reactPlugin,
},
rules: {
...reactPlugin.configs.recommended.rules,
},
settings: {
react: {
version: 'detect',
},
},
},
// Prettier plugin configuration
{
plugins: {
prettier: prettierPlugin,
},
rules: {
'prettier/prettier': [
'error',
{
quoteProps: 'consistent',
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
},
],
},
},
// Detox and Jest plugin configuration
{
plugins: {
detox: detoxPlugin,
jest: jestPlugin,
},
languageOptions: {
globals: {
...jestPlugin.configs.recommended.globals,
module: true,
require: true,
console: true,
__dirname: true,
by: true,
describe: true,
it: true,
beforeAll: true,
afterAll: true,
},
},
},
// Custom rules
{
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
'react/react-in-jsx-scope': 'off',
'import/no-unresolved': 'off',
'import/no-extraneous-dependencies': 'off',
'no-undef': 'off', // Turn off no-undef as TypeScript handles this
'@typescript-eslint/no-explicit-any': 'off', // Allow any type
'@typescript-eslint/no-unused-vars': 'off', // Turn off unused vars completely
'@typescript-eslint/no-unused-expressions': 'off', // Allow unused expressions
'react/display-name': 'off', // Allow components without display names
},
},
// Files to ignore (replacing .eslintignore)
{
ignores: ['node_modules/**', 'lib/**', 'example/dist/**'],
},
// Apply to all JavaScript files
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
// TypeScript files specific configuration
{
files: ['**/*.{ts,tsx}'],
plugins: {
'@typescript-eslint': tseslint,
},
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
},
},
rules: {
// Override TypeScript ESLint recommended rules
...tseslint.configs.recommended.rules,
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
},
},
];