-
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
105
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
Author
|
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.
With the current change, users get much more precise information about what is worng with their headers: - when a pattern is used for the whole header, the error remains the same but the error markers span the header, not the codebase below (same as previous update). - when multi-line config is used: - error is shown over the first line that does not match matching the line with regular expression. The pattern is added as part of the error message. - error is shown over the remainder of the line after the first mismatched character when string matching is used. The remaining expected characters are shown in the error message - error is shown over the end of the line if the line is shorter than expected. - error is shown at the end of the header if it is shorter than expected. - error is shown over any unexpected lines at the end of the header. - Autofixes still reapply the whole header so it will wipe out any year history from the current header of the file. - There is an ongoing deliberation tracked in #63 whether the first comment should always be configured a header. This may affect the error-reporting behavior modified in this change or it may only affect the autofix. Bottom line: there will be further changes. fixes #58, #59
…n permissions (#104) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…n permissions (#105) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
cleared a number of security-related overrides that are no longer necessary.
* docs,devops: smoke tests for ESLint 8 - E2E tests for ESLint 8, 9, and 10 to verify the plugin works end-to-end. - ESLint 8 test uses legacy hierarchical config. - updated plugin minimum ESLint version requirement. * docs: fixed md lint errors * Potential fix for code scanning alert no. 5: Shell command built from environment values Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Revert "Potential fix for code scanning alert no. 5: Shell command built from environment values" This reverts commit 4a6f1b3. --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* docs,devops: smoke tests for ESLint 8 - E2E tests for ESLint 8, 9, and 10 to verify the plugin works end-to-end. - ESLint 8 test uses legacy hierarchical config. - updated plugin minimum ESLint version requirement. * docs: fixed md lint errors * Potential fix for code scanning alert no. 5: Shell command built from environment values * Revert "Potential fix for code scanning alert no. 5: Shell command built from environment values" This reverts commit 4a6f1b3. --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* docs: Modifying documentation to the new config format. - _README.md_ - new configuration format. - _legacy-config.md_ - legacy configuration format. - _migrate-md_ - migrate from the legacy to the new configuration format. * devops: remove unnecessary eslint-env comment * feat: support passing RegExp objects Only relevant when using flat config. Allows users to specify patterns using `/regexp-syntax/` and not a string with double-escaped backslashes. * docs: reflect RegExp capabilities annd other improvements * docs: fix lint errors
Bumps the npm_and_yarn group with 1 update in the / directory: [lodash](https://github.com/lodash/lodash). Updates `lodash` from 4.17.21 to 4.17.23 - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](lodash/lodash@4.17.21...4.17.23) --- updated-dependencies: - dependency-name: lodash dependency-version: 4.17.23 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com>
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