Upgrade ESLint to v9, use flat config, introduce a whole lot of checks
As eslint-config-react-app (which we depend on) has been abandoned without updates since 4 years ago, and meanwhile ESLint has had major changes, I figured it'd be good to get our codebase bumped up as well.
By bumping ESLint from v8 to v9, the MR does the following:
- Move from
.eslintrc.jsontoeslint.config.mjsfor configuration ("flat config") - Remove
eslint-config-react-appand replace it with more up-to-date and modular plugins/presets for TypeScript, React, React Hooks, and import checking. - Introduces
strictTypeCheckedrules so we get better typed frontend code
Previously, eslint 8 only complained about 4 errors and 32 warnings about the current master branch. Three of which were missing dangling commas.
The upgrade now shows 1092 errors and 54 warnings. Dangling commas are now no longer reported by eslint, as they have decided that stylistic rules are better checked by Prettier anyway (and we already use Prettier).
I've double checked and all of the new errors are genuinely bad code that we want to improve on. But I didn't want to make a big MR, so I've disabled all the rules to just a 'warning' level. Perhaps during Coding Weekend, people can choose to fix each of these one by one until we can re-enable the rules again.