From ae7432fb00f31bc5d7a24d77ea89d54d875081fd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 19 Dec 2024 06:24:58 +0000 Subject: [PATCH] chore: release eslint-plugin-import-x --- .changeset/tame-melons-notice.md | 5 --- .changeset/witty-garlics-destroy.md | 52 -------------------------- CHANGELOG.md | 57 +++++++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 58 insertions(+), 58 deletions(-) delete mode 100644 .changeset/tame-melons-notice.md delete mode 100644 .changeset/witty-garlics-destroy.md diff --git a/.changeset/tame-melons-notice.md b/.changeset/tame-melons-notice.md deleted file mode 100644 index b13398c7..00000000 --- a/.changeset/tame-melons-notice.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"eslint-plugin-import-x": patch ---- - -insert type prefix without new line diff --git a/.changeset/witty-garlics-destroy.md b/.changeset/witty-garlics-destroy.md deleted file mode 100644 index ac826a23..00000000 --- a/.changeset/witty-garlics-destroy.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -"eslint-plugin-import-x": minor ---- - -When `eslint-plugin-import-x` was forked from `eslint-plugin-import`, we copied over the default resolver (which is `eslint-import-resolver-node`) as well. However, this resolver doesn't supports `exports` in the `package.json` file, and the current maintainer of the `eslint-import-resolver-node` (ljharb) doesn't have the time implementing this feature and he locked the issue https://github.com/import-js/eslint-plugin-import/issues/1810. - -So we decided to implement our own resolver that "just works". The new resolver is built upon the [`enhanced-resolve`](https://www.npmjs.com/package/enhanced-resolve) that implements the full Node.js [Resolver Algorithm](https://nodejs.org/dist/v14.21.3/docs/api/esm.html#esm_resolver_algorithm). The new resolver only implements the import resolver interface v3, which means you can only use it with ESLint Flat config. For more details about the import resolver interface v3, please check out [#192](https://github.com/un-ts/eslint-plugin-import-x/pull/192). - -In the next major version of `eslint-plugin-import-x`, we will remove the `eslint-import-resolver-node` and use this new resolver by default. In the meantime, you can try out this new resolver by setting the `import-x/resolver-next` option in your `eslint.config.js` file: - -```js -// eslint.config.js -const eslintPluginImportX = require('eslint-plugin-import-x'); -const { createNodeResolver } = eslintPluginImportX; - -module.exports = { - plugins: { - 'import-x': eslintPluginImportX, - }, - settings: { - 'import-x/resolver-next': [ - // This is the new resolver we are introducing - createNodeResolver({ - /** - * The allowed extensions the resolver will attempt to find when resolving a module - * By default it uses a relaxed extension list to search for both ESM and CJS modules - * You can customize this list to fit your needs - * - * @default ['.mjs', '.cjs', '.js', '.json', '.node'] - */ - extensions?: string[]; - /** - * Optional, the import conditions the resolver will used when reading the exports map from "package.json" - * By default it uses a relaxed condition list to search for both ESM and CJS modules - * You can customize this list to fit your needs - * - * @default ['default', 'module', 'import', 'require'] - */ - conditions: ['default', 'module', 'import', 'require'], - // You can pass more options here, see the enhanced-resolve documentation for more details - // https://github.com/webpack/enhanced-resolve/tree/v5.17.1?tab=readme-ov-file#resolver-options - }), - // you can add more resolvers down below - require('eslint-import-resolver-typescript').createTypeScriptImportResolver( - /** options of eslint-import-resolver-typescript */ - ) - ], - }, -}; -``` - -We do not plan to implement reading `baseUrl` and `paths` from the `tsconfig.json` file in this resolver. If you need this feature, please checkout [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript) (also powered by `enhanced-resolve`), [eslint-import-resolver-oxc](https://www.npmjs.com/package/eslint-import-resolver-oxc) (powered by `oxc-resolver`), [eslint-import-resolver-next](https://www.npmjs.com/package/eslint-import-resolver-next) (also powered by `oxc-resolver`), or other similar resolvers. diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d77596a..25d9588c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,62 @@ # eslint-plugin-import-x +## 4.6.0 + +### Minor Changes + +- [#209](https://github.com/un-ts/eslint-plugin-import-x/pull/209) [`46d2360`](https://github.com/un-ts/eslint-plugin-import-x/commit/46d2360f5ebfbd79e74a0828ac7e280973510454) Thanks [@SukkaW](https://github.com/SukkaW)! - When `eslint-plugin-import-x` was forked from `eslint-plugin-import`, we copied over the default resolver (which is `eslint-import-resolver-node`) as well. However, this resolver doesn't supports `exports` in the `package.json` file, and the current maintainer of the `eslint-import-resolver-node` (ljharb) doesn't have the time implementing this feature and he locked the issue https://github.com/import-js/eslint-plugin-import/issues/1810. + + So we decided to implement our own resolver that "just works". The new resolver is built upon the [`enhanced-resolve`](https://www.npmjs.com/package/enhanced-resolve) that implements the full Node.js [Resolver Algorithm](https://nodejs.org/dist/v14.21.3/docs/api/esm.html#esm_resolver_algorithm). The new resolver only implements the import resolver interface v3, which means you can only use it with ESLint Flat config. For more details about the import resolver interface v3, please check out [#192](https://github.com/un-ts/eslint-plugin-import-x/pull/192). + + In the next major version of `eslint-plugin-import-x`, we will remove the `eslint-import-resolver-node` and use this new resolver by default. In the meantime, you can try out this new resolver by setting the `import-x/resolver-next` option in your `eslint.config.js` file: + + ```js + // eslint.config.js + const eslintPluginImportX = require('eslint-plugin-import-x'); + const { createNodeResolver } = eslintPluginImportX; + + module.exports = { + plugins: { + 'import-x': eslintPluginImportX, + }, + settings: { + 'import-x/resolver-next': [ + // This is the new resolver we are introducing + createNodeResolver({ + /** + * The allowed extensions the resolver will attempt to find when resolving a module + * By default it uses a relaxed extension list to search for both ESM and CJS modules + * You can customize this list to fit your needs + * + * @default ['.mjs', '.cjs', '.js', '.json', '.node'] + */ + extensions?: string[]; + /** + * Optional, the import conditions the resolver will used when reading the exports map from "package.json" + * By default it uses a relaxed condition list to search for both ESM and CJS modules + * You can customize this list to fit your needs + * + * @default ['default', 'module', 'import', 'require'] + */ + conditions: ['default', 'module', 'import', 'require'], + // You can pass more options here, see the enhanced-resolve documentation for more details + // https://github.com/webpack/enhanced-resolve/tree/v5.17.1?tab=readme-ov-file#resolver-options + }), + // you can add more resolvers down below + require('eslint-import-resolver-typescript').createTypeScriptImportResolver( + /** options of eslint-import-resolver-typescript */ + ) + ], + }, + }; + ``` + + We do not plan to implement reading `baseUrl` and `paths` from the `tsconfig.json` file in this resolver. If you need this feature, please checkout [eslint-import-resolver-typescript](https://www.npmjs.com/package/eslint-import-resolver-typescript) (also powered by `enhanced-resolve`), [eslint-import-resolver-oxc](https://www.npmjs.com/package/eslint-import-resolver-oxc) (powered by `oxc-resolver`), [eslint-import-resolver-next](https://www.npmjs.com/package/eslint-import-resolver-next) (also powered by `oxc-resolver`), or other similar resolvers. + +### Patch Changes + +- [#206](https://github.com/un-ts/eslint-plugin-import-x/pull/206) [`449738f`](https://github.com/un-ts/eslint-plugin-import-x/commit/449738f4f4b84ff24c2748cdc86185cff5840442) Thanks [@privatenumber](https://github.com/privatenumber)! - insert type prefix without new line + ## 4.5.1 ### Patch Changes diff --git a/package.json b/package.json index 3029b14a..9485d468 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-import-x", - "version": "4.5.1", + "version": "4.6.0", "description": "Import with sanity.", "repository": "git+https://github.com/un-ts/eslint-plugin-import-x", "author": "JounQin (https://www.1stG.me)",