hypothesis / client

The Hypothesis web-based annotation client.
Other
637 stars 197 forks source link

Migrate to eslint flat config #6226

Open acelaya opened 8 months ago

acelaya commented 8 months ago

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.

At the time of writing this, eslint only supports js extension for the flat config file. However, mjs and cjs 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.

acelaya commented 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
  },
});