forked from mysticatea/eslint-plugin-node
-
-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Labels
Description
Rule details
Prefer use process.getBuiltinModule() to get modules instead of await import() and require()
What type of rule is this?
Suggests an alternate way of doing something
Example code
// ❌
const fs = await import('node:fs')
// ✅
const fs = process.getBuiltinModule('node:fs')// ❌
function foo() {
const fs = require('node:fs')
}
// ✅
function foo() {
const fs = process.getBuiltinModule('node:fs')
}Participation
- I am willing to submit a pull request to implement this rule.
Additional comments
I don't use require() now, the import() case is only I need.