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

feat: add flat config support #122

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

michaelfaith
Copy link

@michaelfaith michaelfaith commented Aug 4, 2024

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. I was a bit on the fence about using this convention, or the other convention that's become prevalent in the community: adding the flat configs directly to the configs object, but with a 'flat/' prefix. I like this better, since it's slightly more ergonomic when using it in practice. e.g. ...importX.flatConfigs.recommended vs ...importX.configs['flat/recommended'], but i'm open to changing that.

Example Usage

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',
    },
  },
];

Closes #29

Copy link

changeset-bot bot commented Aug 4, 2024

🦋 Changeset detected

Latest commit: 19f0214

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-import-x Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codesandbox-ci bot commented Aug 4, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@michaelfaith
Copy link
Author

michaelfaith commented Aug 4, 2024

Are the unit tests in this repo supposed to be passing? I noticed they failed in my branch, and so I checked out current master branch, and they're also failing for me there. Is it my setup, or are they just not working?

@silverwind
Copy link

flat configs on a new flatConfigs export

I like it personally as well as I find configs['flat/recommended'] a bit ugly.

@silverwind
Copy link

Are the unit tests in this repo supposed to be passing? I noticed they failed in my branch, and so I checked out current master branch, and they're also failing for me there. Is it my setup, or are they just not working?

Tests are passing for me on master branch with yarn && yarn build && yarn test:

Test Suites: 54 passed, 54 total
Tests:       4 skipped, 2665 passed, 2669 total
Snapshots:   0 total
Time:        7.388 s

examples/flat/src/imports.ts Fixed Show fixed Hide fixed
examples/flat/src/imports.ts Fixed Show fixed Hide fixed
examples/flat/src/imports.ts Fixed Show fixed Hide fixed
examples/flat/src/imports.ts Fixed Show fixed Hide fixed
examples/legacy/src/imports.ts Fixed Show fixed Hide fixed
examples/legacy/src/imports.ts Fixed Show fixed Hide fixed
examples/legacy/src/imports.ts Fixed Show fixed Hide fixed
examples/legacy/src/imports.ts Fixed Show fixed Hide fixed
@SukkaW
Copy link
Collaborator

SukkaW commented Aug 14, 2024

@michaelfaith We can probably split this PR into two: a PR that adds a flat config preset without no-unused-modules, and another PR that adds flat config support for no-unused-module.

With this, people can start using the flat presets right away.

@michaelfaith
Copy link
Author

@michaelfaith We can probably split this PR into two: a PR that adds a flat config preset without no-unused-modules, and another PR that adds flat config support for no-unused-module.

With this, people can start using the flat presets right away.

I would be ok doing that, if the maintainers are. I was turned down when i suggested doing that in my PR in the other repo.

@SukkaW
Copy link
Collaborator

SukkaW commented Aug 17, 2024

if the maintainers are. I was turned down when i suggested doing that in my PR in the other repo.

It is OK here. I myself am an early flat config adapter (when ESLint 8.40 was released). I'd love to have a flat preset.

As for the inconsistency, we can mention in the changeset that the no-unused-modules rule is not available yet.

@michaelfaith
Copy link
Author

if the maintainers are. I was turned down when i suggested doing that in my PR in the other repo.

It is OK here. I myself am an early flat config adapter (when ESLint 8.40 was released). I'd love to have a flat preset.

As for the inconsistency, we can mention in the changeset that the no-unused-modules rule is not available yet.

Sounds good. Then i'll try and find some time to wrap this up soon. Thanks

@michaelfaith michaelfaith force-pushed the feat/flat-config-support-x branch 3 times, most recently from e224bd0 to 3e2ae16 Compare August 18, 2024 16:41
@michaelfaith
Copy link
Author

michaelfaith commented Aug 18, 2024

Are the unit tests in this repo supposed to be passing? I noticed they failed in my branch, and so I checked out current master branch, and they're also failing for me there. Is it my setup, or are they just not working?

Tests are passing for me on master branch with yarn && yarn build && yarn test:

