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

fix: do not allow importing dev dependencies from src #316

Conversation

tjenkinson
Copy link

See npm/node-semver#559 (comment)

Not sure if this needs to be opt-in, or if it can apply to all projects using this?

References

Needed by npm/node-semver#559

@tjenkinson tjenkinson marked this pull request as ready for review May 6, 2023 09:15
@tjenkinson tjenkinson requested a review from a team as a code owner May 6, 2023 09:15
},
overrides: [
{
files: ['**/test/**', '.eslintrc.js', '.eslintrc.local.js'],
Copy link
Author

Choose a reason for hiding this comment

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

making an assumption this covers everything that's not considered package src. Not sure if that's actually the case?

Copy link
Member

Choose a reason for hiding this comment

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

The standard that templateOSS sets up is

  "files": [
    "bin/",
    "lib/"
  ],

It's much easier to explicitly specify where the code is than where it isn't. The rule should apply to those two directories and the handful of projects that need to override this can do so.

Copy link
Author

Choose a reason for hiding this comment

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

Ah that’s good to know. Shall I open a pr on the config repo then for these folders?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah let's start there.

Copy link
Member

Choose a reason for hiding this comment

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

My glob is rusty but something like this is what I had in mind to start
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["!lib/**", "!bin/**"]}]

Copy link
Author

Choose a reason for hiding this comment

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

@wraithgar
Copy link
Member

The tracking issue is here but this may have to end up in our eslint config package. It may also warrant a discussion about what the rule looks like. Almost all of our repos have their code isolated to ./lib so that is likely where the default wants applying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants