Skip to content

Commit 14d2ea9

Browse files
authoredMar 20, 2024··
fix(prefer-node-protocol): continue on version range check (#206)
1 parent caab777 commit 14d2ea9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
 

‎lib/rules/prefer-node-protocol.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ module.exports = {
110110
"Program:exit"() {
111111
for (const { node, moduleStyle } of targets) {
112112
if (!isEnablingThisRule(context, moduleStyle)) {
113-
return
113+
continue
114114
}
115115

116116
if (node.type === "TemplateLiteral") {

‎tests/lib/rules/prefer-node-protocol.js

+12
Original file line numberDiff line numberDiff line change
@@ -228,5 +228,17 @@ new RuleTester({
228228
output: 'const fs = require("node:fs");',
229229
errors: ["Prefer `node:fs` over `fs`."],
230230
},
231+
{
232+
options: [{ version: "12.20.0" }],
233+
code: `
234+
const fs = require("fs");
235+
import buffer from 'buffer'
236+
`,
237+
output: `
238+
const fs = require("fs");
239+
import buffer from 'node:buffer'
240+
`,
241+
errors: ["Prefer `node:buffer` over `buffer`."],
242+
},
231243
],
232244
})

0 commit comments

Comments
 (0)
Please sign in to comment.