Skip to content

Add support for eslint flat config format#349

Merged
lo1tuma merged 1 commit intolo1tuma:mainfrom
rhysd:flat-config
Mar 7, 2024
Merged

Add support for eslint flat config format#349
lo1tuma merged 1 commit intolo1tuma:mainfrom
rhysd:flat-config

Conversation

@rhysd
Copy link
Copy Markdown
Contributor

@rhysd rhysd commented Mar 7, 2024

Fix #341

This PR adds support for the eslint flat config. Now eslint-plugin-mocha can be used in eslint.config.js.

import eslint from '@eslint/js';
import mocha from 'eslint-plugin-mocha';

export default [
    eslint.configs.recommended,
    mocha.configs.flat.recommended
];

Changes are as follows:

  • Since the configuration format is different from legacy eslintrc config, new objects for all and recommended presets were added to mochaPlugin.configs.flat separately.
  • globals package was added as dependency because env config was dropped at flat config. Globals such as describe need to be added in languageOptions and globals package provides the list of mocha's globals.
  • Instruction for flat config was added to README.md document

Copy link
Copy Markdown
Owner

@lo1tuma lo1tuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESLint 9 / Flat config

2 participants