Conversation

headlessNode

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-botstdlib-bot added the Needs ReviewA 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.

@headlessNodeheadlessNode added FeatureIssue or pull request for adding a new feature.ToolsIssue or pull request related to project tooling.labels Dec 7, 2024
@headlessNodeheadlessNode marked this pull request as draft December 7, 2024 08:41
@stdlib-botstdlib-bot removed the Needs ReviewA pull request which needs code review.label Dec 7, 2024
@kgryte

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.

@kgrytekgryte added the Needs DiscussionNeeds further discussion.label Dec 10, 2024
@headlessNode

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

@kgryte

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

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

Sign up for free to join this conversation on . Already have an account? Sign in to comment
FeatureIssue or pull request for adding a new feature.Needs DiscussionNeeds further discussion.ToolsIssue or pull request related to project tooling.
None yet

Successfully merging this pull request may close these issues.