-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: remove redundant assignments & use "createRequire" #437
Conversation
Redundant Assignments: These lines are no longer needed because these fields are added by `createRule` function when the rules are initialized ``` rule.meta.docs.ruleName = ruleName rule.meta.docs.ruleId = ruleId ``` Make it more ES module by using `createRequire`: - No longer suppress the ESLint, the ESLint was warned for using `require` in a ts file. [@typescript-eslint/no-require-imports](https://typescript-eslint.io/rules/no-require-imports)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I don't quite understand it. What is the difference between |
Ah yes, let me clear this out:
👉 These changes will remove a lot of complexity and simplify this package. |
There's no problem with adding |
Dear @ota-meshi, it's removable, to illustrate this better, I just created #438, the |
Redundant Assignments:
These lines are no longer needed because these fields are added by
createRule
function when the rules are initializedMake it more ES module by using
createRequire
:require
in a ts file. @typescript-eslint/no-require-importsPoints to discuss:
Dear @ota-meshi, I think it's better to abandon this file and create an index file in the
src/rules
module:To take a step forward in making this package compatible with Bun/Deno
ESModule import loads modules asynchronously behind the scenes, so it’s faster than using this module loader, the rules files will be loaded in parallel by the runtime (Ref)
The new index file is more familiar to developers who are not from the CommonJS era → Welcoming new contributors
The src/rules files export as ES modules, so importing them as ES modules is ideal
If you agree with these points, I’ll close this and create a new PR for the index file. You can preview the commit for the index file at my fork here