We currently use a WMF maintained eslint rule set called eslint-config-wikimedia. It tends to get updated a little too slow for us and we often have to wait for it to be updated before we can update other dependencies. This is currently happening with Eslint, we're stuck on an unsupported version of v8, and we can't upgrade to v9 until eslint-config-wikimedia supports it.
We made the decision to copy and maintain our own version of this rule set so we can update it when we need.
Acceptance Criteria
- We no longer use eslint-config-wikimedia.
- We have a repo with our copy that we include in our javascript projects as a replacement.
- Our linting styles don't change/are not affected by this replacement.
Implementation notes
We want to use ESLint 9.x (or greater) for the new repository. This means we have to migrate our .eslintrc file to the new eslint.config.js format. The recommended way to to this is as follows:
- Work in the banner repository, it has the more modern eslint definitions
- Prepare the .eslint file to avoid the converter putting in shims:
- remove the wikimedia dependency from the extends
- use the new destructuring operator syntax to replace the extends section of the configuration. See https://eslint.vuejs.org/user-guide/ for an example on how to include vue rules
- run npx @eslint/migrate-config .eslintrc.cjs to convert the configuration
- Bring back the rules, plugins and files sections from the following wikimedia configuration files:
- https://github.com/wikimedia/eslint-config-wikimedia/blob/main/common.json
- https://github.com/wikimedia/eslint-config-wikimedia/blob/main/client/common.json
- https://github.com/wikimedia/eslint-config-wikimedia/blob/main/vue/common.json
- https://github.com/wikimedia/eslint-config-wikimedia/blob/main/vue3/common.json The rules in this one is mostly for compatibility with wikimedia vue.js and might go into the banner repo only, to avoid tying our code to the Vue upgrade policy of the WMF. This config also contains the vue-recommended rules from the vue 3slint plugin, which should also be included.
- Upgrade to ESLint 9
- Extract the configuration into its own module
See https://eslint.org/blog/2022/08/new-config-system-part-1/ and https://eslint.org/blog/2022/08/new-config-system-part-2/ for more information about the background of the configuration changes and to see side-by-side comparisons between old and new code. See https://eslint.org/docs/latest/use/configure/migration-guide for the official migration guide.