Skip to content

Conversation

@yeonjuan
Copy link
Owner

Checklist

Description

@yeonjuan yeonjuan marked this pull request as ready for review November 16, 2025 11:06
@yeonjuan yeonjuan requested a review from Copilot November 17, 2025 12:23
Copilot finished reviewing on behalf of yeonjuan November 17, 2025 12:25
Copy link
Contributor

Copilot AI left a 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 getIndexFromLoc and getLocFromIndex methods (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) {
Copy link

Copilot AI Nov 17, 2025

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) {
Suggested change
if (value === undefined && value === null) {
if (value === undefined || value === null) {

Copilot uses AI. Check for mistakes.
@yeonjuan yeonjuan merged commit 0b1787b into main Nov 17, 2025
5 checks passed
@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.76%. Comparing base (e88504c) to head (e43159e).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
unittest 98.76% <100.00%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...kages/eslint-plugin/lib/languages/html-language.js 97.14% <100.00%> (ø)
...es/eslint-plugin/lib/languages/html-source-code.js 100.00% <100.00%> (+6.12%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] Replace getLocFromIndex and getIndexFromLoc methods with ESLint's native APIs

2 participants