Skip to content

Commit

Permalink
fix(prefer-node-protocol): continue on version range check (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Mar 20, 2024
1 parent caab777 commit 14d2ea9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/prefer-node-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ module.exports = {
"Program:exit"() {
for (const { node, moduleStyle } of targets) {
if (!isEnablingThisRule(context, moduleStyle)) {
return
continue
}

if (node.type === "TemplateLiteral") {
Expand Down
12 changes: 12 additions & 0 deletions tests/lib/rules/prefer-node-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,17 @@ new RuleTester({
output: 'const fs = require("node:fs");',
errors: ["Prefer `node:fs` over `fs`."],
},
{
options: [{ version: "12.20.0" }],
code: `
const fs = require("fs");
import buffer from 'buffer'
`,
output: `
const fs = require("fs");
import buffer from 'node:buffer'
`,
errors: ["Prefer `node:buffer` over `buffer`."],
},
],
})

0 comments on commit 14d2ea9

Please sign in to comment.