Skip to content
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

Use modern jsonlint fork #1018

Merged
merged 9 commits into from
Jan 22, 2025
Merged

Conversation

birkskyum
Copy link
Member

@birkskyum birkskyum commented Jan 21, 2025

We have a few vulnerabilities mentioned when installing, due to obsolete versions of Underscore, which comes from a 10y old version of jsonlint.

This PR swap the old jsonlint from 2015:
https://github.com/josdejong/jsonlint

With this one:
https://github.com/prantlf/jsonlint

Launch Checklist

  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Add an entry to CHANGELOG.md under the ## main section.

@codecov-commenter
Copy link

codecov-commenter commented Jan 21, 2025

Codecov Report

Attention: Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.

Project coverage is 63.48%. Comparing base (af01346) to head (36a1d4c).
Report is 46 commits behind head on main.

Files with missing lines Patch % Lines
src/libs/codemirror-mgl.ts 78.26% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1018      +/-   ##
==========================================
+ Coverage   59.84%   63.48%   +3.63%     
==========================================
  Files         104      104              
  Lines        3011     5773    +2762     
  Branches      680     1727    +1047     
==========================================
+ Hits         1802     3665    +1863     
- Misses       1209     2107     +898     
- Partials        0        1       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HarelM
Copy link
Collaborator

HarelM commented Jan 21, 2025

This looks good assuming it is working as expected, were there other mentioning of this package that can be removed? Maybe in the rollup configuration?
Can this be done to the style-spec package as well?

src/libs/codemirror-mgl.ts Outdated Show resolved Hide resolved
@birkskyum
Copy link
Member Author

birkskyum commented Jan 21, 2025

@HarelM I got the error reporting working.

It's now using the error from the catch(err) now instead of the parseError hack

For instance setting below, where there is inserted an m before the color code:

{
  "id": "background",
  "type": "background",
  "paint": {
    "background-color": m"#D8F2FF"
  },
  "filter": ["all"],
  "layout": {"visibility": "visible"},
  "maxzoom": 24
}

Before

Screenshot 2025-01-21 at 22 41 35

After

Screenshot 2025-01-21 at 22 41 42

@birkskyum birkskyum force-pushed the use-modern-jsonlint-fork branch from c77e5ee to 80d34c3 Compare January 21, 2025 21:47
@birkskyum
Copy link
Member Author

birkskyum commented Jan 21, 2025

I abstracted this error handling out. It's the exact same function we had twice for some reason

@HarelM
Copy link
Collaborator

HarelM commented Jan 21, 2025

Is it possible to add a test to cover this scenario?
Otherwise looks great, thanks!

@birkskyum
Copy link
Member Author

birkskyum commented Jan 21, 2025

@HarelM , I managed to add a test that break the json syntax, and checks that the red error circle appear in the side of the editor

It passes on both main and this PR.

cypress/e2e/layers.cy.ts Outdated Show resolved Hide resolved
@HarelM
Copy link
Collaborator

HarelM commented Jan 22, 2025

Thanks!

cypress/e2e/layers.cy.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@HarelM HarelM left a comment

Choose a reason for hiding this comment

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

Just remove the "only" and you can merge it, thanks!!

@birkskyum birkskyum enabled auto-merge (squash) January 22, 2025 10:34
@birkskyum birkskyum merged commit 2852fa6 into maplibre:main Jan 22, 2025
10 checks passed
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.

3 participants