Skip to content
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

feat: add fixer function to eslint/rules/no-internal-require #3364

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

headlessNode
Copy link
Member

Description

What is the purpose of this pull request?

This pull request:

  • add fixer function to eslint/rules/no-internal-require
  • update the test fixtures

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 7, 2024
@@ -83,9 +102,11 @@ function main( context ) {

rule = {
'meta': {
'type': 'suggestion',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up. Currently, the auto-fixing for suggestion type is not supported.

@headlessNode headlessNode added Feature Issue or pull request for adding a new feature. Tools Issue or pull request related to project tooling. labels Dec 7, 2024
@headlessNode headlessNode marked this pull request as draft December 7, 2024 08:41
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Dec 7, 2024
@kgryte
Copy link
Member

kgryte commented Dec 10, 2024

This is an interesting one. I am not sure whether we should autofix this or not. If someone is reaching into a package for a particular file, we should probably just error. Auto-fixing could just lead to other issues.

@kgryte kgryte added the Needs Discussion Needs further discussion. label Dec 10, 2024
@headlessNode
Copy link
Member Author

headlessNode commented Dec 10, 2024

@kgryte do we currently have anything calling the internals in the codebase? Also what other issues the auto-fixing could cause?

@kgryte
Copy link
Member

kgryte commented Jan 2, 2025

do we currently have anything calling the internals in the codebase?

@headlessNode Not that I am aware of.

Also what other issues the auto-fixing could cause?

If someone is reaching internally into a package and we autofix without their explicit opt-in, that could lead to unexpected behavior. E.g., if someone is expecting to load a data JSON file, but gets the main export of a package instead because we rewrote require expressions, they might not be aware that such a change has been made (e.g., tests aren't automatically run). That could lead to downstream bugs because we've silently changed behavior.

The reason why I recommend just raising a lint "error" is that we effectively force devs to confront the fact that they are reaching into a package when we generally don't want that. Devs could always explicitly disable the lint rule if they are insistent, but that would be an intentional choice.

@headlessNode
Copy link
Member Author

@kgryte Makes sense. Should I close this PR then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue or pull request for adding a new feature. Needs Discussion Needs further discussion. Tools Issue or pull request related to project tooling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants