pinboard icon indicating copy to clipboard operation
pinboard copied to clipboard

Update eslint to latest versions

Open KaliedaRik opened this issue 1 year ago • 2 comments

What does this change?

This PR updates the ESLint tool to the latest versions.

Note that this includes moving to ESLint's new config system - see relevant posts about this made to the ESLint blog .

The primary aim of this update is to get rid of some Dependabot security alerts, and to lower technical debt going forward.

Future Health work

  • This PR works because it is turning off (potentially essential) linting checks - eg: "no-fallthrough": "off"
  • The current output shows where we are using eslint-disable directives in files. In an ideal world, we should not need those directives.
  • Future health work should attempt to address these issues by moving each check from off to warn and then fixing the code that is causing the warn message.
  • Once those warnings are fixed, we can move the check (if essential) from warn to error to prevent anyone reintroducing such an error into the code base.

How to test

  • Run yarn lint locally - there should be plenty of warnings, but no errors reported.
  • Run the PR in the CODE environment to see if the new system brakes any CI steps.
  • Test in CODE - everything should operate as before

KaliedaRik avatar Dec 30 '24 16:12 KaliedaRik

There's an issue with the CI build, which I can replicate locally:

  • Checkout the branch
  • Run yarn to install dependencies
  • Run yarn lint - should pass (24 warnings - all of which are Unused eslint-disable directive)
  • Run yarn build - this step fails

The reported CI failure occurs when attempting to build the client module and fails specifically because of a type-check error:

Screenshot 2025-01-07 at 16 34 43

... which I can replicate when building locally:

Screenshot 2025-01-07 at 16 39 42

KaliedaRik avatar Jan 07 '25 17:01 KaliedaRik

Interesting aside following on from above comment. If I run yarn lint after running yarn build the lint tests report a whole bunch of fresh errors - all in the newly created dist folders:

Screenshot 2025-01-07 at 17 15 20

This doesn't affect CI because the lint step runs before the build step, but it does make me wonder what the bundler is doing to our source code.

KaliedaRik avatar Jan 07 '25 17:01 KaliedaRik