-
Notifications
You must be signed in to change notification settings - Fork 37
fix: disable rule options schema validation in eslint 9, fix https://github.com/Stuk/eslint-plugin-header/issues/57 #58
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
Open
tonyganchev
wants to merge
28
commits into
Stuk:main
Choose a base branch
from
tonyganchev:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 task
I've published a fork at https://www.npmjs.com/package/@tony.ganchev/eslint-plugin-header containing my fix. |
Original PR: Stuk#56 As required by ESLint 9: see https://eslint.org/blog/2024/04/eslint-v9.0.0-released/#changes-to-how-you-write-rules
In the process, upgraded all dependencies
Original logic was expecting the third argument of the header rule to always be the number of empty lines expected. Unfortunately, after line-ending character settigns were added as an optional config argument, the logic no longer stands true.
Goal is to use the header rule itself to lint its codebase.
# Why? Most unit invalid test cases did not pass when running under Windows because test cases expected fixes to use LF and not CR+LF. # The Fix Modify node's line ending property using testdouble to ensure the test cases are executed in a POSIX-compatible/simulated environment. # Upcomming Fix A subsequent PR will add a good representation of both POSIX and Windows in the test cases.
# The Problem There was a bug in `genCommentsRange()` where only one character is checked after the comment for an EOL character. Since on Windows we need two characters, the check failed and the wrong number of empty lines was added on windows (desired+1) which caused both tests to fail and the autofix to give different results from POSIX. # The Fix _N_ number of characters are tested, where _N_ is the length of the current EOL string.
This would help the IDE give better autocompletion suggestion. The changes are only tested with VS Code.
- Perf fix: bail on first line in a header comment not matching. - added constants for comment-style and line-ending overrides.
Added comment type as a part of the name.
Fringe case: empty command-line script with no trailing end-line.
* test: achieve and enforce 100% code coverage - invalid tests cases where fix is not possible. - invalid test case for empty settings object. - remove redundant branch for missing header. - remove fallback for missing options - validated by eslint. - additional test cases to capture current (quirky) behavior. - additional code improvements. * fixup! test: achieve and enforce 100% code coverage * fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! fixup! fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! fixup! fixup! fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! test: achieve and enforce 100% code coverage * fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! test: achieve and enforce 100% code coverage
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Temporary fix to allow the header rule options to pass schema validation introduced in eslint 9 as per https://eslint.org/blog/2024/04/eslint-v9.0.0-released/#changes-to-how-you-write-rules
Fixes #57