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

make rule no-useless-path-segments work with commonjs #1128

Merged
merged 1 commit into from
Jul 16, 2018
Merged

make rule no-useless-path-segments work with commonjs #1128

merged 1 commit into from
Jul 16, 2018

Conversation

1pete
Copy link
Contributor

@1pete 1pete commented Jun 29, 2018

fixes #1127

@coveralls
Copy link

coveralls commented Jun 29, 2018

Coverage Status

Coverage remained the same at 97.273% when pulling 2c1886e on 1pete:fix-1127 into 37554fe on benmosher:master.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Sounds good; I hope we can consider this a bugfix and not a breaking change tho :-/

@ljharb
Copy link
Member

ljharb commented Jun 29, 2018

cc @graingert

@graingert
Copy link
Contributor

Nice. It was totally my intention when writing this that it would work for commonjs too. Thanks for the cc @ljharb

@graingert
Copy link
Contributor

@ljharb we could make it a config option if we're being really strict with breaking changes

@ljharb
Copy link
Member

ljharb commented Jun 29, 2018

Yeah that’s a good point - worst case we can put it behind an option.

@1pete
Copy link
Contributor Author

1pete commented Jul 1, 2018

Please review again, now it's an option, so it can safely be a patch.
And maybe you can turn commonjs on by default on v3.

@@ -39,6 +39,8 @@ module.exports = {
url: docsUrl('no-useless-path-segments'),
},

schema: [ makeOptionsSchema() ],
Copy link
Member

Choose a reason for hiding this comment

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

this isn’t defining “commonjs” as an option tho

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

oh, hmm. I don’t think it’s a good idea to add a bunch of options that aren’t being used. Can we make a schema that only has the commonjs option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

from what i observe, every option is valid, function makeOptionsSchema is made specifically for rule that uses util moduleVisitor
checkout
https://github.com/benmosher/eslint-plugin-import/blob/37554fe9844986a1ab126d2a8f59fe4c7551a2f8/utils/moduleVisitor.js#L13-L101

but it's your call, i can add only commonjs

Copy link
Member

Choose a reason for hiding this comment

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

it’s fine to add support for every option, but then let’s make sure to add tests for all the options.

@1pete
Copy link
Contributor Author

1pete commented Jul 1, 2018

@ljharb now there is one simple option :)

@graingert
Copy link
Contributor

graingert commented Jul 1, 2018 via email

@ljharb
Copy link
Member

ljharb commented Jul 2, 2018

Sure, we just need a test for it.

@graingert
Copy link
Contributor

@1pete ^

@ljharb
Copy link
Member

ljharb commented Jul 16, 2018

I'm going to merge this now; if we want to add AMD let's do that in a followup PR.

@ljharb ljharb merged commit 5480240 into import-js:master Jul 16, 2018
@1pete 1pete deleted the fix-1127 branch July 17, 2018 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

no-useless-path-segments does not work with require statements
4 participants