Support `import.meta.dirname` and `import.meta.filename` in `prefer-module` rule
sindresorhus opened this issue · comments
Sindre Sorhus commented
- Replace
__dirname
and__filename
with them. - Replace
const __dirname = path.dirname(fileURLToPath(import.meta.url));
with them.
Carlos Santos commented
Are you considering adding this as an option? Given that many projects are still running on the previous LTS version and libraries support older versions, this change would break their code
Sindre Sorhus commented
I think we can just wait until we can target Node.js 20 (in April).
Carlos Santos commented
Perfect. I could work on this :). Also, I would consider replacing this pattern:
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Federico Brigante commented
fisker Cheung commented
This not implemented
Replace const __dirname = path.dirname(fileURLToPath(import.meta.url)); with them.