Open acelaya opened 8 months ago
Once all pieces involved support flat config, the new config file should look something on these lines:
const tseslint = require('typescript-eslint');
const hypothesis = require('eslint-config-hypothesis');
const jsxA11Y = require('eslint-plugin-jsx-a11y');
module.exports = tseslint.config(hypothesis, jsxA11Y, {
plugins: {
'@typescript-eslint': tseslint.plugin,
},
languageOptions: {
parser: tseslint.parser,
},
rules: {
// All rules as defined currently in .eslintrc file
},
});
Eslint has a new recommended configuration system (AKA flat config) which is supported by v8, and will be the default in v9.
In order to migrate to it, these are the requirements.
eslintrc
file with a neweslint.config.js
file. Migration guide: https://eslint.org/docs/latest/use/configure/migration-guide@typescript-eslint/eslint-plugin
and@typescript-eslint/parser
with the newtypescript-eslint
package: Migration docs can be found here https://typescript-eslint.io/blog/announcing-typescript-eslint-v7/eslint-plugin-jsx-a11y
has been migrated to support flat config: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/pull/891eslint-config-hypothesis
to support flat config: https://github.com/hypothesis/frontend-toolkit/issues/48At the time of writing this, eslint only supports
js
extension for the flat config file. However,mjs
andcjs
support has been implemented and added to eslint 9 alpha versions.This means the file needs to be written in CJS format as the package is not defined with type module. We might want to change that at some point.