Skip to content

Commit fc8a4ec

Browse files
authored
💥Update node/no-unsupported-features/node-builtins to recognize new buffer features (#263)
1 parent 9fd68e4 commit fc8a4ec

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const trackMap = {
5252
kMaxLength: { [READ]: { supported: "3.0.0" } },
5353
transcode: { [READ]: { supported: "7.1.0" } },
5454
constants: { [READ]: { supported: "8.2.0" } },
55+
Blob: { [READ]: { supported: null, experimental: "15.7.0" } },
5556
},
5657
child_process: {
5758
ChildProcess: { [READ]: { supported: "2.2.0" } },

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,14 @@ new RuleTester({
959959
{ version: "7.0.9", ignores: ["buffer.transcode"] },
960960
],
961961
},
962+
{
963+
code: "const { Blob } = require('buffer'); new Blob();",
964+
options: [{ version: "15.7.0", ignores: ["buffer.Blob"] }],
965+
},
966+
{
967+
code: "import buffer from 'buffer'; new buffer.Blob();",
968+
options: [{ version: "15.7.0", ignores: ["buffer.Blob"] }],
969+
},
962970
],
963971
invalid: [
964972
{
@@ -1172,6 +1180,34 @@ new RuleTester({
11721180
},
11731181
],
11741182
},
1183+
{
1184+
code: "const { Blob } = require('buffer'); new Blob();",
1185+
options: [{ version: "15.7.0" }],
1186+
errors: [
1187+
{
1188+
messageId: "unsupported",
1189+
data: {
1190+
name: "buffer.Blob",
1191+
supported: "(none yet)",
1192+
version: "15.7.0",
1193+
},
1194+
},
1195+
],
1196+
},
1197+
{
1198+
code: "import buffer from 'buffer'; new buffer.Blob();",
1199+
options: [{ version: "15.7.0" }],
1200+
errors: [
1201+
{
1202+
messageId: "unsupported",
1203+
data: {
1204+
name: "buffer.Blob",
1205+
supported: "(none yet)",
1206+
version: "15.7.0",
1207+
},
1208+
},
1209+
],
1210+
},
11751211
],
11761212
},
11771213

0 commit comments

Comments
 (0)