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

[New] newline-after-imports: new option exactCount and docs update #1933

Merged
merged 1 commit into from Sep 15, 2023

Conversation

anikethsaha
Copy link
Contributor

@anikethsaha anikethsaha commented Oct 27, 2020

Fixes #1901. Fixes #514.

Checklist

  • option implementation
  • tests
  • docs update

added option named exactCount of type Boolean default false that will enforce strict following of the count option where the number of newline has to be equal to count.

Updated the docs as mentioned in the linked issue accordingly.

Fixes import-js#1901. Fixes import-js#514.

Co-authored-by: Anix <anik220798@gmail.com>
Co-authored-by: reosarevok <reosarevok@metabrainz.org>
@coveralls
Copy link

coveralls commented Oct 27, 2020

Coverage Status

Coverage increased (+0.9%) to 82.365% when pulling bb84371 on anikethsaha:fixes-1913 into 7c1e8e4 on benmosher:master.

@golopot
Copy link
Contributor

golopot commented Nov 10, 2020

This also fixes #514.

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.

Seems legit.

@ljharb
Copy link
Member

ljharb commented Nov 10, 2020

Looks like there's some test errors in eslint 2.

@ljharb ljharb marked this pull request as draft May 14, 2021 05:30
@bartzy
Copy link

bartzy commented Mar 8, 2022

@anikethsaha Are you planning on merging this?

@reosarevok
Copy link
Contributor

I would love this - any way I can help move it forward?

@ljharb
Copy link
Member

ljharb commented Sep 14, 2023

If someone wants to rebase this branch, fix the test errors, and post a link to the branch here (NOT a new PR, please!) then I can pull in the changes and we can get this merged.

@reosarevok
Copy link
Contributor

I rebased, fixed conflicts, fixed eslint errors, and added a test using this in combination with the newer considerComments option. I ran npm test again and there's no issues with these specific files anymore (there's a few unrelated eslint warnings elsewhere which I didn't start fixing now). I don't know if there's more tests I could and should be running (I see your CI here runs a lot more tests than that). Anyway: https://github.com/reosarevok/eslint-plugin-import/tree/fixes-1913

@ljharb
Copy link
Member

ljharb commented Sep 14, 2023

alrighty, if the tests pass we can un-draft this and move forward

@ljharb
Copy link
Member

ljharb commented Sep 14, 2023

@reosarevok the tests are still failing in eslint 2, pretty consistently, about the autofix output. it would be ideal to figure out how to get them passing in eslint 2.

@reosarevok
Copy link
Contributor

Oh, I think I figured out the issue - other places that don't autofix do return undefined (not sure if that's important, but it works anyway so I made the change) and have output matching the code rather than output: null as this PR originally had. I tried that with eslint 2 and it seems to work now (same branch, force-pushed). If I'm missing something else then do let me know, I haven't played with very old eslint before nor with writing my own rules :)

@ljharb ljharb marked this pull request as ready for review September 15, 2023 17:05
@ljharb
Copy link
Member

ljharb commented Sep 15, 2023

The travis failure is because they're on an outdated nvm, and npm 10 breaks on node 14; appveyor's WSL failures are expected. Once the rest of the appveyor tests pass, I'll land this.

@ljharb ljharb merged commit 8705121 into import-js:main Sep 15, 2023
165 of 169 checks passed
@FFdhorkin
Copy link

There's a comment related bug with this; I've filed a new bug since this is already merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
7 participants