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

[New] add support for Flat Config #3018

Merged
merged 1 commit into from
Aug 29, 2024

Commits on Jun 18, 2024

  1. [New] add support for Flat Config

    This change adds support for ESLint's new Flat config system.  It maintains backwards compatibility with `eslintrc`-style configs as well.
    
    To achieve this, we're now dynamically creating flat configs on a new `flatConfigs` export.
    
    Usage
    
    ```js
    import importPlugin from 'eslint-plugin-import';
    import js from '@eslint/js';
    import tsParser from '@typescript-eslint/parser';
    
    export default [
      js.configs.recommended,
      importPlugin.flatConfigs.recommended,
      importPlugin.flatConfigs.react,
      importPlugin.flatConfigs.typescript,
      {
        files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
        languageOptions: {
          parser: tsParser,
          ecmaVersion: 'latest',
          sourceType: 'module',
        },
        ignores: ['eslint.config.js'],
        rules: {
          'no-unused-vars': 'off',
          'import/no-dynamic-require': 'warn',
          'import/no-nodejs-modules': 'warn',
        },
      },
    ];
    ```
    michaelfaith authored and ljharb committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    806e3c2 View commit details
    Browse the repository at this point in the history