-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
110 lines (104 loc) · 3.13 KB
/
eslint.config.js
File metadata and controls
110 lines (104 loc) · 3.13 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
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
import storybook from "eslint-plugin-storybook";
import unicorn from "eslint-plugin-unicorn";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import js from "@eslint/js";
import prettierConfig from "eslint-config-prettier";
import sonarjs from "eslint-plugin-sonarjs";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
export default [js.configs.recommended, {
ignores: ["**/dist/**", "**/node_modules/**", "**/.cache/**"],
}, // Configuration for Node.js scripts
{
files: ["src/**/*.{ts,tsx}"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: "./tsconfig.json",
ecmaFeatures: {
jsx: true,
},
},
ecmaVersion: "latest",
sourceType: "module",
globals: {
// Browser globals
window: "readonly",
document: "readonly",
navigator: "readonly",
localStorage: "readonly",
sessionStorage: "readonly",
fetch: "readonly",
alert: "readonly",
location: "readonly",
history: "readonly",
FormData: "readonly",
Blob: "readonly",
File: "readonly",
FileReader: "readonly",
URL: "readonly",
URLSearchParams: "readonly",
// Other globals
console: "readonly",
process: "readonly",
React: "writable",
Bun: "readonly",
},
},
plugins: {
"@typescript-eslint": typescriptEslint,
unicorn: unicorn,
sonarjs: sonarjs,
react: reactPlugin,
"react-hooks": reactHooksPlugin,
"jsx-a11y": jsxA11yPlugin,
},
settings: {
react: {
version: "detect",
},
},
rules: {
...typescriptEslint.configs.recommended.rules,
...unicorn.configs.recommended.rules,
...sonarjs.configs.recommended.rules,
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
...jsxA11yPlugin.configs.recommended.rules,
// Basic styling
quotes: ["error", "double"],
semi: ["error", "always"],
// React specific rules
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/jsx-uses-react": "off",
// Set specific rules
"@typescript-eslint/no-unused-vars": "off",
"sonarjs/no-useless-undefined": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/no-null": "off",
"unicorn/prevent-abbreviations": "off",
"sonarjs/different-types-comparison": "off",
"sonarjs/function-return-type": "off",
},
}, // This disables rules that conflict with prettier
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
console: "readonly",
process: "readonly",
__dirname: "readonly",
__filename: "readonly",
Buffer: "readonly",
global: "readonly",
},
},
}, prettierConfig, ...storybook.configs["flat/recommended"], ...storybook.configs["flat/recommended"]];