fix: disable rule options schema validation in eslint 9, fix https://github.com/Stuk/eslint-plugin-header/issues/57#58
Open
tonyganchev wants to merge 159 commits intoStuk:mainfrom
Open
fix: disable rule options schema validation in eslint 9, fix https://github.com/Stuk/eslint-plugin-header/issues/57#58tonyganchev wants to merge 159 commits intoStuk:mainfrom
tonyganchev wants to merge 159 commits intoStuk:mainfrom
Conversation
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.
* docs: missing comma in LICENSE * test: adding more test-cases * devops: enabling more JSDoc rules * devops: eslint enforce jsdoc/check-indentation * devops: eslint enforce jsdoc/check-line-alignment * devops: eslint enforce jsdoc/informative-docs * devops: eslint enforce jsdoc/lines-before-block * devops: eslint enforce jsdoc/match-description * devops: eslint enforce jsdoc/require-description * devops: eslint enforce jsdoc/require-description-complete-sentence * devops: eslint enforce jsdoc/require-hyphen-before-param-description * devops: eslint enforce jsdoc/require-template-description * devops: eslint enforce jsdoc/require-template-description * devops: eslint enforce jsdoc/require-throws * devops: eslint enforce jsdoc/text-escaping * devops: mark dependency on enforcing jsdoc/type-formatting * devops: switching ' to " in JSDoc * devops: eslint remove jsdoc/no-restricted-syntax * devops: eslint remove jsdoc/match-name
#146) The problem stemmed from the fact that when block comments are validated we had no handling when the lines in the comment are fewer than the lines in the matching rules. Addded test-cases for leading eslint-enable and eslint-disable pragmas.
Bumps the npm_and_yarn group with 1 update in the / directory: [serialize-javascript](https://github.com/yahoo/serialize-javascript). Updates `serialize-javascript` from 7.0.2 to 7.0.4 - [Release notes](https://github.com/yahoo/serialize-javascript/releases) - [Commits](yahoo/serialize-javascript@v7.0.2...v7.0.4) --- updated-dependencies: - dependency-name: serialize-javascript dependency-version: 7.0.4 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This was a gap in our testing - when an empty line fixer is passed with a violation report the idea is not to modify the rest of the header - just add the missing empty lines. Modifying a test case to ensure this is the case.
This is a step toward matching leading comments allowed to preempt the header license / copyright comment.
…comment test case
* feat: leadingComments schema * feat: leadingComments normalization in rule * test: leadingComments test-cases * style: leading + on wrapped strings * refactor: simplified regex * refactor: get all comments before the first line of code * refactor: remove hasHeader() check * test: restore code coverage * feat: match tolerated leading comments. * feat: report missing header when all leading comments match to allowed leading comments. * feat: distinct error reporting * docs: updating documentation
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
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