-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.mjs
More file actions
115 lines (113 loc) · 3.59 KB
/
Copy patheslint.config.mjs
File metadata and controls
115 lines (113 loc) · 3.59 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
import globals from "globals";
import eslint from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
import tseslint from "typescript-eslint";
export default [
{
// Global ignores
// https://eslint.org/docs/latest/use/configure/configuration-files#configuration-objects
ignores: [
"node_modules",
"dist",
"build",
"demo.js",
"webpack.config.js",
],
},
{
files: ["**/*.{js,mjs,cjs,ts}"],
languageOptions: {
globals: globals.browser,
},
},
stylistic.configs.customize(
{
arrowParens: true,
braceStyle: "1tbs",
commaDangle: "always-multiline",
indent: 4,
quotes: "double",
},
),
{
plugins: {
"@stylistic": stylistic,
},
rules: {
"@stylistic/array-element-newline": [
"error",
{
consistent: true,
multiline: true,
},
],
"@stylistic/function-call-argument-newline": ["error", "consistent"],
"@stylistic/function-call-spacing": ["error", "never"],
"@stylistic/member-delimiter-style": [
"error",
{
multiline: {
delimiter: "semi",
requireLast: true,
},
singleline: {
delimiter: "semi",
requireLast: false,
},
multilineDetection: "brackets",
},
],
"@stylistic/operator-linebreak": ["error", "after"],
"@stylistic/semi": ["error", "always"],
},
},
eslint.configs.recommended,
...tseslint.configs.recommended,
{
// Special configuration for test files - placed last to override other configs
files: ["tests/**/*.{js,mjs,cjs,ts}", "jest.config.js", "playwright.config.js"],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jest,
require: "readonly",
module: "readonly",
global: "readonly",
process: "readonly",
describe: "readonly",
test: "readonly",
it: "readonly",
expect: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
beforeAll: "readonly",
afterAll: "readonly",
jest: "readonly",
},
},
rules: {
// Allow require() imports in tests (needed for CommonJS module loading)
"@typescript-eslint/no-require-imports": "off",
// Allow no-undef for Node.js and Jest globals
"no-undef": "off",
// Allow unused variables in tests (for mocking scenarios)
"@typescript-eslint/no-unused-vars": "warn",
// Allow unused expressions in test setup (for side effects)
"@typescript-eslint/no-unused-expressions": "off",
},
},
{
// Node-specific config for build/release tooling scripts
files: ["scripts/**/*.{js,mjs,cjs}"],
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
// Build scripts use CommonJS require()
"@typescript-eslint/no-require-imports": "off",
},
},
];