Skip to content

Commit

Permalink
fix: prefer-node-protocol: not first target (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser authored Mar 20, 2024
1 parent 8327d11 commit caab777
Show file tree
Hide file tree
Showing 2 changed files with 12 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 @@ -124,7 +124,7 @@ module.exports = {
!isBuiltinModule(value) ||
!isBuiltinModule(`node:${value}`)
) {
return
continue
}

context.report({
Expand Down
11 changes: 11 additions & 0 deletions tests/lib/rules/prefer-node-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ new RuleTester({
output: "const fs = require('node:fs/promises')",
errors: ["Prefer `node:fs/promises` over `fs/promises`."],
},
{
code: `
const express = require('express');
const fs = require('fs/promises');
`,
output: `
const express = require('express');
const fs = require('node:fs/promises');
`,
errors: ["Prefer `node:fs/promises` over `fs/promises`."],
},

// check enabling by supported Node.js versions
{
Expand Down

0 comments on commit caab777

Please sign in to comment.