Test Suites: 54 passed, 54 total
Tests:       4 skipped, 2665 passed, 2669 total
Snapshots:   0 total
Time:        7.388 s

Yeah, that's what I've been running too, but still getting a ton of failures both in my branch and master (the same tests in both). So I'm kind of just relying on CI here since i'm not able to run them locally.
image

@michaelfaith michaelfaith marked this pull request as ready for review August 18, 2024 16:48
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.  I was a bit on the fence about using this convention, or the other convention that's become prevalent in the community: adding the flat configs directly to the `configs` object, but with a 'flat/' prefix.  I like this better, since it's slightly more ergonomic when using it in practice.  e.g. `...importX.flatConfigs.recommended` vs `...importX.configs['flat/recommended']`, but i'm open to changing that.

Example 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',
    },
  },
];
```

Closes import-js#29
@michaelfaith
Copy link
Author

michaelfaith commented Aug 18, 2024

This should be ready for review.

As per the above conversation, this doesn't include addressing issues with no-unused-module and can be addressed separately. Though, it may be worth opening a separate issue to track that, since this would close #29

if the maintainers are. I was turned down when i suggested doing that in my PR in the other repo.

It is OK here. I myself am an early flat config adapter (when ESLint 8.40 was released). I'd love to have a flat preset.

As for the inconsistency, we can mention in the changeset that the no-unused-modules rule is not available yet.

@SukkaW SukkaW merged commit cd52e86 into un-ts:master Aug 26, 2024
11 of 20 checks passed
@michaelfaith michaelfaith deleted the feat/flat-config-support-x branch August 26, 2024 21:50
n0099 added a commit to n0099/open-tbm that referenced this pull request Aug 27, 2024
… @ `stores/relativeTime`

* switch to flat config as `@tanstack/eslint-plugin-query`: TanStack/query#7663, `eslint-plugin-pinia`: lisilinhart/eslint-plugin-pinia#35 & `eslint-plugin-import-x`: un-ts/eslint-plugin-import-x#122 now supports it @ eslint.config.js
@ fe
n0099 added a commit to n0099/open-tbm that referenced this pull request Aug 27, 2024
… @ `stores/relativeTime`

* switch to flat config as `@tanstack/eslint-plugin-query`: TanStack/query#7663, `eslint-plugin-pinia`: lisilinhart/eslint-plugin-pinia#35 & `eslint-plugin-import-x`: un-ts/eslint-plugin-import-x#122 now supports it @ eslint.config.js
@ fe
n0099 added a commit to n0099/open-tbm that referenced this pull request Aug 27, 2024
… @ `stores/relativeTime`

* switch to flat config as `@tanstack/eslint-plugin-query`: TanStack/query#7663, `eslint-plugin-pinia`: lisilinhart/eslint-plugin-pinia#35 & `eslint-plugin-import-x`: un-ts/eslint-plugin-import-x#122 now supports it @ eslint.config.js
@ fe
renovate bot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull request Aug 27, 2024
##### [v4.1.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#410)

##### Minor Changes

-   [#122](un-ts/eslint-plugin-import-x#122) [`cd52e86`](un-ts/eslint-plugin-import-x@cd52e86) Thanks [@michaelfaith](https://github.com/michaelfaith)! - Add ESLint flat configuration presets. You can access them with:

    ```ts
    import eslintPluginImportX from "eslint-plugin-import-x";

    eslintPluginImportX.flatConfigs.recommended;
    eslintPluginImportX.flatConfigs.react;
    eslintPluginImportX.flatConfigs.typescript;
    eslintPluginImportX.flatConfigs.electron;
    ```

-   [#132](un-ts/eslint-plugin-import-x#132) [`9948c78`](un-ts/eslint-plugin-import-x@9948c78) Thanks [@SukkaW](https://github.com/SukkaW)! - Added `no-rename-default` that forbid importing a default export by a different name. Originally created by [@whitneyit](https://github.com/whitneyit), ported by [@SukkaW](https://github.com/SukkaW)
renovate bot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull request Aug 27, 2024
##### [v4.1.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#410)

##### Minor Changes

-   [#122](un-ts/eslint-plugin-import-x#122) [`cd52e86`](un-ts/eslint-plugin-import-x@cd52e86) Thanks [@michaelfaith](https://github.com/michaelfaith)! - Add ESLint flat configuration presets. You can access them with:

    ```ts
    import eslintPluginImportX from "eslint-plugin-import-x";

    eslintPluginImportX.flatConfigs.recommended;
    eslintPluginImportX.flatConfigs.react;
    eslintPluginImportX.flatConfigs.typescript;
    eslintPluginImportX.flatConfigs.electron;
    ```

-   [#132](un-ts/eslint-plugin-import-x#132) [`9948c78`](un-ts/eslint-plugin-import-x@9948c78) Thanks [@SukkaW](https://github.com/SukkaW)! - Added `no-rename-default` that forbid importing a default export by a different name. Originally created by [@whitneyit](https://github.com/whitneyit), ported by [@SukkaW](https://github.com/SukkaW)
renovate bot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull request Sep 17, 2024
##### [v4.2.1](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#421)

##### Patch Changes

-   [#148](un-ts/eslint-plugin-import-x#148) [`d228129`](un-ts/eslint-plugin-import-x@d228129) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix `newline-after-import`'s `considerComments` options when linting `require`, backports import-js/eslint-plugin-import#2952

-   [#147](un-ts/eslint-plugin-import-x#147) [`eca73ed`](un-ts/eslint-plugin-import-x@eca73ed) Thanks [@nchevsky](https://github.com/nchevsky)! - Fix regression in rule `no-unused-modules` which would incorrectly initialize option `src` to `[]` instead of `[process.cwd()]`, breaking file discovery.

-   [#148](un-ts/eslint-plugin-import-x#148) [`d228129`](un-ts/eslint-plugin-import-x@d228129) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix `no-duplicates` for TypeScript, backports import-js/eslint-plugin-import#3033
##### [v4.2.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#420)

##### Minor Changes

-   [#142](un-ts/eslint-plugin-import-x#142) [`f12447e`](un-ts/eslint-plugin-import-x@f12447e) Thanks [@Zamiell](https://github.com/Zamiell)! - Add new option "whitelist" for rule "no-extraneous-dependencies"

##### Patch Changes

-   [#146](un-ts/eslint-plugin-import-x#146) [`e5e4580`](un-ts/eslint-plugin-import-x@e5e4580) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix nuxt/eslint#494 by avoid importing from `@typescript-eslint/typescript-estree`.
##### [v4.1.1](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#411)

##### Patch Changes

-   [#133](un-ts/eslint-plugin-import-x#133) [`757ffa9`](un-ts/eslint-plugin-import-x@757ffa9) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix [#123](un-ts/eslint-plugin-import-x#123) where the rule `no-named-as-default` will confuse TypeScript namespace exports with actual exports.
##### [v4.1.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#410)

##### Minor Changes

-   [#122](un-ts/eslint-plugin-import-x#122) [`cd52e86`](un-ts/eslint-plugin-import-x@cd52e86) Thanks [@michaelfaith](https://github.com/michaelfaith)! - Add ESLint flat configuration presets. You can access them with:

    ```ts
    import eslintPluginImportX from "eslint-plugin-import-x";

    eslintPluginImportX.flatConfigs.recommended;
    eslintPluginImportX.flatConfigs.react;
    eslintPluginImportX.flatConfigs.typescript;
    eslintPluginImportX.flatConfigs.electron;
    ```

-   [#132](un-ts/eslint-plugin-import-x#132) [`9948c78`](un-ts/eslint-plugin-import-x@9948c78) Thanks [@SukkaW](https://github.com/SukkaW)! - Added `no-rename-default` that forbid importing a default export by a different name. Originally created by [@whitneyit](https://github.com/whitneyit), ported by [@SukkaW](https://github.com/SukkaW)
##### [v4.0.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#400)

##### Major Changes

-   [#112](un-ts/eslint-plugin-import-x#112) [`4ba14da`](un-ts/eslint-plugin-import-x@4ba14da) Thanks [@SukkaW](https://github.com/SukkaW)! - Use typescript-eslint v8. The minimum supported ESLint version is now >= 8.57.0 and the minimum required Node.js version is now 18.18.0.
renovate bot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull request Sep 17, 2024
##### [v4.2.1](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#421)

##### Patch Changes

-   [#148](un-ts/eslint-plugin-import-x#148) [`d228129`](un-ts/eslint-plugin-import-x@d228129) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix `newline-after-import`'s `considerComments` options when linting `require`, backports import-js/eslint-plugin-import#2952

-   [#147](un-ts/eslint-plugin-import-x#147) [`eca73ed`](un-ts/eslint-plugin-import-x@eca73ed) Thanks [@nchevsky](https://github.com/nchevsky)! - Fix regression in rule `no-unused-modules` which would incorrectly initialize option `src` to `[]` instead of `[process.cwd()]`, breaking file discovery.

-   [#148](un-ts/eslint-plugin-import-x#148) [`d228129`](un-ts/eslint-plugin-import-x@d228129) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix `no-duplicates` for TypeScript, backports import-js/eslint-plugin-import#3033
##### [v4.2.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#420)

##### Minor Changes

-   [#142](un-ts/eslint-plugin-import-x#142) [`f12447e`](un-ts/eslint-plugin-import-x@f12447e) Thanks [@Zamiell](https://github.com/Zamiell)! - Add new option "whitelist" for rule "no-extraneous-dependencies"

##### Patch Changes

-   [#146](un-ts/eslint-plugin-import-x#146) [`e5e4580`](un-ts/eslint-plugin-import-x@e5e4580) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix nuxt/eslint#494 by avoid importing from `@typescript-eslint/typescript-estree`.
##### [v4.1.1](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#411)

##### Patch Changes

-   [#133](un-ts/eslint-plugin-import-x#133) [`757ffa9`](un-ts/eslint-plugin-import-x@757ffa9) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix [#123](un-ts/eslint-plugin-import-x#123) where the rule `no-named-as-default` will confuse TypeScript namespace exports with actual exports.
##### [v4.1.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#410)

##### Minor Changes

-   [#122](un-ts/eslint-plugin-import-x#122) [`cd52e86`](un-ts/eslint-plugin-import-x@cd52e86) Thanks [@michaelfaith](https://github.com/michaelfaith)! - Add ESLint flat configuration presets. You can access them with:

    ```ts
    import eslintPluginImportX from "eslint-plugin-import-x";

    eslintPluginImportX.flatConfigs.recommended;
    eslintPluginImportX.flatConfigs.react;
    eslintPluginImportX.flatConfigs.typescript;
    eslintPluginImportX.flatConfigs.electron;
    ```

-   [#132](un-ts/eslint-plugin-import-x#132) [`9948c78`](un-ts/eslint-plugin-import-x@9948c78) Thanks [@SukkaW](https://github.com/SukkaW)! - Added `no-rename-default` that forbid importing a default export by a different name. Originally created by [@whitneyit](https://github.com/whitneyit), ported by [@SukkaW](https://github.com/SukkaW)
##### [v4.0.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#400)

##### Major Changes

-   [#112](un-ts/eslint-plugin-import-x#112) [`4ba14da`](un-ts/eslint-plugin-import-x@4ba14da) Thanks [@SukkaW](https://github.com/SukkaW)! - Use typescript-eslint v8. The minimum supported ESLint version is now >= 8.57.0 and the minimum required Node.js version is now 18.18.0.
renovate bot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull request Sep 17, 2024
##### [v4.2.1](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#421)

##### Patch Changes

-   [#148](un-ts/eslint-plugin-import-x#148) [`d228129`](un-ts/eslint-plugin-import-x@d228129) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix `newline-after-import`'s `considerComments` options when linting `require`, backports import-js/eslint-plugin-import#2952

-   [#147](un-ts/eslint-plugin-import-x#147) [`eca73ed`](un-ts/eslint-plugin-import-x@eca73ed) Thanks [@nchevsky](https://github.com/nchevsky)! - Fix regression in rule `no-unused-modules` which would incorrectly initialize option `src` to `[]` instead of `[process.cwd()]`, breaking file discovery.

-   [#148](un-ts/eslint-plugin-import-x#148) [`d228129`](un-ts/eslint-plugin-import-x@d228129) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix `no-duplicates` for TypeScript, backports import-js/eslint-plugin-import#3033
##### [v4.2.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#420)

##### Minor Changes

-   [#142](un-ts/eslint-plugin-import-x#142) [`f12447e`](un-ts/eslint-plugin-import-x@f12447e) Thanks [@Zamiell](https://github.com/Zamiell)! - Add new option "whitelist" for rule "no-extraneous-dependencies"

##### Patch Changes

-   [#146](un-ts/eslint-plugin-import-x#146) [`e5e4580`](un-ts/eslint-plugin-import-x@e5e4580) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix nuxt/eslint#494 by avoid importing from `@typescript-eslint/typescript-estree`.
##### [v4.1.1](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#411)

##### Patch Changes

-   [#133](un-ts/eslint-plugin-import-x#133) [`757ffa9`](un-ts/eslint-plugin-import-x@757ffa9) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix [#123](un-ts/eslint-plugin-import-x#123) where the rule `no-named-as-default` will confuse TypeScript namespace exports with actual exports.
##### [v4.1.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#410)

##### Minor Changes

-   [#122](un-ts/eslint-plugin-import-x#122) [`cd52e86`](un-ts/eslint-plugin-import-x@cd52e86) Thanks [@michaelfaith](https://github.com/michaelfaith)! - Add ESLint flat configuration presets. You can access them with:

    ```ts
    import eslintPluginImportX from "eslint-plugin-import-x";

    eslintPluginImportX.flatConfigs.recommended;
    eslintPluginImportX.flatConfigs.react;
    eslintPluginImportX.flatConfigs.typescript;
    eslintPluginImportX.flatConfigs.electron;
    ```

-   [#132](un-ts/eslint-plugin-import-x#132) [`9948c78`](un-ts/eslint-plugin-import-x@9948c78) Thanks [@SukkaW](https://github.com/SukkaW)! - Added `no-rename-default` that forbid importing a default export by a different name. Originally created by [@whitneyit](https://github.com/whitneyit), ported by [@SukkaW](https://github.com/SukkaW)
##### [v4.0.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#400)

##### Major Changes

-   [#112](un-ts/eslint-plugin-import-x#112) [`4ba14da`](un-ts/eslint-plugin-import-x@4ba14da) Thanks [@SukkaW](https://github.com/SukkaW)! - Use typescript-eslint v8. The minimum supported ESLint version is now >= 8.57.0 and the minimum required Node.js version is now 18.18.0.
renovate bot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull request Sep 17, 2024
##### [v4.2.1](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#421)

##### Patch Changes

-   [#148](un-ts/eslint-plugin-import-x#148) [`d228129`](un-ts/eslint-plugin-import-x@d228129) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix `newline-after-import`'s `considerComments` options when linting `require`, backports import-js/eslint-plugin-import#2952

-   [#147](un-ts/eslint-plugin-import-x#147) [`eca73ed`](un-ts/eslint-plugin-import-x@eca73ed) Thanks [@nchevsky](https://github.com/nchevsky)! - Fix regression in rule `no-unused-modules` which would incorrectly initialize option `src` to `[]` instead of `[process.cwd()]`, breaking file discovery.

-   [#148](un-ts/eslint-plugin-import-x#148) [`d228129`](un-ts/eslint-plugin-import-x@d228129) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix `no-duplicates` for TypeScript, backports import-js/eslint-plugin-import#3033
##### [v4.2.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#420)

##### Minor Changes

-   [#142](un-ts/eslint-plugin-import-x#142) [`f12447e`](un-ts/eslint-plugin-import-x@f12447e) Thanks [@Zamiell](https://github.com/Zamiell)! - Add new option "whitelist" for rule "no-extraneous-dependencies"

##### Patch Changes

-   [#146](un-ts/eslint-plugin-import-x#146) [`e5e4580`](un-ts/eslint-plugin-import-x@e5e4580) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix nuxt/eslint#494 by avoid importing from `@typescript-eslint/typescript-estree`.
##### [v4.1.1](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#411)

##### Patch Changes

-   [#133](un-ts/eslint-plugin-import-x#133) [`757ffa9`](un-ts/eslint-plugin-import-x@757ffa9) Thanks [@SukkaW](https://github.com/SukkaW)! - Fix [#123](un-ts/eslint-plugin-import-x#123) where the rule `no-named-as-default` will confuse TypeScript namespace exports with actual exports.
##### [v4.1.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#410)

##### Minor Changes

-   [#122](un-ts/eslint-plugin-import-x#122) [`cd52e86`](un-ts/eslint-plugin-import-x@cd52e86) Thanks [@michaelfaith](https://github.com/michaelfaith)! - Add ESLint flat configuration presets. You can access them with:

    ```ts
    import eslintPluginImportX from "eslint-plugin-import-x";

    eslintPluginImportX.flatConfigs.recommended;
    eslintPluginImportX.flatConfigs.react;
    eslintPluginImportX.flatConfigs.typescript;
    eslintPluginImportX.flatConfigs.electron;
    ```

-   [#132](un-ts/eslint-plugin-import-x#132) [`9948c78`](un-ts/eslint-plugin-import-x@9948c78) Thanks [@SukkaW](https://github.com/SukkaW)! - Added `no-rename-default` that forbid importing a default export by a different name. Originally created by [@whitneyit](https://github.com/whitneyit), ported by [@SukkaW](https://github.com/SukkaW)
##### [v4.0.0](https://github.com/un-ts/eslint-plugin-import-x/blob/HEAD/CHANGELOG.md#400)

##### Major Changes

-   [#112](un-ts/eslint-plugin-import-x#112) [`4ba14da`](un-ts/eslint-plugin-import-x@4ba14da) Thanks [@SukkaW](https://github.com/SukkaW)! - Use typescript-eslint v8. The minimum supported ESLint version is now >= 8.57.0 and the minimum required Node.js version is now 18.18.0.
Cruikshanks added a commit to DEFRA/water-abstraction-system that referenced this pull request Nov 14, 2024
Or I think so. One thing I'm concious we're missing is our extra rule that enforces `.js` when requiring files. We were getting this from [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) via StandardJS using the `'import/extensions': ['error', 'always']` rule in our old config.

neostandard does not currently include eslint-plugin-import or the rules StandardJS was using from it. This is because it didn't support ESLint's flat-file config [until recently](un-ts/eslint-plugin-import-x#122).

neostandard has a [PR open](neostandard/neostandard#197) that re-enables the 'import' rules. At which point we can piggy back again and add our extra 'import/extensions'.

Activity looks good so I'm inclined to go without in the short term and wait for the PR to be merged and neostandard to be updated.
Cruikshanks added a commit to DEFRA/water-abstraction-system that referenced this pull request Nov 22, 2024
Or I think so. One thing I'm concious we're missing is our extra rule that enforces `.js` when requiring files. We were getting this from [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) via StandardJS using the `'import/extensions': ['error', 'always']` rule in our old config.

neostandard does not currently include eslint-plugin-import or the rules StandardJS was using from it. This is because it didn't support ESLint's flat-file config [until recently](un-ts/eslint-plugin-import-x#122).

neostandard has a [PR open](neostandard/neostandard#197) that re-enables the 'import' rules. At which point we can piggy back again and add our extra 'import/extensions'.

Activity looks good so I'm inclined to go without in the short term and wait for the PR to be merged and neostandard to be updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support eslint flat config
4 participants