-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.js
More file actions
94 lines (88 loc) · 1.92 KB
/
eslint.config.js
File metadata and controls
94 lines (88 loc) · 1.92 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
import js from "@eslint/js";
import react from "eslint-plugin-react";
import prettier from "eslint-plugin-prettier";
import jest from "eslint-plugin-jest";
export default [
// Base configurations
js.configs.recommended,
// React plugin configuration
{
files: ["**/*.{js,jsx}"],
plugins: {
react,
},
languageOptions: {
globals: {
module: true,
require: true,
window: true, // If your code interacts with window
document: true, // If your code interacts with document
},
sourceType: "module",
ecmaVersion: "latest",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: "detect", // Automatically detect React version
},
},
rules: {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
},
},
// Jest-specific configuration for test files
{
files: ["test/**/*.js", "**/*.spec.js"],
plugins: {
jest,
},
languageOptions: {
globals: {
describe: true,
it: true,
beforeEach: true,
afterEach: true,
expect: true,
jest: true,
window: true, // If your test interacts with window
},
},
rules: {
...jest.configs["flat/recommended"].rules,
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error",
},
},
// Node.js environment for jest.config.js
{
files: ["jest.config.js"],
languageOptions: {
globals: {
module: true,
require: true,
},
},
},
// Prettier plugin configuration
{
plugins: {
prettier,
},
rules: {
"prettier/prettier": "error",
},
},
// Ignored files/directories
{
ignores: ["lib/**"],
},
];