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

chore(deps-dev): bump Eslint from 8.53.0 to 9.17.0 #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Jastrzebowski
Copy link
Contributor

@Jastrzebowski Jastrzebowski commented Jan 4, 2025

Describe your changes

I'm upgrading Eslint to the version 9. As it's a major version change, the code has additional changes.

Config file format and rules

The Eslint version 9 is replacing the old rc format with a newer flat one (docs). I also replaced the outdated eslint-plugin-vitest with official Vitest eslint-plugin-vitest.

I used the previous rules setup and added two new ones:

  • sonarjs/todo-tag — I set the rule to warn. The previous setup didn't error on TODO comments for unknown reasons. I see the value in highlighting them, but I don't believe they should throw a linting error.
  • sonarjs/no-nested-functions — I disabled the rule for tests. The rule does not add value to tests as the test format is nested functions.

Eslint Typescript

To keep the tests outside the build but allow Eslint to handle them, I'm adding the custom config used only by the lintner.

Code changes

Sonar complained about sonarjs/function-return-type for some of the helper functions. I added explicit typing that covers the error case, but as it didn't fix the issue, I silenced the rule for those helpers. Functions are not complex, and generic helpers are part of every Grammar library.

Sonar also complained about /-?\d+\.\d+/ regex being vulnerable to super-linear runtime due to backtracking.

The original pattern /-?\d+\.\d+/ could cause backtracking because it requires digits on both sides of the decimal point. If given a long string of digits followed by something that isn't a decimal point, it would need to try different combinations of how many digits to consume before failing. - Anthropic Claude

Issue ticket number/link

#35

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have added tests (if possible)
  • I have updated the readme (if necessary)
  • I have updated the demo (if necessary)

@Jastrzebowski Jastrzebowski changed the title feat: upgrade Eslint chore(deps-dev): bump Eslint from 8.53.0 to 9.17.0 Jan 4, 2025
@ChromeGG
Copy link
Owner

ChromeGG commented Jan 6, 2025

Nice, thank you for your help!
I'll try to review the code and fix the issue this week :)

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