Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for eslint flat config format #349

Merged
merged 1 commit into from
Mar 7, 2024
Merged

Conversation

rhysd
Copy link
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
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