Skip to content

Commit 5d1cb98

Browse files
authoredJan 29, 2024
chore: Merge supported and backport properties (#177)
1 parent 17e658e commit 5d1cb98

File tree

4 files changed

+567
-573
lines changed

4 files changed

+567
-573
lines changed
 

‎lib/rules/no-unsupported-features/es-builtins.js

+368-368
Large diffs are not rendered by default.

‎lib/rules/no-unsupported-features/node-builtins.js

+172-176
Original file line numberDiff line numberDiff line change
@@ -16,189 +16,186 @@ const extendTrackMapWithNodePrefix = require("../../util/extend-trackmap-with-no
1616
const trackMap = {
1717
globals: {
1818
queueMicrotask: {
19-
[READ]: { supported: "12.0.0", experimental: "11.0.0" },
19+
[READ]: { supported: ["12.0.0"], experimental: "11.0.0" },
2020
},
2121
require: {
2222
resolve: {
23-
paths: { [READ]: { supported: "8.9.0" } },
23+
paths: { [READ]: { supported: ["8.9.0"] } },
2424
},
2525
},
2626
},
2727
modules: {
2828
assert: {
2929
strict: {
30-
[READ]: { supported: "9.9.0", backported: ["8.13.0"] },
31-
doesNotReject: { [READ]: { supported: "10.0.0" } },
32-
rejects: { [READ]: { supported: "10.0.0" } },
33-
},
34-
deepStrictEqual: { [READ]: { supported: "4.0.0" } },
35-
doesNotReject: { [READ]: { supported: "10.0.0" } },
36-
notDeepStrictEqual: { [READ]: { supported: "4.0.0" } },
37-
rejects: { [READ]: { supported: "10.0.0" } },
30+
[READ]: { supported: ["9.9.0", "8.13.0"] },
31+
doesNotReject: { [READ]: { supported: ["10.0.0"] } },
32+
rejects: { [READ]: { supported: ["10.0.0"] } },
33+
},
34+
deepStrictEqual: { [READ]: { supported: ["4.0.0"] } },
35+
doesNotReject: { [READ]: { supported: ["10.0.0"] } },
36+
notDeepStrictEqual: { [READ]: { supported: ["4.0.0"] } },
37+
rejects: { [READ]: { supported: ["10.0.0"] } },
3838
CallTracker: {
3939
[READ]: { supported: null, experimental: "14.2.0" },
4040
},
4141
},
4242
async_hooks: {
43-
[READ]: { supported: "8.0.0" },
44-
createHook: { [READ]: { supported: "8.1.0" } },
43+
[READ]: { supported: ["8.0.0"] },
44+
createHook: { [READ]: { supported: ["8.1.0"] } },
4545
AsyncLocalStorage: {
46-
[READ]: { supported: "13.10.0", backported: ["12.17.0"] },
46+
[READ]: { supported: ["13.10.0", "12.17.0"] },
4747
},
4848
},
4949
buffer: {
5050
Buffer: {
51-
alloc: { [READ]: { supported: "4.5.0" } },
52-
allocUnsafe: { [READ]: { supported: "4.5.0" } },
53-
allocUnsafeSlow: { [READ]: { supported: "4.5.0" } },
54-
from: { [READ]: { supported: "4.5.0" } },
55-
},
56-
kMaxLength: { [READ]: { supported: "3.0.0" } },
57-
transcode: { [READ]: { supported: "7.1.0" } },
58-
constants: { [READ]: { supported: "8.2.0" } },
51+
alloc: { [READ]: { supported: ["4.5.0"] } },
52+
allocUnsafe: { [READ]: { supported: ["4.5.0"] } },
53+
allocUnsafeSlow: { [READ]: { supported: ["4.5.0"] } },
54+
from: { [READ]: { supported: ["4.5.0"] } },
55+
},
56+
kMaxLength: { [READ]: { supported: ["3.0.0"] } },
57+
transcode: { [READ]: { supported: ["7.1.0"] } },
58+
constants: { [READ]: { supported: ["8.2.0"] } },
5959
Blob: { [READ]: { supported: null, experimental: "15.7.0" } },
6060
},
6161
child_process: {
62-
ChildProcess: { [READ]: { supported: "2.2.0" } },
62+
ChildProcess: { [READ]: { supported: ["2.2.0"] } },
6363
},
6464
console: {
65-
clear: { [READ]: { supported: "8.3.0", backported: ["6.13.0"] } },
66-
count: { [READ]: { supported: "8.3.0", backported: ["6.13.0"] } },
65+
clear: { [READ]: { supported: ["8.3.0", "6.13.0"] } },
66+
count: { [READ]: { supported: ["8.3.0", "6.13.0"] } },
6767
countReset: {
68-
[READ]: { supported: "8.3.0", backported: ["6.13.0"] },
69-
},
70-
debug: { [READ]: { supported: "8.0.0" } },
71-
dirxml: { [READ]: { supported: "8.0.0" } },
72-
group: { [READ]: { supported: "8.5.0" } },
73-
groupCollapsed: { [READ]: { supported: "8.5.0" } },
74-
groupEnd: { [READ]: { supported: "8.5.0" } },
75-
table: { [READ]: { supported: "10.0.0" } },
76-
markTimeline: { [READ]: { supported: "8.0.0" } },
77-
profile: { [READ]: { supported: "8.0.0" } },
78-
profileEnd: { [READ]: { supported: "8.0.0" } },
79-
timeLog: { [READ]: { supported: "10.7.0" } },
80-
timeStamp: { [READ]: { supported: "8.0.0" } },
81-
timeline: { [READ]: { supported: "8.0.0" } },
82-
timelineEnd: { [READ]: { supported: "8.0.0" } },
68+
[READ]: { supported: ["8.3.0", "6.13.0"] },
69+
},
70+
debug: { [READ]: { supported: ["8.0.0"] } },
71+
dirxml: { [READ]: { supported: ["8.0.0"] } },
72+
group: { [READ]: { supported: ["8.5.0"] } },
73+
groupCollapsed: { [READ]: { supported: ["8.5.0"] } },
74+
groupEnd: { [READ]: { supported: ["8.5.0"] } },
75+
table: { [READ]: { supported: ["10.0.0"] } },
76+
markTimeline: { [READ]: { supported: ["8.0.0"] } },
77+
profile: { [READ]: { supported: ["8.0.0"] } },
78+
profileEnd: { [READ]: { supported: ["8.0.0"] } },
79+
timeLog: { [READ]: { supported: ["10.7.0"] } },
80+
timeStamp: { [READ]: { supported: ["8.0.0"] } },
81+
timeline: { [READ]: { supported: ["8.0.0"] } },
82+
timelineEnd: { [READ]: { supported: ["8.0.0"] } },
8383
},
8484
crypto: {
8585
Certificate: {
86-
exportChallenge: { [READ]: { supported: "9.0.0" } },
87-
exportPublicKey: { [READ]: { supported: "9.0.0" } },
88-
verifySpkac: { [READ]: { supported: "9.0.0" } },
89-
},
90-
ECDH: { [READ]: { supported: "8.8.0", backported: ["6.13.0"] } },
91-
KeyObject: { [READ]: { supported: "11.6.0" } },
92-
createPrivateKey: { [READ]: { supported: "11.6.0" } },
93-
createPublicKey: { [READ]: { supported: "11.6.0" } },
94-
createSecretKey: { [READ]: { supported: "11.6.0" } },
95-
constants: { [READ]: { supported: "6.3.0" } },
96-
fips: { [READ]: { supported: "6.0.0" } },
97-
generateKeyPair: { [READ]: { supported: "10.12.0" } },
98-
generateKeyPairSync: { [READ]: { supported: "10.12.0" } },
99-
getCurves: { [READ]: { supported: "2.3.0" } },
100-
getFips: { [READ]: { supported: "10.0.0" } },
101-
privateEncrypt: { [READ]: { supported: "1.1.0" } },
102-
publicDecrypt: { [READ]: { supported: "1.1.0" } },
86+
exportChallenge: { [READ]: { supported: ["9.0.0"] } },
87+
exportPublicKey: { [READ]: { supported: ["9.0.0"] } },
88+
verifySpkac: { [READ]: { supported: ["9.0.0"] } },
89+
},
90+
ECDH: { [READ]: { supported: ["8.8.0", "6.13.0"] } },
91+
KeyObject: { [READ]: { supported: ["11.6.0"] } },
92+
createPrivateKey: { [READ]: { supported: ["11.6.0"] } },
93+
createPublicKey: { [READ]: { supported: ["11.6.0"] } },
94+
createSecretKey: { [READ]: { supported: ["11.6.0"] } },
95+
constants: { [READ]: { supported: ["6.3.0"] } },
96+
fips: { [READ]: { supported: ["6.0.0"] } },
97+
generateKeyPair: { [READ]: { supported: ["10.12.0"] } },
98+
generateKeyPairSync: { [READ]: { supported: ["10.12.0"] } },
99+
getCurves: { [READ]: { supported: ["2.3.0"] } },
100+
getFips: { [READ]: { supported: ["10.0.0"] } },
101+
privateEncrypt: { [READ]: { supported: ["1.1.0"] } },
102+
publicDecrypt: { [READ]: { supported: ["1.1.0"] } },
103103
randomFillSync: {
104-
[READ]: { supported: "7.10.0", backported: ["6.13.0"] },
104+
[READ]: { supported: ["7.10.0", "6.13.0"] },
105105
},
106106
randomFill: {
107-
[READ]: { supported: "7.10.0", backported: ["6.13.0"] },
108-
},
109-
scrypt: { [READ]: { supported: "10.5.0" } },
110-
scryptSync: { [READ]: { supported: "10.5.0" } },
111-
setFips: { [READ]: { supported: "10.0.0" } },
112-
sign: { [READ]: { supported: "12.0.0" } },
113-
timingSafeEqual: { [READ]: { supported: "6.6.0" } },
114-
verify: { [READ]: { supported: "12.0.0" } },
107+
[READ]: { supported: ["7.10.0", "6.13.0"] },
108+
},
109+
scrypt: { [READ]: { supported: ["10.5.0"] } },
110+
scryptSync: { [READ]: { supported: ["10.5.0"] } },
111+
setFips: { [READ]: { supported: ["10.0.0"] } },
112+
sign: { [READ]: { supported: ["12.0.0"] } },
113+
timingSafeEqual: { [READ]: { supported: ["6.6.0"] } },
114+
verify: { [READ]: { supported: ["12.0.0"] } },
115115
},
116116
dns: {
117-
Resolver: { [READ]: { supported: "8.3.0" } },
118-
resolvePtr: { [READ]: { supported: "6.0.0" } },
117+
Resolver: { [READ]: { supported: ["8.3.0"] } },
118+
resolvePtr: { [READ]: { supported: ["6.0.0"] } },
119119
promises: {
120120
[READ]: {
121-
supported: "11.14.0",
122-
backported: ["10.17.0"],
121+
supported: ["11.14.0", "10.17.0"],
123122
experimental: "10.6.0",
124123
},
125124
},
126125
},
127126
events: {
128127
EventEmitter: {
129128
once: {
130-
[READ]: { supported: "11.13.0", backported: ["10.16.0"] },
129+
[READ]: { supported: ["11.13.0", "10.16.0"] },
131130
},
132131
},
133-
once: { [READ]: { supported: "11.13.0", backported: ["10.16.0"] } },
132+
once: { [READ]: { supported: ["11.13.0", "10.16.0"] } },
134133
},
135134
fs: {
136-
Dirent: { [READ]: { supported: "10.10.0" } },
137-
copyFile: { [READ]: { supported: "8.5.0" } },
138-
copyFileSync: { [READ]: { supported: "8.5.0" } },
139-
mkdtemp: { [READ]: { supported: "5.10.0" } },
140-
mkdtempSync: { [READ]: { supported: "5.10.0" } },
135+
Dirent: { [READ]: { supported: ["10.10.0"] } },
136+
copyFile: { [READ]: { supported: ["8.5.0"] } },
137+
copyFileSync: { [READ]: { supported: ["8.5.0"] } },
138+
mkdtemp: { [READ]: { supported: ["5.10.0"] } },
139+
mkdtempSync: { [READ]: { supported: ["5.10.0"] } },
141140
realpath: {
142-
native: { [READ]: { supported: "9.2.0" } },
141+
native: { [READ]: { supported: ["9.2.0"] } },
143142
},
144143
realpathSync: {
145-
native: { [READ]: { supported: "9.2.0" } },
144+
native: { [READ]: { supported: ["9.2.0"] } },
146145
},
147146
promises: {
148147
[READ]: {
149-
supported: "11.14.0",
150-
backported: ["10.17.0"],
148+
supported: ["11.14.0", "10.17.0"],
151149
experimental: "10.1.0",
152150
},
153151
},
154-
writev: { [READ]: { supported: "12.9.0" } },
155-
writevSync: { [READ]: { supported: "12.9.0" } },
152+
writev: { [READ]: { supported: ["12.9.0"] } },
153+
writevSync: { [READ]: { supported: ["12.9.0"] } },
156154
readv: {
157-
[READ]: { supported: "13.13.0", backported: ["12.17.0"] },
155+
[READ]: { supported: ["13.13.0", "12.17.0"] },
158156
},
159157
readvSync: {
160-
[READ]: { supported: "13.13.0", backported: ["12.17.0"] },
158+
[READ]: { supported: ["13.13.0", "12.17.0"] },
161159
},
162160
lutimes: {
163-
[READ]: { supported: "14.5.0", backported: ["12.19.0"] },
161+
[READ]: { supported: ["14.5.0", "12.19.0"] },
164162
},
165163
lutimesSync: {
166-
[READ]: { supported: "14.5.0", backported: ["12.19.0"] },
164+
[READ]: { supported: ["14.5.0", "12.19.0"] },
167165
},
168166
opendir: {
169-
[READ]: { supported: "12.12.0" },
167+
[READ]: { supported: ["12.12.0"] },
170168
},
171169
opendirSync: {
172-
[READ]: { supported: "12.12.0" },
170+
[READ]: { supported: ["12.12.0"] },
173171
},
174172
rm: {
175-
[READ]: { supported: "14.14.0" },
173+
[READ]: { supported: ["14.14.0"] },
176174
},
177175
rmSync: {
178-
[READ]: { supported: "14.14.0" },
176+
[READ]: { supported: ["14.14.0"] },
179177
},
180178
read: {
181-
[READ]: { supported: "13.11.0", backported: ["12.17.0"] },
179+
[READ]: { supported: ["13.11.0", "12.17.0"] },
182180
},
183181
readSync: {
184-
[READ]: { supported: "13.11.0", backported: ["12.17.0"] },
182+
[READ]: { supported: ["13.11.0", "12.17.0"] },
185183
},
186184
Dir: {
187-
[READ]: { supported: "12.12.0" },
185+
[READ]: { supported: ["12.12.0"] },
188186
},
189187
StatWatcher: {
190-
[READ]: { supported: "14.3.0", backported: ["12.20.0"] },
188+
[READ]: { supported: ["14.3.0", "12.20.0"] },
191189
},
192190
},
193191
"fs/promises": {
194192
[READ]: {
195-
supported: "14.0.0",
193+
supported: ["14.0.0"],
196194
},
197195
},
198196
http2: {
199197
[READ]: {
200-
supported: "10.10.0",
201-
backported: ["8.13.0"],
198+
supported: ["10.10.0", "8.13.0"],
202199
experimental: "8.4.0",
203200
},
204201
},
@@ -209,162 +206,161 @@ const trackMap = {
209206
Module: {
210207
builtinModules: {
211208
[READ]: {
212-
supported: "9.3.0",
213-
backported: ["6.13.0", "8.10.0"],
209+
supported: ["9.3.0", "6.13.0", "8.10.0"],
214210
},
215211
},
216-
createRequireFromPath: { [READ]: { supported: "10.12.0" } },
217-
createRequire: { [READ]: { supported: "12.2.0" } },
218-
syncBuiltinESMExports: { [READ]: { supported: "12.12.0" } },
212+
createRequireFromPath: { [READ]: { supported: ["10.12.0"] } },
213+
createRequire: { [READ]: { supported: ["12.2.0"] } },
214+
syncBuiltinESMExports: { [READ]: { supported: ["12.12.0"] } },
219215
},
220216
builtinModules: {
221217
[READ]: {
222-
supported: "9.3.0",
223-
backported: ["6.13.0", "8.10.0"],
218+
supported: ["9.3.0", "6.13.0", "8.10.0"],
224219
},
225220
},
226-
createRequireFromPath: { [READ]: { supported: "10.12.0" } },
227-
createRequire: { [READ]: { supported: "12.2.0" } },
228-
syncBuiltinESMExports: { [READ]: { supported: "12.12.0" } },
221+
createRequireFromPath: { [READ]: { supported: ["10.12.0"] } },
222+
createRequire: { [READ]: { supported: ["12.2.0"] } },
223+
syncBuiltinESMExports: { [READ]: { supported: ["12.12.0"] } },
229224
},
230225
os: {
231226
constants: {
232-
[READ]: { supported: "6.3.0" },
233-
priority: { [READ]: { supported: "10.10.0" } },
227+
[READ]: { supported: ["6.3.0"] },
228+
priority: { [READ]: { supported: ["10.10.0"] } },
234229
},
235-
getPriority: { [READ]: { supported: "10.10.0" } },
236-
homedir: { [READ]: { supported: "2.3.0" } },
237-
setPriority: { [READ]: { supported: "10.10.0" } },
238-
userInfo: { [READ]: { supported: "6.0.0" } },
230+
getPriority: { [READ]: { supported: ["10.10.0"] } },
231+
homedir: { [READ]: { supported: ["2.3.0"] } },
232+
setPriority: { [READ]: { supported: ["10.10.0"] } },
233+
userInfo: { [READ]: { supported: ["6.0.0"] } },
239234
},
240235
path: {
241-
toNamespacedPath: { [READ]: { supported: "9.0.0" } },
236+
toNamespacedPath: { [READ]: { supported: ["9.0.0"] } },
242237
},
243238
perf_hooks: {
244-
[READ]: { supported: "8.5.0" },
245-
monitorEventLoopDelay: { [READ]: { supported: "11.10.0" } },
239+
[READ]: { supported: ["8.5.0"] },
240+
monitorEventLoopDelay: { [READ]: { supported: ["11.10.0"] } },
246241
},
247242
process: {
248-
allowedNodeEnvironmentFlags: { [READ]: { supported: "10.10.0" } },
249-
argv0: { [READ]: { supported: "6.4.0" } },
250-
channel: { [READ]: { supported: "7.1.0" } },
251-
cpuUsage: { [READ]: { supported: "6.1.0" } },
252-
emitWarning: { [READ]: { supported: "6.0.0" } },
253-
getegid: { [READ]: { supported: "2.0.0" } },
254-
geteuid: { [READ]: { supported: "2.0.0" } },
243+
allowedNodeEnvironmentFlags: { [READ]: { supported: ["10.10.0"] } },
244+
argv0: { [READ]: { supported: ["6.4.0"] } },
245+
channel: { [READ]: { supported: ["7.1.0"] } },
246+
cpuUsage: { [READ]: { supported: ["6.1.0"] } },
247+
emitWarning: { [READ]: { supported: ["6.0.0"] } },
248+
getegid: { [READ]: { supported: ["2.0.0"] } },
249+
geteuid: { [READ]: { supported: ["2.0.0"] } },
255250
hasUncaughtExceptionCaptureCallback: {
256-
[READ]: { supported: "9.3.0" },
251+
[READ]: { supported: ["9.3.0"] },
257252
},
258253
hrtime: {
259-
bigint: { [READ]: { supported: "10.7.0" } },
254+
bigint: { [READ]: { supported: ["10.7.0"] } },
260255
},
261256
ppid: {
262257
[READ]: {
263-
supported: "9.2.0",
264-
backported: ["6.13.0", "8.10.0"],
258+
supported: ["9.2.0", "6.13.0", "8.10.0"],
265259
},
266260
},
267-
release: { [READ]: { supported: "3.0.0" } },
268-
report: { [READ]: { supported: "14.0.0", experimental: "11.8.0" } },
269-
resourceUsage: { [READ]: { supported: "12.6.0" } },
270-
setegid: { [READ]: { supported: "2.0.0" } },
271-
seteuid: { [READ]: { supported: "2.0.0" } },
261+
release: { [READ]: { supported: ["3.0.0"] } },
262+
report: {
263+
[READ]: { supported: ["14.0.0"], experimental: "11.8.0" },
264+
},
265+
resourceUsage: { [READ]: { supported: ["12.6.0"] } },
266+
setegid: { [READ]: { supported: ["2.0.0"] } },
267+
seteuid: { [READ]: { supported: ["2.0.0"] } },
272268
setUncaughtExceptionCaptureCallback: {
273-
[READ]: { supported: "9.3.0" },
269+
[READ]: { supported: ["9.3.0"] },
274270
},
275271
stdout: {
276-
getColorDepth: { [READ]: { supported: "9.9.0" } },
277-
hasColor: { [READ]: { supported: "11.13.0" } },
272+
getColorDepth: { [READ]: { supported: ["9.9.0"] } },
273+
hasColor: { [READ]: { supported: ["11.13.0"] } },
278274
},
279275
stderr: {
280-
getColorDepth: { [READ]: { supported: "9.9.0" } },
281-
hasColor: { [READ]: { supported: "11.13.0" } },
276+
getColorDepth: { [READ]: { supported: ["9.9.0"] } },
277+
hasColor: { [READ]: { supported: ["11.13.0"] } },
282278
},
283279
},
284280
stream: {
285281
Readable: {
286282
from: {
287-
[READ]: { supported: "12.3.0", backported: ["10.17.0"] },
283+
[READ]: { supported: ["12.3.0", "10.17.0"] },
288284
},
289285
},
290-
finished: { [READ]: { supported: "10.0.0" } },
291-
pipeline: { [READ]: { supported: "10.0.0" } },
286+
finished: { [READ]: { supported: ["10.0.0"] } },
287+
pipeline: { [READ]: { supported: ["10.0.0"] } },
292288
},
293289
trace_events: {
294-
[READ]: { supported: "10.0.0" },
290+
[READ]: { supported: ["10.0.0"] },
295291
},
296292
url: {
297-
URL: { [READ]: { supported: "7.0.0", backported: ["6.13.0"] } },
293+
URL: { [READ]: { supported: ["7.0.0", "6.13.0"] } },
298294
URLSearchParams: {
299-
[READ]: { supported: "7.5.0", backported: ["6.13.0"] },
295+
[READ]: { supported: ["7.5.0", "6.13.0"] },
300296
},
301-
domainToASCII: { [READ]: { supported: "7.4.0" } },
302-
domainToUnicode: { [READ]: { supported: "7.4.0" } },
297+
domainToASCII: { [READ]: { supported: ["7.4.0"] } },
298+
domainToUnicode: { [READ]: { supported: ["7.4.0"] } },
303299
},
304300
util: {
305-
callbackify: { [READ]: { supported: "8.2.0" } },
306-
formatWithOptions: { [READ]: { supported: "10.0.0" } },
301+
callbackify: { [READ]: { supported: ["8.2.0"] } },
302+
formatWithOptions: { [READ]: { supported: ["10.0.0"] } },
307303
getSystemErrorName: {
308-
[READ]: { supported: "9.7.0", backported: ["8.12.0"] },
304+
[READ]: { supported: ["9.7.0", "8.12.0"] },
309305
},
310306
inspect: {
311-
custom: { [READ]: { supported: "6.6.0" } },
312-
defaultOptions: { [READ]: { supported: "6.4.0" } },
313-
replDefaults: { [READ]: { supported: "11.12.0" } },
307+
custom: { [READ]: { supported: ["6.6.0"] } },
308+
defaultOptions: { [READ]: { supported: ["6.4.0"] } },
309+
replDefaults: { [READ]: { supported: ["11.12.0"] } },
314310
},
315-
isDeepStrictEqual: { [READ]: { supported: "9.0.0" } },
316-
promisify: { [READ]: { supported: "8.0.0" } },
311+
isDeepStrictEqual: { [READ]: { supported: ["9.0.0"] } },
312+
promisify: { [READ]: { supported: ["8.0.0"] } },
317313
TextDecoder: {
318-
[READ]: { supported: "8.9.0", experimental: "8.3.0" },
314+
[READ]: { supported: ["8.9.0"], experimental: "8.3.0" },
319315
},
320316
TextEncoder: {
321-
[READ]: { supported: "8.9.0", experimental: "8.3.0" },
317+
[READ]: { supported: ["8.9.0"], experimental: "8.3.0" },
322318
},
323319
types: {
324-
[READ]: { supported: "10.0.0" },
325-
isBoxedPrimitive: { [READ]: { supported: "10.11.0" } },
320+
[READ]: { supported: ["10.0.0"] },
321+
isBoxedPrimitive: { [READ]: { supported: ["10.11.0"] } },
326322
},
327323
},
328324
v8: {
329-
[READ]: { supported: "1.0.0" },
330-
DefaultDeserializer: { [READ]: { supported: "8.0.0" } },
331-
DefaultSerializer: { [READ]: { supported: "8.0.0" } },
332-
Deserializer: { [READ]: { supported: "8.0.0" } },
333-
Serializer: { [READ]: { supported: "8.0.0" } },
334-
cachedDataVersionTag: { [READ]: { supported: "8.0.0" } },
335-
deserialize: { [READ]: { supported: "8.0.0" } },
336-
getHeapCodeStatistics: { [READ]: { supported: "12.8.0" } },
337-
getHeapSnapshot: { [READ]: { supported: "11.13.0" } },
338-
getHeapSpaceStatistics: { [READ]: { supported: "6.0.0" } },
339-
serialize: { [READ]: { supported: "8.0.0" } },
340-
writeHeapSnapshot: { [READ]: { supported: "11.13.0" } },
325+
[READ]: { supported: ["1.0.0"] },
326+
DefaultDeserializer: { [READ]: { supported: ["8.0.0"] } },
327+
DefaultSerializer: { [READ]: { supported: ["8.0.0"] } },
328+
Deserializer: { [READ]: { supported: ["8.0.0"] } },
329+
Serializer: { [READ]: { supported: ["8.0.0"] } },
330+
cachedDataVersionTag: { [READ]: { supported: ["8.0.0"] } },
331+
deserialize: { [READ]: { supported: ["8.0.0"] } },
332+
getHeapCodeStatistics: { [READ]: { supported: ["12.8.0"] } },
333+
getHeapSnapshot: { [READ]: { supported: ["11.13.0"] } },
334+
getHeapSpaceStatistics: { [READ]: { supported: ["6.0.0"] } },
335+
serialize: { [READ]: { supported: ["8.0.0"] } },
336+
writeHeapSnapshot: { [READ]: { supported: ["11.13.0"] } },
341337
},
342338
vm: {
343-
Module: { [READ]: { supported: "9.6.0" } },
344-
compileFunction: { [READ]: { supported: "10.10.0" } },
339+
Module: { [READ]: { supported: ["9.6.0"] } },
340+
compileFunction: { [READ]: { supported: ["10.10.0"] } },
345341
},
346342
worker_threads: {
347-
[READ]: { supported: "12.11.0", experimental: "10.5.0" },
343+
[READ]: { supported: ["12.11.0"], experimental: "10.5.0" },
348344
},
349345
},
350346
}
351347
Object.assign(trackMap.globals, {
352348
Buffer: trackMap.modules.buffer.Buffer,
353349
TextDecoder: {
354350
...trackMap.modules.util.TextDecoder,
355-
[READ]: { supported: "11.0.0" },
351+
[READ]: { supported: ["11.0.0"] },
356352
},
357353
TextEncoder: {
358354
...trackMap.modules.util.TextEncoder,
359-
[READ]: { supported: "11.0.0" },
355+
[READ]: { supported: ["11.0.0"] },
360356
},
361357
URL: {
362358
...trackMap.modules.url.URL,
363-
[READ]: { supported: "10.0.0" },
359+
[READ]: { supported: ["10.0.0"] },
364360
},
365361
URLSearchParams: {
366362
...trackMap.modules.url.URLSearchParams,
367-
[READ]: { supported: "10.0.0" },
363+
[READ]: { supported: ["10.0.0"] },
368364
},
369365
console: trackMap.modules.console,
370366
process: trackMap.modules.process,

‎lib/util/check-unsupported-builtins.js

+25-27
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
*/
55
"use strict"
66

7-
const { Range, lt, major } = require("semver") // eslint-disable-line no-unused-vars
7+
const { major, rsort } = require("semver")
88
const { ReferenceTracker } = require("@eslint-community/eslint-utils")
99
const getConfiguredNodeVersion = require("./get-configured-node-version")
1010
const getSemverRange = require("./get-semver-range")
1111
const unprefixNodeColon = require("./unprefix-node-colon")
1212

1313
/**
1414
* @typedef {Object} SupportInfo
15-
* @property {string | null} supported The stably supported version. If `null` is present, it hasn't been supported yet.
16-
* @property {string[]} [backported] The backported versions.
15+
* @property {string[]} supported The stably supported version. If `null` is present, it hasn't been supported yet.
1716
* @property {string} [experimental] The added version as experimental.
1817
*/
1918

@@ -35,43 +34,42 @@ function parseOptions(context) {
3534
* @param {SupportInfo} info The support info.
3635
* @param {Range} configured The configured version range.
3736
*/
38-
function isSupported({ backported, supported }, configured) {
39-
if (
40-
backported &&
41-
backported.length >= 2 &&
42-
!backported.every((v, i) => i === 0 || lt(backported[i - 1], v))
43-
) {
44-
throw new Error("Invalid BackportConfiguration")
45-
}
46-
47-
if (supported == null) {
37+
function isSupported({ supported }, configured) {
38+
if (supported == null || supported.length === 0) {
4839
return false
4940
}
50-
if (backported == null || backported.length === 0) {
51-
return !configured.intersects(getSemverRange(`<${supported}`))
52-
}
5341

54-
return !configured.intersects(
55-
getSemverRange(
56-
[...backported, supported]
57-
.map((v, i) => (i === 0 ? `<${v}` : `>=${major(v)}.0.0 <${v}`))
58-
.join(" || ")
59-
)
42+
const [latest] = rsort(supported)
43+
const range = getSemverRange(
44+
[
45+
...supported.map(
46+
version => `>= ${version} < ${major(version) + 1}`
47+
),
48+
`> ${major(latest)}`,
49+
].join("||")
6050
)
51+
52+
return configured.intersects(range)
6153
}
6254

6355
/**
6456
* Get the formatted text of a given supported version.
6557
* @param {SupportInfo} info The support info.
6658
*/
67-
function supportedVersionToString({ backported, supported }) {
68-
if (supported == null) {
59+
function supportedVersionToString({ supported }) {
60+
if (supported == null || supported.length === 0) {
6961
return "(none yet)"
7062
}
71-
if (backported == null || backported.length === 0) {
72-
return supported
63+
64+
const [latest, ...backported] = rsort(supported)
65+
66+
if (backported.length === 0) {
67+
return latest
7368
}
74-
return `${supported} (backported: ^${backported.join(", ^")})`
69+
70+
const backportString = backported.map(version => `^${version}`).join(", ")
71+
72+
return `${latest} (backported: ${backportString})`
7573
}
7674

7775
/**

‎tests/lib/rules/no-unsupported-features/node-builtins.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3441,7 +3441,7 @@ new RuleTester({ languageOptions: { sourceType: "module" } }).run(
34413441
data: {
34423442
name: "module.builtinModules",
34433443
supported:
3444-
"9.3.0 (backported: ^6.13.0, ^8.10.0)",
3444+
"9.3.0 (backported: ^8.10.0, ^6.13.0)",
34453445
version: "9.2.9",
34463446
},
34473447
},
@@ -4161,7 +4161,7 @@ new RuleTester({ languageOptions: { sourceType: "module" } }).run(
41614161
data: {
41624162
name: "process.ppid",
41634163
supported:
4164-
"9.2.0 (backported: ^6.13.0, ^8.10.0)",
4164+
"9.2.0 (backported: ^8.10.0, ^6.13.0)",
41654165
version: "9.1.9",
41664166
},
41674167
},

0 commit comments

Comments
 (0)
Please sign in to comment.