Skip to content

chore: implement generate baseline script #309

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

Merged
merged 5 commits into from
Apr 4, 2025
Merged

Conversation

yeonjuan
Copy link
Owner

@yeonjuan yeonjuan commented Apr 3, 2025

@yeonjuan yeonjuan requested a review from Copilot April 3, 2025 17:15
Copy link

@Copilot 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 implements a script to generate a baseline feature status map for upcoming baseline rules.

  • Introduces a new script at tools/base-line/generate-baseline.mjs that parses browser compatibility data and serializes baseline statuses
  • Updates eslint.config.js to support ES modules under the tools folder

Reviewed Changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.

File Description
tools/base-line/generate-baseline.mjs Implements baseline generation with data extraction and file generation
eslint.config.js Updates configuration to handle ES module files in the tools directory
Files not reviewed (2)
  • .cspell.json: Language not supported
  • package.json: Language not supported

@yeonjuan yeonjuan requested a review from Copilot April 3, 2025 17:17
Copy link

@Copilot 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 implements a script to generate a baseline feature status map for an upcoming use-baseline rule. Key changes include:

  • Addition of a new baseline generation script in tools/base-line/generate-baseline.mjs that traverses browser compatibility data.
  • Integration of Prettier for code formatting and use of fs.writeFileSync to output the generated baseline.
  • Update to eslint.config.js to support .mjs files in the tools folder.

Reviewed Changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated no comments.

File Description
tools/base-line/generate-baseline.mjs Added baseline generation logic using data traversal and formatting
eslint.config.js Updated configuration to handle module files (*.mjs)
Files not reviewed (2)
  • .cspell.json: Language not supported
  • package.json: Language not supported
Comments suppressed due to low confidence (2)

tools/base-line/generate-baseline.mjs:12

  • [nitpick] Using a boolean (false) as a key in the baselineIds map can be ambiguous. Consider using a consistent key type, such as a string (e.g., 'false'), for clarity and consistency.
[false, BASELINE_FALSE],

tools/base-line/generate-baseline.mjs:97

  • The check for a leading '≤' in baseline_low_date could be fragile if data formats change. Ensure that the data specification for baseline_low_date is well-defined or consider a more robust parsing strategy.
if (status.baseline_low_date && status.baseline_low_date.startsWith("≤")) {

["a.attributionsrc", "0:"],
["a.download", "10:2019"],
["a.href", "10:2015"],
["a.href.href_sms", "0:"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can ignore any keys like this containing an underscore. Those don't correspond to the element/attribute itself, they're more like implementation details.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rviscomi Thanks! I fixed it. 31ddf3d

@yeonjuan yeonjuan merged commit c609ee2 into main Apr 4, 2025
5 checks passed
@yeonjuan yeonjuan deleted the generate-baseline-script branch April 4, 2025 13:19
Copy link

codecov bot commented Apr 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (8c8b39a) to head (31ddf3d).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #309   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files          70       70           
  Lines        2042     2045    +3     
  Branches      556      556           
=======================================
+ Hits         2016     2019    +3     
  Misses         26       26           
Flag Coverage Δ
unittest 98.72% <ø> (+<0.01%) ⬆️

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

see 1 file with indirect coverage changes

🚀 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.

2 participants