Skip to content

Commit 704f0b9

Browse files
scagoodaladdin-add
andauthoredMay 14, 2024··
fix(node-builtins): Remove "node:" prefix from "ignores" message (#277)
* fix: Remove "node:" prefix from "no-unsupported-features/node-builtins" message * docs: Remove enumeration in docs for no-unsupported-features/node-builtins * chore: Remove accidental `gi` * Update docs/rules/no-unsupported-features/node-builtins.md Co-authored-by: Sebastian Good <2230835+scagood@users.noreply.github.com> --------- Co-authored-by: 唯然 <weiran.zsd@outlook.com>
1 parent 4a685c0 commit 704f0b9

File tree

3 files changed

+20
-276
lines changed

3 files changed

+20
-276
lines changed
 

‎docs/rules/no-unsupported-features/node-builtins.md

+11-267
Original file line numberDiff line numberDiff line change
@@ -49,273 +49,17 @@ The `"allowExperimental"` option accepts a boolean value (the default value is `
4949
If you are using transpilers, maybe you want to ignore the warnings about some features.
5050
You can use this `ignores` option to ignore the given features.
5151

52-
The `"ignores"` option accepts an array of the following strings.
53-
54-
<details>
55-
56-
**Globals:**
57-
58-
- `"Buffer.alloc"`
59-
- `"Buffer.allocUnsafe"`
60-
- `"Buffer.allocUnsafeSlow"`
61-
- `"Buffer.from"`
62-
- `"TextDecoder"`
63-
- `"TextEncoder"`
64-
- `"URL"`
65-
- `"URLSearchParams"`
66-
- `"console.clear"`
67-
- `"console.count"`
68-
- `"console.countReset"`
69-
- `"console.debug"`
70-
- `"console.dirxml"`
71-
- `"console.group"`
72-
- `"console.groupCollapsed"`
73-
- `"console.groupEnd"`
74-
- `"console.table"`
75-
- `"console.markTimeline"`
76-
- `"console.profile"`
77-
- `"console.profileEnd"`
78-
- `"console.timeLog"`
79-
- `"console.timeStamp"`
80-
- `"console.timeline"`
81-
- `"console.timelineEnd"`
82-
- `"process.allowedNodeEnvironmentFlags"`
83-
- `"process.argv0"`
84-
- `"process.channel"`
85-
- `"process.cpuUsage"`
86-
- `"process.emitWarning"`
87-
- `"process.getegid"`
88-
- `"process.geteuid"`
89-
- `"process.hasUncaughtExceptionCaptureCallback"`
90-
- `"process.hrtime.bigint"`
91-
- `"process.ppid"`
92-
- `"process.release"`
93-
- `"process.report"`
94-
- `"process.setegid"`
95-
- `"process.seteuid"`
96-
- `"process.setUncaughtExceptionCaptureCallback"`
97-
- `"process.stdout.getColorDepth"`
98-
- `"process.stdout.hasColor"`
99-
- `"process.stderr.getColorDepth"`
100-
- `"process.stderr.hasColor"`
101-
- `"queueMicrotask"`
102-
- `"require.resolve.paths"`
103-
104-
**`assert` module:**
105-
106-
- `"assert.deepStrictEqual"`
107-
- `"assert.doesNotReject"`
108-
- `"assert.notDeepStrictEqual"`
109-
- `"assert.rejects"`
110-
- `"assert.strict"`
111-
- `"assert.strict.doesNotReject"`
112-
- `"assert.strict.rejects"`
113-
114-
**`async_hooks` module:**
115-
116-
- `"async_hooks"`
117-
- `"async_hooks.createHook"`
118-
119-
**`buffer` module:**
120-
121-
- `"buffer.Buffer.alloc"`
122-
- `"buffer.Buffer.allocUnsafe"`
123-
- `"buffer.Buffer.allocUnsafeSlow"`
124-
- `"buffer.Buffer.from"`
125-
- `"buffer.constants"`
126-
- `"buffer.kMaxLength"`
127-
- `"buffer.transcode"`
128-
129-
**`child_process` module:**
130-
131-
- `"child_process.ChildProcess"`
132-
133-
**`console` module:**
134-
135-
- `"console.clear"`
136-
- `"console.count"`
137-
- `"console.countReset"`
138-
- `"console.debug"`
139-
- `"console.dirxml"`
140-
- `"console.group"`
141-
- `"console.groupCollapsed"`
142-
- `"console.groupEnd"`
143-
- `"console.table"`
144-
- `"console.markTimeline"`
145-
- `"console.profile"`
146-
- `"console.profileEnd"`
147-
- `"console.timeLog"`
148-
- `"console.timeStamp"`
149-
- `"console.timeline"`
150-
- `"console.timelineEnd"`
151-
152-
**`crypto` module:**
153-
154-
- `"crypto.Certificate.exportChallenge"`
155-
- `"crypto.Certificate.exportPublicKey"`
156-
- `"crypto.Certificate.verifySpkac"`
157-
- `"crypto.KeyObject"`
158-
- `"crypto.createPrivateKey"`
159-
- `"crypto.createPublicKey"`
160-
- `"crypto.createSecretKey"`
161-
- `"crypto.constants"`
162-
- `"crypto.fips"`
163-
- `"crypto.generateKeyPair"`
164-
- `"crypto.generateKeyPairSync"`
165-
- `"crypto.getCurves"`
166-
- `"crypto.getFips"`
167-
- `"crypto.privateEncrypt"`
168-
- `"crypto.publicDecrypt"`
169-
- `"crypto.randomFillSync"`
170-
- `"crypto.randomFill"`
171-
- `"crypto.scrypt"`
172-
- `"crypto.scryptSync"`
173-
- `"crypto.setFips"`
174-
- `"crypto.sign"`
175-
- `"crypto.timingSafeEqual"`
176-
- `"crypto.verify"`
177-
178-
**`dns` module:**
179-
180-
- `"dns.Resolver"`
181-
- `"dns.resolvePtr"`
182-
- `"dns.promises"`
183-
184-
**`events` module:**
185-
186-
- `"events.EventEmitter.once"`
187-
- `"events.once"`
188-
189-
**`fs` module:**
190-
191-
- `"fs.Dirent"`
192-
- `"fs.copyFile"`
193-
- `"fs.copyFileSync"`
194-
- `"fs.mkdtemp"`
195-
- `"fs.mkdtempSync"`
196-
- `"fs.realpath.native"`
197-
- `"fs.realpathSync.native"`
198-
- `"fs.promises"`
199-
- `"fs.writev"`
200-
- `"fs.writevSync"`
201-
202-
**`http2` module:**
203-
204-
- `"http2"`
205-
206-
**`inspector` module:**
207-
208-
- `"inspector"`
209-
210-
**`module` module:**
211-
212-
- `"module.Module.builtinModules"`
213-
- `"module.Module.createRequireFromPath"`
214-
- `"module.Module.createRequire"`
215-
- `"module.Module.syncBuiltinESMExports"`
216-
- `"module.builtinModules"`
217-
- `"module.createRequireFromPath"`
218-
- `"module.createRequire"`
219-
- `"module.syncBuiltinESMExports"`
220-
221-
**`os` module:**
222-
223-
- `"os.constants"`
224-
- `"os.constants.priority"`
225-
- `"os.getPriority"`
226-
- `"os.homedir"`
227-
- `"os.setPriority"`
228-
- `"os.userInfo"`
229-
230-
**`path` module:**
231-
232-
- `"path.toNamespacedPath"`
233-
234-
**`perf_hooks` module:**
235-
236-
- `"perf_hooks"`
237-
- `"perf_hooks.monitorEventLoopDelay"`
238-
239-
**`process` module:**
240-
241-
- `"process.allowedNodeEnvironmentFlags"`
242-
- `"process.argv0"`
243-
- `"process.channel"`
244-
- `"process.cpuUsage"`
245-
- `"process.emitWarning"`
246-
- `"process.getegid"`
247-
- `"process.geteuid"`
248-
- `"process.hasUncaughtExceptionCaptureCallback"`
249-
- `"process.hrtime.bigint"`
250-
- `"process.ppid"`
251-
- `"process.release"`
252-
- `"process.report"`
253-
- `"process.resourceUsage"`
254-
- `"process.setegid"`
255-
- `"process.seteuid"`
256-
- `"process.setUncaughtExceptionCaptureCallback"`
257-
- `"process.stdout.getColorDepth"`
258-
- `"process.stdout.hasColor"`
259-
- `"process.stderr.getColorDepth"`
260-
- `"process.stderr.hasColor"`
261-
262-
**`stream` module:**
263-
264-
- `"stream.Readable.from"`
265-
- `"stream.finished"`
266-
- `"stream.pipeline"`
267-
268-
**`trace_events` module:**
269-
270-
- `"trace_events"`
271-
272-
**`url` module:**
273-
274-
- `"url.URL"`
275-
- `"url.URLSearchParams"`
276-
- `"url.domainToASCII"`
277-
- `"url.domainToUnicode"`
278-
279-
**`util` module:**
280-
281-
- `"util.callbackify"`
282-
- `"util.formatWithOptions"`
283-
- `"util.getSystemErrorName"`
284-
- `"util.inspect.custom"`
285-
- `"util.inspect.defaultOptions"`
286-
- `"util.inspect.replDefaults"`
287-
- `"util.isDeepStrictEqual"`
288-
- `"util.promisify"`
289-
- `"util.TextDecoder"`
290-
- `"util.TextEncoder"`
291-
- `"util.types"`
292-
- `"util.types.isBoxedPrimitive"`
293-
294-
**`v8` module:**
295-
296-
- `"v8"`
297-
- `"v8.DefaultDeserializer"`
298-
- `"v8.DefaultSerializer"`
299-
- `"v8.Deserializer"`
300-
- `"v8.Serializer"`
301-
- `"v8.cachedDataVersionTag"`
302-
- `"v8.deserialize"`
303-
- `"v8.getHeapCodeStatistics"`
304-
- `"v8.getHeapSnapshot"`
305-
- `"v8.getHeapSpaceStatistics"`
306-
- `"v8.serialize"`
307-
- `"v8.writeHeapSnapshot"`
308-
309-
**`vm` module:**
310-
311-
- `"vm.Module"`
312-
- `"vm.compileFunction"`
313-
314-
**`worker_threads` module:**
315-
316-
- `"worker_threads"`
317-
318-
</details>
52+
The `"ignores"` option accepts an array of strings.
53+
54+
> [!TIP]
55+
> You will see the following error messages:
56+
>
57+
> - `The '{{name}}' is not an experimental feature until Node.js {{version}}.`
58+
> - `The '{{name}}' is still an experimental feature and is not supported until Node.js {{version}}.`
59+
> - `The '{{name}}' is still an experimental feature`
60+
>
61+
> The "name" property is what you can use in your `ignores` array
62+
> You can find the full tree view of the list of the modules over in [lib/unsupported-features/node-builtins-modules](https://github.com/eslint-community/eslint-plugin-n/tree/HEAD/lib/unsupported-features/node-builtins-modules). and globals over in [lib/unsupported-features/node-globals.js](https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/lib/unsupported-features/node-globals.js)
31963
32064
### Shared Settings
32165

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ module.exports.checkUnsupportedBuiltins = function checkUnsupportedBuiltins(
113113
node,
114114
messageId: "not-experimental-till",
115115
data: {
116-
name: path.join("."),
116+
name: name,
117117
experimental: experimentalVersion,
118118
version: options.version.raw,
119119
},
@@ -132,7 +132,7 @@ module.exports.checkUnsupportedBuiltins = function checkUnsupportedBuiltins(
132132
node,
133133
messageId: "not-supported-till",
134134
data: {
135-
name: path.join("."),
135+
name: name,
136136
supported: supportedVersion,
137137
version: options.version.raw,
138138
},
@@ -144,7 +144,7 @@ module.exports.checkUnsupportedBuiltins = function checkUnsupportedBuiltins(
144144
node,
145145
messageId: "not-supported-yet",
146146
data: {
147-
name: path.join("."),
147+
name: name,
148148
version: options.version.raw,
149149
},
150150
})

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ new RuleTester({ languageOptions: { sourceType: "module" } }).run(
433433
{
434434
messageId: "not-supported-till",
435435
data: {
436-
name: "node:assert",
436+
name: "assert",
437437
supported: "14.13.1 (backported: ^12.20.0)",
438438
version: "3.9.9",
439439
},
@@ -447,7 +447,7 @@ new RuleTester({ languageOptions: { sourceType: "module" } }).run(
447447
{
448448
messageId: "not-supported-till",
449449
data: {
450-
name: "node:assert",
450+
name: "assert",
451451
supported: "14.13.1 (backported: ^12.20.0)",
452452
version: "3.9.9",
453453
},
@@ -626,7 +626,7 @@ new RuleTester({ languageOptions: { sourceType: "module" } }).run(
626626
{
627627
messageId: "not-supported-till",
628628
data: {
629-
name: "node:async_hooks",
629+
name: "async_hooks",
630630
supported: "16.4.0",
631631
version: "7.9.9",
632632
},
@@ -640,7 +640,7 @@ new RuleTester({ languageOptions: { sourceType: "module" } }).run(
640640
{
641641
messageId: "not-supported-till",
642642
data: {
643-
name: "node:async_hooks",
643+
name: "async_hooks",
644644
supported: "16.4.0",
645645
version: "7.9.9",
646646
},
@@ -2940,7 +2940,7 @@ new RuleTester({ languageOptions: { sourceType: "module" } }).run(
29402940
{
29412941
messageId: "not-supported-till",
29422942
data: {
2943-
name: "node:fs/promises",
2943+
name: "fs/promises",
29442944
supported: "14.13.1",
29452945
version: "13.14.0",
29462946
},
@@ -2954,7 +2954,7 @@ new RuleTester({ languageOptions: { sourceType: "module" } }).run(
29542954
{
29552955
messageId: "not-supported-till",
29562956
data: {
2957-
name: "node:fs/promises",
2957+
name: "fs/promises",
29582958
supported: "14.13.1",
29592959
version: "13.14.0",
29602960
},

0 commit comments

Comments
 (0)
Please sign in to comment.