Skip to content

Commit da6c011

Browse files
connorsheaSysix
andauthored
fix: Migrate globals for node and browser even if they aren't perfect matches. (#243)
* fix: warning and error were swapped in rule severity normalization. Fixes #241. * chore: Update tsgolint. * Add eslint-globals project to test the behavior of the globals field in ESLint configs. * Replace all ts-ignore comments with ts-expect-error comments * Fix the logic for env-matching so globals are correctly identified even with minor differences in versions. * Fix comment. --------- Co-authored-by: Alexander S. <sysix@sysix-coding.de>
1 parent c4a7dec commit da6c011

14 files changed

+248
-4393
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`eslint-globals > eslint-globals 1`] = `
4+
{
5+
"config": {
6+
"$schema": "./node_modules/oxlint/configuration_schema.json",
7+
"categories": {
8+
"correctness": "off",
9+
},
10+
"env": {
11+
"builtin": true,
12+
},
13+
"overrides": [
14+
{
15+
"env": {
16+
"browser": true,
17+
"commonjs": true,
18+
"es2026": true,
19+
"node": true,
20+
"shared-node-browser": true,
21+
},
22+
"files": [
23+
"**/*.js",
24+
"**/*.cjs",
25+
"**/*.mjs",
26+
],
27+
"rules": {
28+
"no-unused-vars": "error",
29+
},
30+
},
31+
],
32+
"plugins": [],
33+
},
34+
"warnings": [],
35+
}
36+
`;
37+
38+
exports[`eslint-globals --js-plugins > eslint-globals--js-plugins 1`] = `
39+
{
40+
"config": {
41+
"$schema": "./node_modules/oxlint/configuration_schema.json",
42+
"categories": {
43+
"correctness": "off",
44+
},
45+
"env": {
46+
"builtin": true,
47+
},
48+
"overrides": [
49+
{
50+
"env": {
51+
"browser": true,
52+
"commonjs": true,
53+
"es2026": true,
54+
"node": true,
55+
"shared-node-browser": true,
56+
},
57+
"files": [
58+
"**/*.js",
59+
"**/*.cjs",
60+
"**/*.mjs",
61+
],
62+
"rules": {
63+
"no-unused-vars": "error",
64+
},
65+
},
66+
],
67+
"plugins": [],
68+
},
69+
"warnings": [],
70+
}
71+
`;
72+
73+
exports[`eslint-globals --type-aware > eslint-globals--type-aware 1`] = `
74+
{
75+
"config": {
76+
"$schema": "./node_modules/oxlint/configuration_schema.json",
77+
"categories": {
78+
"correctness": "off",
79+
},
80+
"env": {
81+
"builtin": true,
82+
},
83+
"overrides": [
84+
{
85+
"env": {
86+
"browser": true,
87+
"commonjs": true,
88+
"es2026": true,
89+
"node": true,
90+
"shared-node-browser": true,
91+
},
92+
"files": [
93+
"**/*.js",
94+
"**/*.cjs",
95+
"**/*.mjs",
96+
],
97+
"rules": {
98+
"no-unused-vars": "error",
99+
},
100+
},
101+
],
102+
"plugins": [],
103+
},
104+
"warnings": [],
105+
}
106+
`;
107+
108+
exports[`eslint-globals merge > eslint-globals--merge 1`] = `
109+
{
110+
"config": {
111+
"$schema": "./node_modules/oxlint/configuration_schema.json",
112+
"categories": {
113+
"correctness": "error",
114+
"perf": "error",
115+
},
116+
"env": {
117+
"builtin": true,
118+
},
119+
"overrides": [
120+
{
121+
"env": {
122+
"browser": true,
123+
"commonjs": true,
124+
"es2026": true,
125+
"node": true,
126+
"shared-node-browser": true,
127+
},
128+
"files": [
129+
"**/*.js",
130+
"**/*.cjs",
131+
"**/*.mjs",
132+
],
133+
"rules": {
134+
"no-unused-vars": "error",
135+
},
136+
},
137+
],
138+
},
139+
"warnings": [],
140+
}
141+
`;

0 commit comments

Comments
 (0)