-
-
Notifications
You must be signed in to change notification settings - Fork 51
refactor: use plugin-kit native method #447
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the HTMLSourceCode implementation to leverage native methods from the updated @eslint/plugin-kit library (version 0.4.1), eliminating duplicate code.
- Upgrades @eslint/plugin-kit from 0.3.1 to 0.4.1
- Removes custom implementations of
getIndexFromLocandgetLocFromIndexmethods (now provided by TextSourceCodeBase) - Changes export pattern from class to factory function for better encapsulation
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates @eslint/plugin-kit to 0.4.1 and adds @eslint/core 0.17.0 dependency |
| packages/eslint-plugin/package.json | Updates @eslint/plugin-kit dependency version to 0.4.1 |
| packages/eslint-plugin/lib/languages/html-source-code.js | Removes duplicate getIndexFromLoc/getLocFromIndex methods and exports factory function instead of class |
| packages/eslint-plugin/lib/languages/html-language.js | Updates to use createHTMLSourceCode factory function instead of HTMLSourceCode class |
| packages/eslint-plugin/tests/languages/html-source-code.test.js | Updates test imports and adds type assertion helper function |
Comments suppressed due to low confidence (1)
packages/eslint-plugin/tests/languages/html-source-code.test.js:47
- This guard always evaluates to false.
if (value === undefined && value === null) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @returns {asserts value is T} | ||
| */ | ||
| function nonNullish(value) { | ||
| if (value === undefined && value === null) { |
Copilot
AI
Nov 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logical operator should be || (OR) instead of && (AND). A value cannot be both undefined and null simultaneously, so this condition will never be true and the function will never throw an error.
if (value === undefined || value === null) {| if (value === undefined && value === null) { | |
| if (value === undefined || value === null) { |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #447 +/- ##
==========================================
+ Coverage 98.56% 98.76% +0.20%
==========================================
Files 84 84
Lines 2791 2761 -30
Branches 778 759 -19
==========================================
- Hits 2751 2727 -24
+ Misses 40 34 -6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Checklist
getLocFromIndexandgetIndexFromLocmethods with ESLint's native APIs #413Description