Skip to content

Commit 050d544

Browse files
committed
chore(eslint-local-rules): update process for requiring modules
1 parent fc3e514 commit 050d544

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

eslint-local-rules.cjs

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ const path = require('node:path')
44
const glob = require('glob')
55

66
module.exports = Object.fromEntries(
7-
glob.sync('./scripts/rules/*', { cwd: __dirname, dotRelative: true }).map(name => (
8-
[path.parse(name).name, require(name).default]
9-
))
7+
glob.sync('./scripts/rules/*', { cwd: __dirname, dotRelative: true }).map(name => {
8+
const modulePath = path.resolve(__dirname, name)
9+
const module = require(modulePath)
10+
return [path.parse(name).name, module.default || module]
11+
})
1012
)

0 commit comments

Comments
 (0)