From 1fb8319366e0d6bb463c3e2d0d1648bbfdbcfb78 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Fri, 21 Jul 2023 13:39:49 -0400 Subject: [PATCH 1/9] fix: blog typo --- .../2023-07-09-announcing-typescript-eslint-v6.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md index e79664a58748..f69e7aa6d2b4 100644 --- a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md +++ b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md @@ -619,7 +619,7 @@ For more information, see: ### Package Exports -The v5 `@typescript-eslint/` packages don't use [Node.js package.json exports](https://nodejs.org/api/packages.html#package-entry-points), so anyone can import any file in any package by directly referencing a path within the dist folder. +The v5 `@typescript-eslint/` packages don't use [Node.js package.json exports](https://nodejs.org/api/packages.html#package-entry-points), which allows someone to import any file in any package by directly referencing a path within the `dist` directory. For example: ```ts @@ -628,19 +628,21 @@ import * as TSESLint from '@typescript-eslint/utils/dist/ts-eslint'; That presents a few issues for developers: -- It can be unclear which of many potential import paths to use -- TypeScript sometimes suggests importing types or values meant to be private -- Consumers using deep import paths can be broken by internal refactors that rename files +- It can be unclear which of many potential import paths to use. +- TypeScript sometimes suggests importing types or values meant to be private. +- Consumers using deep import paths might get broken code after internal refactors rename files. As of [feat: add package.json exports for public packages](https://github.com/typescript-eslint/typescript-eslint/pull/6458), `@typescript-eslint/*` packages now use `exports` to prevent importing internal file paths. -Developers must now mostly import directly from the package names, e.g.: +Developers must now mostly import directly from the package names. For example, to fix the code from the previous example, you would use the following: ```ts -import * as TSESLint from '@typescript-eslint/ts-eslint'; +import * as TSESLint from '@typescript-eslint/utils'; ``` See [RFC: Use package.json exports to "hide" the dist folder for packages and control our exported surface-area](https://github.com/typescript-eslint/typescript-eslint/discussions/6015) for more backing context. +Note that if you update your imports and you still get an error from TypeScript saying "Cannot find module '@typescript-eslint/utils' or its corresponding type declarations", then you might need to change the value of `moduleResolution` to `node16` in your TypeScript config, as detailed in [this issue](https://github.com/typescript-eslint/typescript-eslint/issues/7279). + ### Other Developer-Facing Breaking Changes - [feat(utils): remove (ts-)eslint-scope types](https://github.com/typescript-eslint/typescript-eslint/pull/5256): Removes no-longer-useful `TSESLintScope` types from the `@typescript-eslint/utils` package. Use `@typescript-eslint/scope-manager` directly instead. From 40dd58c23c03e6e6f1b1e592e7df76627cd6d247 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Fri, 21 Jul 2023 14:15:24 -0400 Subject: [PATCH 2/9] Update packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Josh Goldberg ✨ --- .../blog/2023-07-09-announcing-typescript-eslint-v6.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md index f69e7aa6d2b4..b67f9a93d684 100644 --- a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md +++ b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md @@ -641,7 +641,9 @@ import * as TSESLint from '@typescript-eslint/utils'; See [RFC: Use package.json exports to "hide" the dist folder for packages and control our exported surface-area](https://github.com/typescript-eslint/typescript-eslint/discussions/6015) for more backing context. -Note that if you update your imports and you still get an error from TypeScript saying "Cannot find module '@typescript-eslint/utils' or its corresponding type declarations", then you might need to change the value of `moduleResolution` to `node16` in your TypeScript config, as detailed in [this issue](https://github.com/typescript-eslint/typescript-eslint/issues/7279). +:::note +If you update your imports and you still get an error from TypeScript saying _`"Cannot find module '@typescript-eslint/...' or its corresponding type declarations"`_, then you might need to change the value of `moduleResolution` in your TypeScript config. See [this tracking issue for `package.json` exports types](https://github.com/typescript-eslint/typescript-eslint/issues/7284). +::: ### Other Developer-Facing Breaking Changes From 7a7b78d8ca411169610ee4c3dcd3f24465750e2f Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Tue, 25 Jul 2023 16:16:54 -0400 Subject: [PATCH 3/9] Update packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Josh Goldberg ✨ --- .../website/blog/2023-07-09-announcing-typescript-eslint-v6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md index b67f9a93d684..ebea7c87894d 100644 --- a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md +++ b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md @@ -619,7 +619,7 @@ For more information, see: ### Package Exports -The v5 `@typescript-eslint/` packages don't use [Node.js package.json exports](https://nodejs.org/api/packages.html#package-entry-points), which allows someone to import any file in any package by directly referencing a path within the `dist` directory. +The v5 `@typescript-eslint/*` packages don't use [Node.js package.json exports](https://nodejs.org/api/packages.html#package-entry-points), which allows importing any file in any package by directly referencing a path within the package's `dist/` directory. For example: ```ts From 72ebf533b7b5052b4e2691375796ec30f93bea78 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Tue, 25 Jul 2023 16:19:06 -0400 Subject: [PATCH 4/9] Update 2023-07-09-announcing-typescript-eslint-v6.md --- .../website/blog/2023-07-09-announcing-typescript-eslint-v6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md index ebea7c87894d..87c1bd4619a9 100644 --- a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md +++ b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md @@ -630,7 +630,7 @@ That presents a few issues for developers: - It can be unclear which of many potential import paths to use. - TypeScript sometimes suggests importing types or values meant to be private. -- Consumers using deep import paths might get broken code after internal refactors rename files. +- Consumers using deep import paths can be broken by internal refactors that rename files. As of [feat: add package.json exports for public packages](https://github.com/typescript-eslint/typescript-eslint/pull/6458), `@typescript-eslint/*` packages now use `exports` to prevent importing internal file paths. Developers must now mostly import directly from the package names. For example, to fix the code from the previous example, you would use the following: From 9bd6f5492f5ad5c6b79c6f72c63715913d616f63 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Tue, 25 Jul 2023 16:21:00 -0400 Subject: [PATCH 5/9] Update 2023-07-09-announcing-typescript-eslint-v6.md --- .../website/blog/2023-07-09-announcing-typescript-eslint-v6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md index 87c1bd4619a9..6054595c7b27 100644 --- a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md +++ b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md @@ -633,7 +633,7 @@ That presents a few issues for developers: - Consumers using deep import paths can be broken by internal refactors that rename files. As of [feat: add package.json exports for public packages](https://github.com/typescript-eslint/typescript-eslint/pull/6458), `@typescript-eslint/*` packages now use `exports` to prevent importing internal file paths. -Developers must now mostly import directly from the package names. For example, to fix the code from the previous example, you would use the following: +Developers must now import directly from the package names. e.g.: ```ts import * as TSESLint from '@typescript-eslint/utils'; From 9d9e4bf81f0d7c515eea6e179db7d8c975971ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Wed, 26 Jul 2023 07:51:53 -0500 Subject: [PATCH 6/9] Update packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md --- .../website/blog/2023-07-09-announcing-typescript-eslint-v6.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md index 6054595c7b27..45582ed6e778 100644 --- a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md +++ b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md @@ -633,7 +633,7 @@ That presents a few issues for developers: - Consumers using deep import paths can be broken by internal refactors that rename files. As of [feat: add package.json exports for public packages](https://github.com/typescript-eslint/typescript-eslint/pull/6458), `@typescript-eslint/*` packages now use `exports` to prevent importing internal file paths. -Developers must now import directly from the package names. e.g.: +Developers must now mostly import directly from the package names, e.g.: ```ts import * as TSESLint from '@typescript-eslint/utils'; From 0cdd2323106fb03ace2dd67483259fa6de4b0181 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:02:54 -0400 Subject: [PATCH 7/9] docs: add AST info --- packages/eslint-plugin/docs/rules/no-extra-semi.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/no-extra-semi.md b/packages/eslint-plugin/docs/rules/no-extra-semi.md index 086bd87f450a..85c713e3bb15 100644 --- a/packages/eslint-plugin/docs/rules/no-extra-semi.md +++ b/packages/eslint-plugin/docs/rules/no-extra-semi.md @@ -10,3 +10,5 @@ description: 'Disallow unnecessary semicolons.' This rule extends the base [`eslint/no-extra-semi`](https://eslint.org/docs/rules/no-extra-semi) rule. It adds support for class properties. + +Note that this rule is classified as a "Suggestion" rule instead of a "Layout & Formatting" rule because [adding extra semi-colons actually changes the AST of the program](https://typescript-eslint.io/play/#ts=5.1.6&showAST=es&fileType=.ts&code=MYewdgzgLgBAHjAvDAjAbg0A&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaRADwBdoBDQ5RAWwEt0p8AzVyAGnG0gAEyATwAOKAMbQGwssWTwGuMgHoCxclRr0mGSImjR80SDwC%2BIE0A&tsconfig=&tokens=false). With that said, modern TypeScript formatters will remove extra semi-colons automatically during the formatting process. Thus, if you use a formatter, then enabling this rule is probably unnecessary. From a9ea609efcfaab936abd86bb5fcccefbd29d55ea Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:06:39 -0400 Subject: [PATCH 8/9] fix: remove other pr --- .../2023-07-09-announcing-typescript-eslint-v6.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md index 7d0ad7bc3c36..c4a5d6b7d3b5 100644 --- a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md +++ b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md @@ -620,7 +620,7 @@ For more information, see: ### Package Exports -The v5 `@typescript-eslint/*` packages don't use [Node.js package.json exports](https://nodejs.org/api/packages.html#package-entry-points), which allows importing any file in any package by directly referencing a path within the package's `dist/` directory. +The v5 `@typescript-eslint/` packages don't use [Node.js package.json exports](https://nodejs.org/api/packages.html#package-entry-points), so anyone can import any file in any package by directly referencing a path within the dist folder. For example: ```ts @@ -629,23 +629,19 @@ import * as TSESLint from '@typescript-eslint/utils/dist/ts-eslint'; That presents a few issues for developers: -- It can be unclear which of many potential import paths to use. -- TypeScript sometimes suggests importing types or values meant to be private. -- Consumers using deep import paths can be broken by internal refactors that rename files. +- It can be unclear which of many potential import paths to use +- TypeScript sometimes suggests importing types or values meant to be private +- Consumers using deep import paths can be broken by internal refactors that rename files As of [feat: add package.json exports for public packages](https://github.com/typescript-eslint/typescript-eslint/pull/6458), `@typescript-eslint/*` packages now use `exports` to prevent importing internal file paths. Developers must now mostly import directly from the package names, e.g.: ```ts -import * as TSESLint from '@typescript-eslint/utils'; +import * as TSESLint from '@typescript-eslint/utils/ts-eslint'; ``` See [RFC: Use package.json exports to "hide" the dist folder for packages and control our exported surface-area](https://github.com/typescript-eslint/typescript-eslint/discussions/6015) for more backing context. -:::note -If you update your imports and you still get an error from TypeScript saying _`"Cannot find module '@typescript-eslint/...' or its corresponding type declarations"`_, then you might need to change the value of `moduleResolution` in your TypeScript config. See [this tracking issue for `package.json` exports types](https://github.com/typescript-eslint/typescript-eslint/issues/7284). -::: - ### Other Developer-Facing Breaking Changes - [feat(utils): remove (ts-)eslint-scope types](https://github.com/typescript-eslint/typescript-eslint/pull/5256): Removes no-longer-useful `TSESLintScope` types from the `@typescript-eslint/utils` package. Use `@typescript-eslint/scope-manager` directly instead. From 3ed084d91af4e05234332d8dcc3c50ec97ef0194 Mon Sep 17 00:00:00 2001 From: James <5511220+Zamiell@users.noreply.github.com> Date: Fri, 28 Jul 2023 11:43:36 -0400 Subject: [PATCH 9/9] Update packages/eslint-plugin/docs/rules/no-extra-semi.md Co-authored-by: Brad Zacher --- packages/eslint-plugin/docs/rules/no-extra-semi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/no-extra-semi.md b/packages/eslint-plugin/docs/rules/no-extra-semi.md index 85c713e3bb15..29de19e6dfff 100644 --- a/packages/eslint-plugin/docs/rules/no-extra-semi.md +++ b/packages/eslint-plugin/docs/rules/no-extra-semi.md @@ -11,4 +11,4 @@ description: 'Disallow unnecessary semicolons.' This rule extends the base [`eslint/no-extra-semi`](https://eslint.org/docs/rules/no-extra-semi) rule. It adds support for class properties. -Note that this rule is classified as a "Suggestion" rule instead of a "Layout & Formatting" rule because [adding extra semi-colons actually changes the AST of the program](https://typescript-eslint.io/play/#ts=5.1.6&showAST=es&fileType=.ts&code=MYewdgzgLgBAHjAvDAjAbg0A&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaRADwBdoBDQ5RAWwEt0p8AzVyAGnG0gAEyATwAOKAMbQGwssWTwGuMgHoCxclRr0mGSImjR80SDwC%2BIE0A&tsconfig=&tokens=false). With that said, modern TypeScript formatters will remove extra semi-colons automatically during the formatting process. Thus, if you use a formatter, then enabling this rule is probably unnecessary. +Note that this rule is classified as a "Suggestion" rule instead of a "Layout & Formatting" rule because [adding extra semi-colons actually changes the AST of the program](https://typescript-eslint.io/play/#ts=5.1.6&showAST=es&fileType=.ts&code=MYewdgzgLgBAHjAvDAjAbg0A&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaRADwBdoBDQ5RAWwEt0p8AzVyAGnG0gAEyATwAOKAMbQGwssWTwGuMgHoCxclRr0mGSImjR80SDwC%2BIE0A&tsconfig=&tokens=false). With that said, modern TypeScript formatters will remove extra semi-colons automatically during the formatting process. Thus, if you [use a formatter](/linting/troubleshooting/formatting), then enabling this rule is probably unnecessary.