Lint rule to ban __dirname and __filename #224
Labels
priority: p3/standard
Enhancement with nominal value or bug with nominal impact
scope: eslint-plugin
size: sm
type: enhancement
New feature or request
Describe your idea
Add a lint rule that bans usage of __dirname and __filename (ideally, just in ESM scope)
Motivation
These globals are not defined in ESM scope. Something like
url.fileURLToPath(import.meta.url)
/path.dirname(url.fileURLToPath(import.meta.url))
or a construction likepath.fileURLToPath('relative/path', import.meta.url)
should be used insteadProposed Solution
Maybe adding additional configuration to no-restricted-globals? This would prevent usage in non-transpiled CJS projects though
Other Information
No response
The text was updated successfully, but these errors were encountered: