From fd825f1b774e7016986f5251b2093dd93254d532 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 28 Apr 2024 12:34:25 -0400 Subject: [PATCH 01/27] docs: add v8 beta blog post --- .cspell.json | 1 + ...ed-rule-docs-with-docusaurus-and-remark.md | 2 +- ...nt-type-exports-and-imports-why-and-how.md | 2 +- ...13-announcing-typescript-eslint-v6-beta.md | 2 +- ...3-07-09-announcing-typescript-eslint-v6.md | 2 +- ...30-announcing-typescript-eslint-v8-beta.md | 226 ++++++++++++++++++ 6 files changed, 231 insertions(+), 4 deletions(-) create mode 100644 packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md diff --git a/.cspell.json b/.cspell.json index dc41dd9403fb..669e0e499892 100644 --- a/.cspell.json +++ b/.cspell.json @@ -99,6 +99,7 @@ "lzstring", "markdownlint", "metastring", + "multipass", "necroing", "nocheck", "noninteractive", diff --git a/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md b/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md index a1c5d205a025..787730c36bc3 100644 --- a/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md +++ b/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md @@ -223,6 +223,6 @@ Thanks Joshua! 🤗 ## Supporting typescript-eslint -If you enjoyed this blog post and/or or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). +If you enjoyed this blog post and/or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). We're a small volunteer team and could use your support to make the ESLint experience on TypeScript great. Thanks! 💖 diff --git a/packages/website/blog/2023-02-24-consistent-type-exports-and-imports-why-and-how.md b/packages/website/blog/2023-02-24-consistent-type-exports-and-imports-why-and-how.md index 5e0f1e02de58..c87f5670c65e 100644 --- a/packages/website/blog/2023-02-24-consistent-type-exports-and-imports-why-and-how.md +++ b/packages/website/blog/2023-02-24-consistent-type-exports-and-imports-why-and-how.md @@ -186,6 +186,6 @@ See [our Getting Started docs](/getting-started) for more information on linting ## Supporting typescript-eslint -If you enjoyed this blog post and/or or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). +If you enjoyed this blog post and/or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). We're a small volunteer team and could use your support to make the ESLint experience on TypeScript great. Thanks! 💖 diff --git a/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md b/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md index 38f9f289d03f..c67f3da1e10c 100644 --- a/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md +++ b/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md @@ -377,6 +377,6 @@ See the [v6.0.0 milestone](https://github.com/typescript-eslint/typescript-eslin ## Supporting typescript-eslint -If you enjoyed this blog post and/or or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). +If you enjoyed this blog post and/or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). We're a small volunteer team and could use your support to make the ESLint experience on TypeScript great. Thanks! 💖 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 e0352744d189..ae8b6f5f5096 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 @@ -702,6 +702,6 @@ See the [v6.0.0 milestone](https://github.com/typescript-eslint/typescript-eslin ## Supporting typescript-eslint -If you enjoyed this blog post and/or or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). +If you enjoyed this blog post and/or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). We're a small volunteer team and could use your support to make the ESLint experience on TypeScript great. Thanks! 💖 diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md new file mode 100644 index 000000000000..61472ec43604 --- /dev/null +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md @@ -0,0 +1,226 @@ +--- +authors: + - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + name: Josh Goldberg + title: typescript-eslint Maintainer + url: https://github.com/JoshuaKGoldberg +description: Announcing the release of typescript-eslint's v8 beta, including its changes and timeline. +slug: announcing-typescript-eslint-v8-beta +tags: [breaking changes, typescript-eslint, v7, v8] +title: Announcing typescript-eslint v8 Beta +--- + +[typescript-eslint](https://typescript-eslint.io) is the tooling that enables standard JavaScript tools such as [ESLint](https://eslint.org) and [Prettier](https://prettier.io) to support TypeScript code. +We've been working on a set of breaking changes and general features that we're excited to get in front of users soon. +And now, we're excited to say that typescript-eslint v8 is ready for public beta testing! 🎉 + +Our plan for typescript-eslint v8 is to: + +1. Have users try out betas starting in May of 2024 +2. Respond to user feedback for the next ~1-2 months +3. Release a stable version summer of 2024 + +Nothing mentioned in this blog post is set in stone. +If you feel passionately about any of the choices we've made here -positively or negatively- then do let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)'s `#v8` channel! + + + +## Trying Out v8 + +Please do try out the typescript-eslint v8 beta! + +### As A New User + +If you don't yet use typescript-eslint, you can go through our [configuration steps on the v8 _Getting Started_ docs](https://v8--typescript-eslint.netlify.app/getting-started). +It'll walk you through setting up typescript-eslint in a project. + +To use v8 specifically, see the following section for an updated install command. + +### As An Existing User + +If you already use typescript-eslint, you'll need to first replace your package's previous versions of `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` with `@rc-v8` versions: + +```shell +npm i @typescript-eslint/eslint-plugin@rc-v8 @typescript-eslint/parser@rc-v8 --save-dev +``` + +We highly recommend then basing your ESLint configuration on the reworked typescript-eslint [recommended configurations mentioned later in this post](#reworked-configuration-names) — especially if it's been a while since you've reworked your linter config. + +## User-Facing Changes + +These are the changes that users of typescript-eslint -generally, any developer running ESLint on TypeScript code- should pay attention to when upgrading typescript-eslint from v7 to v8. + +> ⏳ indicates a change that has been scheduled for v8 but not yet released. +> We'll update this blog post as the corresponding pull requests land. + +### ⏳ ESLint v9 Support + +typescript-eslint v8 ships will full support for ESLint v9. + +typescript-eslint v7 was our first version that supported ESLint's [new "flat" config file format](https://eslint.org/docs/latest/use/configure/configuration-files), which was already available in ESLint v8. +ESLint v9 still supports ESLint's [older legacy config file format](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated) so our tooling does as well. +However, ESLint v9 also includes a set of breaking changes that we added support for in typescript-eslint v8. +See the [ESLint v9 release blog post](https://eslint.org/blog/2024/04/eslint-v9.0.0-released) and for more details. + +### ⏳ Project Service + +The biggest new feature added in this version is the stability of our new "project service". +In short, the project service is a new way to enable [typed linting](/getting-started/typed-linting) that is generally _easier to configure_ and _faster at runtime_ than our previous offerings. +It's been experimentally available since v6.1.0 under the name `EXPERIMENTAL_useProjectService`; now, we've renamed it to `projectService`. + +You can use the new project service in your configuration instead of the previous `parserOptions.project`: + +```js title="eslint.config.js" +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + { + languageOptions: { + parserOptions: { + // Remove this line + project: true, + // Add this line + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + }, +); +``` + +The project service will automatically find the closest `tsconfig.json` for each file (like `project: true`). +It also allows enabling typed linting for files not explicitly included in a `tsconfig.json`. +This should remove the need for custom `tsconfig.eslint.json` files to lint files like `eslint.config.js`! + +```js title="eslint.config.js" +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + { + languageOptions: { + parserOptions: { + // Remove this line + project: ['packages/*/tsconfig.json', 'tsconfig.eslint.json'], + // Add this line + projectService: { + allowDefaultProjectForFiles: ['./*.js'], + defaultProject: './tsconfig.json', + }, + tsconfigRootDir: import.meta.dirname, + }, + }, + }, +); +``` + +Internally, the project service uses the same TypeScript APIs that editors such as VS Code use. +Doing so should make it harder to accidentally configure different type information for ESLint than what you see in day-to-day editing. + +We're thrilled to have this option promoted to stable in v8. +We'll soon release a [dedicated `parserOptions` blog post](https://github.com/typescript-eslint/typescript-eslint/pull/8031) walking through the new option in more details. + +### Updated Configuration Rules + +Every new major version of typescript-eslint comes with changes to which rules are enabled in the preset configurations - and with which options. +Because this release also includes a reworking of the configurations themselves, the list of changes is too large to put in this blog post. +Instead see the table in [Changes to configurations for 8.0.0](https://github.com/typescript-eslint/typescript-eslint/discussions/8914) for a full list of the changes. + +Please do try out the new rule configurations presets and let us know in that discussion! + +:::tip +If your ESLint configuration contains many `rules` configurations, we suggest the following strategy to start anew: + +1. Remove all your rules configurations +2. Extend from the preset configs that make sense for you +3. Run ESLint on your project +4. In your ESLint configuration, turn off any rules creating errors that don't make sense for your project - with comments explaining why +5. In your ESLint configuration and/or with inline `eslint-disable` comments, turn off any rules creating too many errors for you to fix - with _"TODO"_ comments linking to tracking issues/tickets to re-enable them + +::: + +### Rule Breaking Changes + +Several rules were changed in significant enough ways to be considered breaking changes: + +- ⏳ [Rules: Deprecate prefer-ts-expect-error in favor of ban-ts-comment](https://github.com/typescript-eslint/typescript-eslint/issues/8333) +- ⏳ [chore(eslint-plugin): deprecate no-var-requires in favor of no-require-imports](https://github.com/typescript-eslint/typescript-eslint/pull/8334) +- [feat(eslint-plugin): deprecate no-throw-literal and add a renamed only-throw-error](https://github.com/typescript-eslint/typescript-eslint/pull/8701) +- ⏳ [fix(eslint-plugin): [no-useless-template-literals] rename to no-useless-template-expression](https://github.com/typescript-eslint/typescript-eslint/pull/8821) +- [feat(eslint-plugin): deprecate no-loss-of-precision extension rule](https://github.com/typescript-eslint/typescript-eslint/pull/8832) +- [feat(eslint-plugin): remove formatting/layout rules](https://github.com/typescript-eslint/typescript-eslint/pull/8833) +- [feat(eslint-plugin): [prefer-nullish-coalescing] change ignoreConditionalTests default to true](https://github.com/typescript-eslint/typescript-eslint/pull/8872) +- [feat(eslint-plugin): [no-unused-vars] align catch behavior to ESLint 9](https://github.com/typescript-eslint/typescript-eslint/pull/8971) +- ⏳ [feat(eslint-plugin): split no-empty-object-type rule out from ban-types rule](https://github.com/typescript-eslint/typescript-eslint/pull/8977) + +### Tooling Breaking Changes + +- ⏳ [Enhancement: Error if configuration options aren't provided as expected](https://github.com/typescript-eslint/typescript-eslint/issues/6403) +- [fix(typescript-estree): enable dot globs for project by default](https://github.com/typescript-eslint/typescript-eslint/pull/8818) +- [feat(typescript-estree): remove slow deprecated and isolated programs](https://github.com/typescript-eslint/typescript-eslint/pull/8834) +- [feat(typescript-estree): rename automaticSingleRunInference to disallowAutomaticSingleRunInference](https://github.com/typescript-eslint/typescript-eslint/pull/8922) +- [chore: bump minimum versions for v8](https://github.com/typescript-eslint/typescript-eslint/pull/8973) + - ESLint support range was changed from `^8.56.0` to `^8.57.0` + - Node.js support range was changed from `^18.18.0 || >=20.0.0` to `^18.18.0 || ^20.9.0 || >=21.1.0` + - TypeScript support range was changed from `>=4.7.4 <5.5.0` to `>=4.8.4 <5.5.0` + +## Developer-Facing Changes + +typescript-eslint v6 comes with a suite of cleanups and improvements for developers as well. +If you author any ESLint plugins or other tools that interact with TypeScript syntax, then we recommend you try out typescript-eslint v6 soon. +It includes some breaking changes that you may need to accommodate for. + +:::tip +If you're having trouble working with the changes, please let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)'s `#v8` channel! +::: + +### AST Breaking Changes + +These PRs changed the AST shapes generated by typescript-eslint when parsing code. +If you author any ESLint rules that refer to the syntax mentioned by them, these are relevant to you. + +- ⏳ [Enhancement: add strict parent types for nodes that have well-defined parents](https://github.com/typescript-eslint/typescript-eslint/issues/6225) +- [feat(typescript-estree): split TSMappedType typeParameter into constraint and key](https://github.com/typescript-eslint/typescript-eslint/pull/7065) +- ⏳ [feat(ast-spec): remove deprecated type params](https://github.com/typescript-eslint/typescript-eslint/pull/8933) + +### Other Developer-Facing Breaking Changes + +- ⏳ [Repo: Rule [options] parameter should be non-nullable if defaultOptions exists](https://github.com/typescript-eslint/typescript-eslint/issues/5439) +- [feat(parser): always enable comment, loc, range, tokens](https://github.com/typescript-eslint/typescript-eslint/pull/8617) +- ⏳ [feat(rule-tester): support multipass fixes](https://github.com/typescript-eslint/typescript-eslint/pull/8883) +- [chore(type-utils)!: remove IsNullableTypeOptions interface](https://github.com/typescript-eslint/typescript-eslint/pull/8934) +- [feat(utils): swap LegacyESLint out for FlatESLint as ESLint export](https://github.com/typescript-eslint/typescript-eslint/pull/8972) +- [chore(type-utils): remove getTypeArguments](https://github.com/typescript-eslint/typescript-eslint/pull/8938) +- ⏳ [feat(utils): remove deprecated context helpers](https://github.com/typescript-eslint/typescript-eslint/pull/9000) + +## Appreciation + +We'd like to extend a sincere _thank you_ to everybody who pitched in to make typescript-eslint v8 possible. + +- Ourselves on the maintenance team: + - [Auvred](https://github.com/auvred) + - [Armano](https://github.com/armano2) + - [Brad Zacher](https://github.com/bradzacher) + - [James Henry](https://github.com/JamesHenry) + - [Josh Goldberg](https://github.com/JoshuaKGoldberg) + - [Joshua Chen](https://github.com/Josh-Cena) + - [Kirk Waiblinger](https://github.com/kirkwaiblinger) +- Community contributors whose PRs were merged into the 8.0.0 release: + + - [Thomas Huchedé](https://github.com/thuchede) + - [Yukihiro Hasegawa](https://github.com/y-hsgw) + - _(more to come as PRs are merged)_ + + +See the [v8.0.0 milestone](https://github.com/typescript-eslint/typescript-eslint/milestone/9) for the list of issues and associated merged pull requests. + +## Supporting typescript-eslint + +If you enjoyed this blog post and/or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). +We're a small volunteer team and could use your support to make the ESLint experience on TypeScript great. +Thanks! 💖 From 22c443f03b1299ebda9e57a518024e54311ee1f5 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 29 Apr 2024 08:16:48 -0400 Subject: [PATCH 02/27] Mention custom meta.docs --- ...ed-rule-docs-with-docusaurus-and-remark.md | 2 +- .../2022-12-05-asts-and-typescript-eslint.md | 2 +- ...nt-type-exports-and-imports-why-and-how.md | 2 +- ...13-announcing-typescript-eslint-v6-beta.md | 2 +- ...3-07-09-announcing-typescript-eslint-v6.md | 2 +- .../2023-09-18-parser-options-project-true.md | 2 +- ...2023-12-25-deprecating-formatting-rules.md | 2 +- ...30-announcing-typescript-eslint-v8-beta.md | 37 ++++++++++++++++++- 8 files changed, 43 insertions(+), 8 deletions(-) diff --git a/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md b/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md index 787730c36bc3..7606e3e9f364 100644 --- a/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md +++ b/packages/website/blog/2022-09-18-automated-rule-docs-with-docusaurus-and-remark.md @@ -1,6 +1,6 @@ --- authors: - - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + - image_url: /img/team/joshuakgoldberg.jpg name: Josh Goldberg title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg diff --git a/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md b/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md index 5d1abe9bb65b..9fccf0035b25 100644 --- a/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md +++ b/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md @@ -1,6 +1,6 @@ --- authors: - - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + - image_url: /img/team/joshuakgoldberg.jpg name: Josh Goldberg title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg diff --git a/packages/website/blog/2023-02-24-consistent-type-exports-and-imports-why-and-how.md b/packages/website/blog/2023-02-24-consistent-type-exports-and-imports-why-and-how.md index c87f5670c65e..cde68190cd45 100644 --- a/packages/website/blog/2023-02-24-consistent-type-exports-and-imports-why-and-how.md +++ b/packages/website/blog/2023-02-24-consistent-type-exports-and-imports-why-and-how.md @@ -1,6 +1,6 @@ --- authors: - - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + - image_url: /img/team/joshuakgoldberg.jpg name: Josh Goldberg title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg diff --git a/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md b/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md index c67f3da1e10c..49d3bbf416e9 100644 --- a/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md +++ b/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md @@ -1,6 +1,6 @@ --- authors: - - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + - image_url: /img/team/joshuakgoldberg.jpg name: Josh Goldberg title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg 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 ae8b6f5f5096..0920b0047905 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 @@ -1,6 +1,6 @@ --- authors: - - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + - image_url: /img/team/joshuakgoldberg.jpg name: Josh Goldberg title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg diff --git a/packages/website/blog/2023-09-18-parser-options-project-true.md b/packages/website/blog/2023-09-18-parser-options-project-true.md index c767972508ae..d279beae93b3 100644 --- a/packages/website/blog/2023-09-18-parser-options-project-true.md +++ b/packages/website/blog/2023-09-18-parser-options-project-true.md @@ -1,6 +1,6 @@ --- authors: - - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + - image_url: /img/team/joshuakgoldberg.jpg name: Josh Goldberg title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg diff --git a/packages/website/blog/2023-12-25-deprecating-formatting-rules.md b/packages/website/blog/2023-12-25-deprecating-formatting-rules.md index 9bb344ee696f..6767fedc9904 100644 --- a/packages/website/blog/2023-12-25-deprecating-formatting-rules.md +++ b/packages/website/blog/2023-12-25-deprecating-formatting-rules.md @@ -1,6 +1,6 @@ --- authors: - - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + - image_url: /img/team/joshuakgoldberg.jpg name: Josh Goldberg title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md index 61472ec43604..34cf529a0cbf 100644 --- a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md @@ -1,6 +1,6 @@ --- authors: - - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + - image_url: /img/team/joshuakgoldberg.jpg name: Josh Goldberg title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg @@ -188,6 +188,41 @@ If you author any ESLint rules that refer to the syntax mentioned by them, these - [feat(typescript-estree): split TSMappedType typeParameter into constraint and key](https://github.com/typescript-eslint/typescript-eslint/pull/7065) - ⏳ [feat(ast-spec): remove deprecated type params](https://github.com/typescript-eslint/typescript-eslint/pull/8933) +### ⏳ Custom Rule `meta.docs` Types + +`@typescript-eslint/utils` has long exported a [`RuleCreator` utility](https://typescript-eslint.io/developers/custom-rules#rulecreator) for making custom well-typed custom ESLint rules. +That `RuleCreator` is used internally by `@typescript-eslint/eslint-plugin` - and in fact, up through typescript-eslint v7, it hardcoded the same types for rules' `meta.docs` as `@typescript-eslint/eslint-plugin`! + +In typescript-eslint v8, we've made two changes to `RuleCreator`: + +- Rule `meta.docs` by default only allows the properties defined in ESLint's [Custom Rules > Rule Structure docs](https://eslint.org/docs/latest/extend/custom-rules#rule-structure): `description` and `url` +- `RuleCreator` allows an optional type parameter to specify additional allowed properties + +For example, this rule includes the common `meta.docs.recommended` property as a `boolean`: + +```ts +interface MyPluginDocs { + recommended: boolean; +} + +const createRule = ESLintUtils.RuleCreator( + name => `https://example.com/rule/${name}`, +); + +createRule({ + // ... + meta: { + docs: { + description: '...', + recommended: true, + }, + // ... + }, +}); +``` + +See [feat(utils): allow specifying additional rule meta.docs in RuleCreator](https://github.com/typescript-eslint/typescript-eslint/pull/9025) for more details. + ### Other Developer-Facing Breaking Changes - ⏳ [Repo: Rule [options] parameter should be non-nullable if defaultOptions exists](https://github.com/typescript-eslint/typescript-eslint/issues/5439) From 1541914ec648a3fd49a7327dd8cc721d094d1f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Wed, 1 May 2024 09:15:11 -0400 Subject: [PATCH 03/27] Apply suggestions from code review Co-authored-by: Kirk Waiblinger --- .../blog/2024-04-30-announcing-typescript-eslint-v8-beta.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md index 34cf529a0cbf..15fc8d22dd4d 100644 --- a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md @@ -171,8 +171,8 @@ Several rules were changed in significant enough ways to be considered breaking ## Developer-Facing Changes -typescript-eslint v6 comes with a suite of cleanups and improvements for developers as well. -If you author any ESLint plugins or other tools that interact with TypeScript syntax, then we recommend you try out typescript-eslint v6 soon. +typescript-eslint v8 comes with a suite of cleanups and improvements for developers as well. +If you author any ESLint plugins or other tools that interact with TypeScript syntax, then we recommend you try out typescript-eslint v8 soon. It includes some breaking changes that you may need to accommodate for. :::tip From 801b40f48e6d9ffc3376bd4981392d297b50b7e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Wed, 8 May 2024 12:37:09 -0700 Subject: [PATCH 04/27] Update packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md Co-authored-by: Kirk Waiblinger --- .../blog/2024-04-30-announcing-typescript-eslint-v8-beta.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md index 15fc8d22dd4d..c8fa2e9324d6 100644 --- a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md @@ -55,7 +55,7 @@ These are the changes that users of typescript-eslint -generally, any developer ### ⏳ ESLint v9 Support -typescript-eslint v8 ships will full support for ESLint v9. +typescript-eslint v8 ships with full support for ESLint v9. typescript-eslint v7 was our first version that supported ESLint's [new "flat" config file format](https://eslint.org/docs/latest/use/configure/configuration-files), which was already available in ESLint v8. ESLint v9 still supports ESLint's [older legacy config file format](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated) so our tooling does as well. From 8bb1bcc06eb2ae06aac9b27a99d522df2c4b34a0 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 8 May 2024 12:44:28 -0700 Subject: [PATCH 05/27] hyphens --- ...-announcing-typescript-eslint-v8-beta.mdx} | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) rename packages/website/blog/{2024-04-30-announcing-typescript-eslint-v8-beta.md => 2024-04-30-announcing-typescript-eslint-v8-beta.mdx} (93%) diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx similarity index 93% rename from packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md rename to packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx index c8fa2e9324d6..9e40ed37e74f 100644 --- a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.md +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx @@ -10,6 +10,9 @@ tags: [breaking changes, typescript-eslint, v7, v8] title: Announcing typescript-eslint v8 Beta --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + [typescript-eslint](https://typescript-eslint.io) is the tooling that enables standard JavaScript tools such as [ESLint](https://eslint.org) and [Prettier](https://prettier.io) to support TypeScript code. We've been working on a set of breaking changes and general features that we're excited to get in front of users soon. And now, we're excited to say that typescript-eslint v8 is ready for public beta testing! 🎉 @@ -21,7 +24,7 @@ Our plan for typescript-eslint v8 is to: 3. Release a stable version summer of 2024 Nothing mentioned in this blog post is set in stone. -If you feel passionately about any of the choices we've made here -positively or negatively- then do let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)'s `#v8` channel! +If you feel passionately about any of the choices we've made here —positively or negatively— then do let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)'s `#v8` channel! @@ -40,15 +43,28 @@ To use v8 specifically, see the following section for an updated install command If you already use typescript-eslint, you'll need to first replace your package's previous versions of `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` with `@rc-v8` versions: + + + +```shell +npm typescript-eslint@rc-v8 --save-dev +``` + + + + ```shell npm i @typescript-eslint/eslint-plugin@rc-v8 @typescript-eslint/parser@rc-v8 --save-dev ``` + + + We highly recommend then basing your ESLint configuration on the reworked typescript-eslint [recommended configurations mentioned later in this post](#reworked-configuration-names) — especially if it's been a while since you've reworked your linter config. ## User-Facing Changes -These are the changes that users of typescript-eslint -generally, any developer running ESLint on TypeScript code- should pay attention to when upgrading typescript-eslint from v7 to v8. +These are the changes that users of typescript-eslint —generally, any developer running ESLint on TypeScript code— should pay attention to when upgrading typescript-eslint from v7 to v8. > ⏳ indicates a change that has been scheduled for v8 but not yet released. > We'll update this blog post as the corresponding pull requests land. @@ -124,10 +140,11 @@ Doing so should make it harder to accidentally configure different type informat We're thrilled to have this option promoted to stable in v8. We'll soon release a [dedicated `parserOptions` blog post](https://github.com/typescript-eslint/typescript-eslint/pull/8031) walking through the new option in more details. +🚀 ### Updated Configuration Rules -Every new major version of typescript-eslint comes with changes to which rules are enabled in the preset configurations - and with which options. +Every new major version of typescript-eslint comes with changes to which rules are enabled in the preset configurationsg and with which options. Because this release also includes a reworking of the configurations themselves, the list of changes is too large to put in this blog post. Instead see the table in [Changes to configurations for 8.0.0](https://github.com/typescript-eslint/typescript-eslint/discussions/8914) for a full list of the changes. @@ -139,8 +156,8 @@ If your ESLint configuration contains many `rules` configurations, we suggest th 1. Remove all your rules configurations 2. Extend from the preset configs that make sense for you 3. Run ESLint on your project -4. In your ESLint configuration, turn off any rules creating errors that don't make sense for your project - with comments explaining why -5. In your ESLint configuration and/or with inline `eslint-disable` comments, turn off any rules creating too many errors for you to fix - with _"TODO"_ comments linking to tracking issues/tickets to re-enable them +4. In your ESLint configuration, turn off any rules creating errors that don't make sense for your project — with comments explaining why +5. In your ESLint configuration and/or with inline `eslint-disable` comments, turn off any rules creating too many errors for you to fix — with _"TODO"_ comments linking to tracking issues/tickets to re-enable them ::: @@ -191,7 +208,7 @@ If you author any ESLint rules that refer to the syntax mentioned by them, these ### ⏳ Custom Rule `meta.docs` Types `@typescript-eslint/utils` has long exported a [`RuleCreator` utility](https://typescript-eslint.io/developers/custom-rules#rulecreator) for making custom well-typed custom ESLint rules. -That `RuleCreator` is used internally by `@typescript-eslint/eslint-plugin` - and in fact, up through typescript-eslint v7, it hardcoded the same types for rules' `meta.docs` as `@typescript-eslint/eslint-plugin`! +That `RuleCreator` is used internally by `@typescript-eslint/eslint-plugin` — and in fact, up through typescript-eslint v7, it hardcoded the same types for rules' `meta.docs` as `@typescript-eslint/eslint-plugin`! In typescript-eslint v8, we've made two changes to `RuleCreator`: From 6fb1d1b9d1cc22fad54a8d5cd33172fc869bf773 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 8 May 2024 12:53:27 -0700 Subject: [PATCH 06/27] Clarifying project service --- ...24-04-30-announcing-typescript-eslint-v8-beta.mdx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx index 9e40ed37e74f..1e58a44e717b 100644 --- a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx @@ -98,7 +98,7 @@ export default tseslint.config( parserOptions: { // Remove this line project: true, - // Add this line + // Add line projectService: true, tsconfigRootDir: import.meta.dirname, }, @@ -111,6 +111,11 @@ The project service will automatically find the closest `tsconfig.json` for each It also allows enabling typed linting for files not explicitly included in a `tsconfig.json`. This should remove the need for custom `tsconfig.eslint.json` files to lint files like `eslint.config.js`! +Typed linting for out-of-project files can be done by specifying two properties of a `parserOptions.projectService` object: + +- `allowDefaultProjectForFiles`: a glob of a small number of out-of-project files to enable a slower default project on +- `defaultProject`: path to a TypeScript configuration file to use for the slower default project + ```js title="eslint.config.js" import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; @@ -123,11 +128,12 @@ export default tseslint.config( parserOptions: { // Remove this line project: ['packages/*/tsconfig.json', 'tsconfig.eslint.json'], - // Add this line + // Added lines start projectService: { allowDefaultProjectForFiles: ['./*.js'], defaultProject: './tsconfig.json', }, + // Added lines end tsconfigRootDir: import.meta.dirname, }, }, @@ -138,7 +144,7 @@ export default tseslint.config( Internally, the project service uses the same TypeScript APIs that editors such as VS Code use. Doing so should make it harder to accidentally configure different type information for ESLint than what you see in day-to-day editing. -We're thrilled to have this option promoted to stable in v8. +We're thrilled to have the project service option promoted to stable in v8. We'll soon release a [dedicated `parserOptions` blog post](https://github.com/typescript-eslint/typescript-eslint/pull/8031) walking through the new option in more details. 🚀 From c2b62d5b76639143206cb202487d19e2208d9f89 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 8 May 2024 14:01:50 -0700 Subject: [PATCH 07/27] Added a bit more info to tooling breaking changes --- ...024-04-30-announcing-typescript-eslint-v8-beta.mdx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx index 1e58a44e717b..dc3eb6921839 100644 --- a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx @@ -185,8 +185,19 @@ Several rules were changed in significant enough ways to be considered breaking - ⏳ [Enhancement: Error if configuration options aren't provided as expected](https://github.com/typescript-eslint/typescript-eslint/issues/6403) - [fix(typescript-estree): enable dot globs for project by default](https://github.com/typescript-eslint/typescript-eslint/pull/8818) + - This will cause any `parserOptions.project` globs to match dot (`.`) directories. + If you don't want to match them then use a more specific set of globs, or switch to `parserOptions.projectService`. - [feat(typescript-estree): remove slow deprecated and isolated programs](https://github.com/typescript-eslint/typescript-eslint/pull/8834) + - If you were still using `parserOptions.DEPRECATED__createDefaultProgram`, switch to `parserOptions.projectService` or `parserOptions.project`. - [feat(typescript-estree): rename automaticSingleRunInference to disallowAutomaticSingleRunInference](https://github.com/typescript-eslint/typescript-eslint/pull/8922) + - We've updated the default to be an opt-out - meaning you no longer need to enable it: + ```js + parserOptions: { + // Remove this line + automaticSingleRunInference: true, + // ... + } + ``` - [chore: bump minimum versions for v8](https://github.com/typescript-eslint/typescript-eslint/pull/8973) - ESLint support range was changed from `^8.56.0` to `^8.57.0` - Node.js support range was changed from `^18.18.0 || >=20.0.0` to `^18.18.0 || ^20.9.0 || >=21.1.0` From e2dd27cf91c4f26aabf489c75c8985087ae4d7cc Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 8 May 2024 14:05:55 -0700 Subject: [PATCH 08/27] configurationsg --- .../blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx index dc3eb6921839..303177d74651 100644 --- a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx @@ -150,7 +150,7 @@ We'll soon release a [dedicated `parserOptions` blog post](https://github.com/ty ### Updated Configuration Rules -Every new major version of typescript-eslint comes with changes to which rules are enabled in the preset configurationsg and with which options. +Every new major version of typescript-eslint comes with changes to which rules are enabled in the preset configurations and with which options. Because this release also includes a reworking of the configurations themselves, the list of changes is too large to put in this blog post. Instead see the table in [Changes to configurations for 8.0.0](https://github.com/typescript-eslint/typescript-eslint/discussions/8914) for a full list of the changes. From 13550bca24e078566de7eed001a5da51c47479ef Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 11 May 2024 18:39:37 -0700 Subject: [PATCH 09/27] Actions for breaking changes --- .cspell.json | 3 ++- ...04-30-announcing-typescript-eslint-v8-beta.mdx | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.cspell.json b/.cspell.json index 669e0e499892..83e9dd112d67 100644 --- a/.cspell.json +++ b/.cspell.json @@ -49,8 +49,8 @@ "words": [ "Airbnb", "Airbnb's", - "ambiently", "allowdefaultprojectforfiles", + "ambiently", "Armano", "astexplorer", "Astro", @@ -90,6 +90,7 @@ "falsiness", "globby", "IDE's", + "ignoreconditionaltests", "IIFE", "IIFEs", "jameshenry", diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx index 303177d74651..9be412dd83da 100644 --- a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx @@ -172,14 +172,24 @@ If your ESLint configuration contains many `rules` configurations, we suggest th Several rules were changed in significant enough ways to be considered breaking changes: - ⏳ [Rules: Deprecate prefer-ts-expect-error in favor of ban-ts-comment](https://github.com/typescript-eslint/typescript-eslint/issues/8333) + - If you have [`@typescript-eslint/prefer-ts-expect-error`](/rules/prefer-ts-expect-error) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/ban-ts-comment`](/rules/ban-ts-comment) - ⏳ [chore(eslint-plugin): deprecate no-var-requires in favor of no-require-imports](https://github.com/typescript-eslint/typescript-eslint/pull/8334) + - If you have [`@typescript-eslint/no-var-requires`](/rules/no-var-requires) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-require-imports`](/rules/no-require-imports) - [feat(eslint-plugin): deprecate no-throw-literal and add a renamed only-throw-error](https://github.com/typescript-eslint/typescript-eslint/pull/8701) + - If you have [`@typescript-eslint/no-throw-literal`](/rules/no-throw-literal) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/only-throw-error`](/rules/only-throw-error) - ⏳ [fix(eslint-plugin): [no-useless-template-literals] rename to no-useless-template-expression](https://github.com/typescript-eslint/typescript-eslint/pull/8821) + - Find-and-replace text from `no-useless-template-literals` to `no-useless-template-expression` - [feat(eslint-plugin): deprecate no-loss-of-precision extension rule](https://github.com/typescript-eslint/typescript-eslint/pull/8832) + - If you have [`@typescript-eslint/no-loss-of-precision`](/rules/no-loss-of-precision) manually enabled, remove that - [feat(eslint-plugin): remove formatting/layout rules](https://github.com/typescript-eslint/typescript-eslint/pull/8833) + - If you're using any of the old deprecated formatting rules, see [eslint.style](https://eslint.style) for their new equivalents - [feat(eslint-plugin): [prefer-nullish-coalescing] change ignoreConditionalTests default to true](https://github.com/typescript-eslint/typescript-eslint/pull/8872) + - If you want to have the rule check conditional tests, set its [`ignoreConditionalTests` option](/rules/prefer-nullish-coalescing/#ignoreconditionaltests) to `false` in your ESLint config - [feat(eslint-plugin): [no-unused-vars] align catch behavior to ESLint 9](https://github.com/typescript-eslint/typescript-eslint/pull/8971) -- ⏳ [feat(eslint-plugin): split no-empty-object-type rule out from ban-types rule](https://github.com/typescript-eslint/typescript-eslint/pull/8977) + - If you want [`@typescript-eslint/no-unused-vars`](/rules/no-unused-vars) to ignore caught errors, enable its `caughtErrors` option to `'none'` in your ESLint config +- ⏳ [feat(eslint-plugin): split no-empty-object-type out from ban-types and no-empty-interface](https://github.com/typescript-eslint/typescript-eslint/pull/8977) + - If you have [`@typescript-eslint/ban-types`](/rules/ban-types) manually enabled, it will no longer ban the `{}` or `object` type; use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](/rules/no-empty-object-type) + - If you have [`@typescript-eslint/no-empty-interface`](/rules/no-empty-interface) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](/rules/no-empty-object-type) ### Tooling Breaking Changes @@ -188,7 +198,7 @@ Several rules were changed in significant enough ways to be considered breaking - This will cause any `parserOptions.project` globs to match dot (`.`) directories. If you don't want to match them then use a more specific set of globs, or switch to `parserOptions.projectService`. - [feat(typescript-estree): remove slow deprecated and isolated programs](https://github.com/typescript-eslint/typescript-eslint/pull/8834) - - If you were still using `parserOptions.DEPRECATED__createDefaultProgram`, switch to `parserOptions.projectService` or `parserOptions.project`. + - If you were still using `parserOptions.DEPRECATED__createDefaultProgram`, switch to `parserOptions.projectService` _(recommended)_ or `parserOptions.project`. - [feat(typescript-estree): rename automaticSingleRunInference to disallowAutomaticSingleRunInference](https://github.com/typescript-eslint/typescript-eslint/pull/8922) - We've updated the default to be an opt-out - meaning you no longer need to enable it: ```js @@ -220,6 +230,7 @@ If you author any ESLint rules that refer to the syntax mentioned by them, these - ⏳ [Enhancement: add strict parent types for nodes that have well-defined parents](https://github.com/typescript-eslint/typescript-eslint/issues/6225) - [feat(typescript-estree): split TSMappedType typeParameter into constraint and key](https://github.com/typescript-eslint/typescript-eslint/pull/7065) + - If your code handles mapped types, change from `node.typeParameter.constraint` to `node.constraint` and from `node.typeParameter.name` to `node.key` - ⏳ [feat(ast-spec): remove deprecated type params](https://github.com/typescript-eslint/typescript-eslint/pull/8933) ### ⏳ Custom Rule `meta.docs` Types From 8c66d32e3f30802d818a0d085d4bd66a82d6393d Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 11 May 2024 18:43:04 -0700 Subject: [PATCH 10/27] More actions for breaking changes --- .../blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx index 9be412dd83da..d22331b7bd25 100644 --- a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx @@ -272,10 +272,14 @@ See [feat(utils): allow specifying additional rule meta.docs in RuleCreator](htt - ⏳ [Repo: Rule [options] parameter should be non-nullable if defaultOptions exists](https://github.com/typescript-eslint/typescript-eslint/issues/5439) - [feat(parser): always enable comment, loc, range, tokens](https://github.com/typescript-eslint/typescript-eslint/pull/8617) + - If you were manually calling `@typescript-eslint/parser` functions, those options are no longer necessary to provide - ⏳ [feat(rule-tester): support multipass fixes](https://github.com/typescript-eslint/typescript-eslint/pull/8883) - [chore(type-utils)!: remove IsNullableTypeOptions interface](https://github.com/typescript-eslint/typescript-eslint/pull/8934) + - If you were using `isNullableType`, you can omit its section parameter - [feat(utils): swap LegacyESLint out for FlatESLint as ESLint export](https://github.com/typescript-eslint/typescript-eslint/pull/8972) + - If you still need to use the class corresponding to legacy ("eslintrc") configs, switch from importing `ESLint` to `LegacyESLint` - [chore(type-utils): remove getTypeArguments](https://github.com/typescript-eslint/typescript-eslint/pull/8938) + - If you were using `getTypeArguments`, call a TypeScript type checker's `checker.getTypeArguments` instead - ⏳ [feat(utils): remove deprecated context helpers](https://github.com/typescript-eslint/typescript-eslint/pull/9000) ## Appreciation From e57849ce8ccf9e58dae14bf00d036c550db091d1 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 11 May 2024 18:43:28 -0700 Subject: [PATCH 11/27] Update date to the 11th --- ...ta.mdx => 2024-05-11-announcing-typescript-eslint-v8-beta.mdx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/website/blog/{2024-04-30-announcing-typescript-eslint-v8-beta.mdx => 2024-05-11-announcing-typescript-eslint-v8-beta.mdx} (100%) diff --git a/packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx similarity index 100% rename from packages/website/blog/2024-04-30-announcing-typescript-eslint-v8-beta.mdx rename to packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx From 08f133b21abe0219589e07df65fdc8b1e55f35d2 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 11 May 2024 22:44:00 -0700 Subject: [PATCH 12/27] Use v8-- link for no-empty-object-type --- .../blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx index d22331b7bd25..33b2aa355077 100644 --- a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx @@ -188,8 +188,8 @@ Several rules were changed in significant enough ways to be considered breaking - [feat(eslint-plugin): [no-unused-vars] align catch behavior to ESLint 9](https://github.com/typescript-eslint/typescript-eslint/pull/8971) - If you want [`@typescript-eslint/no-unused-vars`](/rules/no-unused-vars) to ignore caught errors, enable its `caughtErrors` option to `'none'` in your ESLint config - ⏳ [feat(eslint-plugin): split no-empty-object-type out from ban-types and no-empty-interface](https://github.com/typescript-eslint/typescript-eslint/pull/8977) - - If you have [`@typescript-eslint/ban-types`](/rules/ban-types) manually enabled, it will no longer ban the `{}` or `object` type; use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](/rules/no-empty-object-type) - - If you have [`@typescript-eslint/no-empty-interface`](/rules/no-empty-interface) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](/rules/no-empty-object-type) + - If you have [`@typescript-eslint/ban-types`](/rules/ban-types) manually enabled, it will no longer ban the `{}` or `object` type; use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](https://v8--typescript-eslint.netlify.app/rules/no-empty-object-type) + - If you have [`@typescript-eslint/no-empty-interface`](/rules/no-empty-interface) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](https://v8--typescript-eslint.netlify.app/rules/no-empty-object-type) ### Tooling Breaking Changes From 3e07598b4a2cad01fe2395edfa52df56a48bcc0c Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 11 May 2024 22:57:48 -0700 Subject: [PATCH 13/27] Remove ban-types hourglass --- .../blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx index 33b2aa355077..c685dd0dc1dd 100644 --- a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx @@ -187,7 +187,7 @@ Several rules were changed in significant enough ways to be considered breaking - If you want to have the rule check conditional tests, set its [`ignoreConditionalTests` option](/rules/prefer-nullish-coalescing/#ignoreconditionaltests) to `false` in your ESLint config - [feat(eslint-plugin): [no-unused-vars] align catch behavior to ESLint 9](https://github.com/typescript-eslint/typescript-eslint/pull/8971) - If you want [`@typescript-eslint/no-unused-vars`](/rules/no-unused-vars) to ignore caught errors, enable its `caughtErrors` option to `'none'` in your ESLint config -- ⏳ [feat(eslint-plugin): split no-empty-object-type out from ban-types and no-empty-interface](https://github.com/typescript-eslint/typescript-eslint/pull/8977) +- [feat(eslint-plugin): split no-empty-object-type out from ban-types and no-empty-interface](https://github.com/typescript-eslint/typescript-eslint/pull/8977) - If you have [`@typescript-eslint/ban-types`](/rules/ban-types) manually enabled, it will no longer ban the `{}` or `object` type; use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](https://v8--typescript-eslint.netlify.app/rules/no-empty-object-type) - If you have [`@typescript-eslint/no-empty-interface`](/rules/no-empty-interface) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](https://v8--typescript-eslint.netlify.app/rules/no-empty-object-type) From d939cf0b8e76ad2ae134b3956e2116efcc8fc81c Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 11 May 2024 22:58:09 -0700 Subject: [PATCH 14/27] lil ban-types typo --- .../blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx index c685dd0dc1dd..e72948dce78f 100644 --- a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx @@ -188,7 +188,7 @@ Several rules were changed in significant enough ways to be considered breaking - [feat(eslint-plugin): [no-unused-vars] align catch behavior to ESLint 9](https://github.com/typescript-eslint/typescript-eslint/pull/8971) - If you want [`@typescript-eslint/no-unused-vars`](/rules/no-unused-vars) to ignore caught errors, enable its `caughtErrors` option to `'none'` in your ESLint config - [feat(eslint-plugin): split no-empty-object-type out from ban-types and no-empty-interface](https://github.com/typescript-eslint/typescript-eslint/pull/8977) - - If you have [`@typescript-eslint/ban-types`](/rules/ban-types) manually enabled, it will no longer ban the `{}` or `object` type; use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](https://v8--typescript-eslint.netlify.app/rules/no-empty-object-type) + - If you have [`@typescript-eslint/ban-types`](/rules/ban-types) manually enabled, it will no longer ban the `{}` or `object` types; use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](https://v8--typescript-eslint.netlify.app/rules/no-empty-object-type) - If you have [`@typescript-eslint/no-empty-interface`](/rules/no-empty-interface) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-empty-object-type`](https://v8--typescript-eslint.netlify.app/rules/no-empty-object-type) ### Tooling Breaking Changes From 461e8b0057cc4aa7f7fbce0e700c21270b797e2a Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 12 May 2024 16:41:12 -0700 Subject: [PATCH 15/27] Remove ESLint v9 hourglass --- .../blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx index e72948dce78f..3eef850a52b2 100644 --- a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx @@ -69,7 +69,7 @@ These are the changes that users of typescript-eslint —generally, any develope > ⏳ indicates a change that has been scheduled for v8 but not yet released. > We'll update this blog post as the corresponding pull requests land. -### ⏳ ESLint v9 Support +### ESLint v9 Support typescript-eslint v8 ships with full support for ESLint v9. From 57280cc78aba5fcc8710aee0fcfc2efd19904bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Sun, 12 May 2024 16:54:00 -0700 Subject: [PATCH 16/27] Apply suggestions from code review Co-authored-by: Kirk Waiblinger Co-authored-by: Brad Zacher --- ...24-05-11-announcing-typescript-eslint-v8-beta.mdx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx index 3eef850a52b2..b4b2a977553d 100644 --- a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx @@ -24,7 +24,7 @@ Our plan for typescript-eslint v8 is to: 3. Release a stable version summer of 2024 Nothing mentioned in this blog post is set in stone. -If you feel passionately about any of the choices we've made here —positively or negatively— then do let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)'s `#v8` channel! +If you feel passionately about any of the choices we've made here — positively or negatively — then do let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)'s `#v8` channel! @@ -47,7 +47,7 @@ If you already use typescript-eslint, you'll need to first replace your package' ```shell -npm typescript-eslint@rc-v8 --save-dev +npm i typescript-eslint@rc-v8 --save-dev ``` @@ -163,7 +163,7 @@ If your ESLint configuration contains many `rules` configurations, we suggest th 2. Extend from the preset configs that make sense for you 3. Run ESLint on your project 4. In your ESLint configuration, turn off any rules creating errors that don't make sense for your project — with comments explaining why -5. In your ESLint configuration and/or with inline `eslint-disable` comments, turn off any rules creating too many errors for you to fix — with _"TODO"_ comments linking to tracking issues/tickets to re-enable them +5. In your ESLint configuration and/or with inline `eslint-disable` comments, turn off/downgrade to "warn" any rules creating too many errors for you to fix — with _"TODO"_ comments linking to tracking issues/tickets to re-enable them ::: @@ -180,7 +180,7 @@ Several rules were changed in significant enough ways to be considered breaking - ⏳ [fix(eslint-plugin): [no-useless-template-literals] rename to no-useless-template-expression](https://github.com/typescript-eslint/typescript-eslint/pull/8821) - Find-and-replace text from `no-useless-template-literals` to `no-useless-template-expression` - [feat(eslint-plugin): deprecate no-loss-of-precision extension rule](https://github.com/typescript-eslint/typescript-eslint/pull/8832) - - If you have [`@typescript-eslint/no-loss-of-precision`](/rules/no-loss-of-precision) manually enabled, remove that + - If you have [`@typescript-eslint/no-loss-of-precision`](/rules/no-loss-of-precision) manually enabled, replace it with the base rule `no-loss-of-precision`. - [feat(eslint-plugin): remove formatting/layout rules](https://github.com/typescript-eslint/typescript-eslint/pull/8833) - If you're using any of the old deprecated formatting rules, see [eslint.style](https://eslint.style) for their new equivalents - [feat(eslint-plugin): [prefer-nullish-coalescing] change ignoreConditionalTests default to true](https://github.com/typescript-eslint/typescript-eslint/pull/8872) @@ -194,6 +194,7 @@ Several rules were changed in significant enough ways to be considered breaking ### Tooling Breaking Changes - ⏳ [Enhancement: Error if configuration options aren't provided as expected](https://github.com/typescript-eslint/typescript-eslint/issues/6403) + - This should only cause errors if you had an invalid config. - [fix(typescript-estree): enable dot globs for project by default](https://github.com/typescript-eslint/typescript-eslint/pull/8818) - This will cause any `parserOptions.project` globs to match dot (`.`) directories. If you don't want to match them then use a more specific set of globs, or switch to `parserOptions.projectService`. @@ -229,9 +230,11 @@ These PRs changed the AST shapes generated by typescript-eslint when parsing cod If you author any ESLint rules that refer to the syntax mentioned by them, these are relevant to you. - ⏳ [Enhancement: add strict parent types for nodes that have well-defined parents](https://github.com/typescript-eslint/typescript-eslint/issues/6225) + - This will help you remove some unnecessary conditions - we suggest using `@typescript-eslint/no-unnecessary-condition` to help find the unnecessary checks! - [feat(typescript-estree): split TSMappedType typeParameter into constraint and key](https://github.com/typescript-eslint/typescript-eslint/pull/7065) - If your code handles mapped types, change from `node.typeParameter.constraint` to `node.constraint` and from `node.typeParameter.name` to `node.key` - ⏳ [feat(ast-spec): remove deprecated type params](https://github.com/typescript-eslint/typescript-eslint/pull/8933) + - If you haven't already you must stop using foo and use bar instead. ### ⏳ Custom Rule `meta.docs` Types @@ -281,6 +284,7 @@ See [feat(utils): allow specifying additional rule meta.docs in RuleCreator](htt - [chore(type-utils): remove getTypeArguments](https://github.com/typescript-eslint/typescript-eslint/pull/8938) - If you were using `getTypeArguments`, call a TypeScript type checker's `checker.getTypeArguments` instead - ⏳ [feat(utils): remove deprecated context helpers](https://github.com/typescript-eslint/typescript-eslint/pull/9000) + - You should consider dropping support for older ESLint versions and migrate to the new APIs. ## Appreciation From e3ab88f99f4b12d3fc2c1ee62e67c8e4dde743db Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sun, 12 May 2024 17:01:48 -0700 Subject: [PATCH 17/27] Couple more review touchups --- ...24-05-11-announcing-typescript-eslint-v8-beta.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx index b4b2a977553d..775ad9daab5f 100644 --- a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx @@ -21,7 +21,7 @@ Our plan for typescript-eslint v8 is to: 1. Have users try out betas starting in May of 2024 2. Respond to user feedback for the next ~1-2 months -3. Release a stable version summer of 2024 +3. Release a stable version within the next ~1-2 months Nothing mentioned in this blog post is set in stone. If you feel passionately about any of the choices we've made here — positively or negatively — then do let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)'s `#v8` channel! @@ -175,7 +175,7 @@ Several rules were changed in significant enough ways to be considered breaking - If you have [`@typescript-eslint/prefer-ts-expect-error`](/rules/prefer-ts-expect-error) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/ban-ts-comment`](/rules/ban-ts-comment) - ⏳ [chore(eslint-plugin): deprecate no-var-requires in favor of no-require-imports](https://github.com/typescript-eslint/typescript-eslint/pull/8334) - If you have [`@typescript-eslint/no-var-requires`](/rules/no-var-requires) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/no-require-imports`](/rules/no-require-imports) -- [feat(eslint-plugin): deprecate no-throw-literal and add a renamed only-throw-error](https://github.com/typescript-eslint/typescript-eslint/pull/8701) +- [feat(eslint-plugin): remove deprecated no-throw-literal rule](https://github.com/typescript-eslint/typescript-eslint/issues/9083) - If you have [`@typescript-eslint/no-throw-literal`](/rules/no-throw-literal) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/only-throw-error`](/rules/only-throw-error) - ⏳ [fix(eslint-plugin): [no-useless-template-literals] rename to no-useless-template-expression](https://github.com/typescript-eslint/typescript-eslint/pull/8821) - Find-and-replace text from `no-useless-template-literals` to `no-useless-template-expression` @@ -194,7 +194,7 @@ Several rules were changed in significant enough ways to be considered breaking ### Tooling Breaking Changes - ⏳ [Enhancement: Error if configuration options aren't provided as expected](https://github.com/typescript-eslint/typescript-eslint/issues/6403) - - This should only cause errors if you had an invalid config. + - This should only cause errors if you had an invalid config. - [fix(typescript-estree): enable dot globs for project by default](https://github.com/typescript-eslint/typescript-eslint/pull/8818) - This will cause any `parserOptions.project` globs to match dot (`.`) directories. If you don't want to match them then use a more specific set of globs, or switch to `parserOptions.projectService`. @@ -230,11 +230,11 @@ These PRs changed the AST shapes generated by typescript-eslint when parsing cod If you author any ESLint rules that refer to the syntax mentioned by them, these are relevant to you. - ⏳ [Enhancement: add strict parent types for nodes that have well-defined parents](https://github.com/typescript-eslint/typescript-eslint/issues/6225) - - This will help you remove some unnecessary conditions - we suggest using `@typescript-eslint/no-unnecessary-condition` to help find the unnecessary checks! + - This will help you remove some unnecessary conditions - we suggest using `@typescript-eslint/no-unnecessary-condition` to help find the unnecessary checks! - [feat(typescript-estree): split TSMappedType typeParameter into constraint and key](https://github.com/typescript-eslint/typescript-eslint/pull/7065) - If your code handles mapped types, change from `node.typeParameter.constraint` to `node.constraint` and from `node.typeParameter.name` to `node.key` - ⏳ [feat(ast-spec): remove deprecated type params](https://github.com/typescript-eslint/typescript-eslint/pull/8933) - - If you haven't already you must stop using foo and use bar instead. + - If you haven't already you must stop using those removed AST properties that were already marked as `@deprecated` ### ⏳ Custom Rule `meta.docs` Types @@ -284,7 +284,7 @@ See [feat(utils): allow specifying additional rule meta.docs in RuleCreator](htt - [chore(type-utils): remove getTypeArguments](https://github.com/typescript-eslint/typescript-eslint/pull/8938) - If you were using `getTypeArguments`, call a TypeScript type checker's `checker.getTypeArguments` instead - ⏳ [feat(utils): remove deprecated context helpers](https://github.com/typescript-eslint/typescript-eslint/pull/9000) - - You should consider dropping support for older ESLint versions and migrate to the new APIs. + - You should consider dropping support for older ESLint versions and migrate to the new APIs. ## Appreciation From 227c9d7d5e0fb4692f459faea015ce963e50b676 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 15 May 2024 17:21:14 -0700 Subject: [PATCH 18/27] Remove hourglass for multipass fixes --- .../blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx index 775ad9daab5f..739b58db0be1 100644 --- a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx @@ -276,7 +276,7 @@ See [feat(utils): allow specifying additional rule meta.docs in RuleCreator](htt - ⏳ [Repo: Rule [options] parameter should be non-nullable if defaultOptions exists](https://github.com/typescript-eslint/typescript-eslint/issues/5439) - [feat(parser): always enable comment, loc, range, tokens](https://github.com/typescript-eslint/typescript-eslint/pull/8617) - If you were manually calling `@typescript-eslint/parser` functions, those options are no longer necessary to provide -- ⏳ [feat(rule-tester): support multipass fixes](https://github.com/typescript-eslint/typescript-eslint/pull/8883) +- [feat(rule-tester): support multipass fixes](https://github.com/typescript-eslint/typescript-eslint/pull/8883) - [chore(type-utils)!: remove IsNullableTypeOptions interface](https://github.com/typescript-eslint/typescript-eslint/pull/8934) - If you were using `isNullableType`, you can omit its section parameter - [feat(utils): swap LegacyESLint out for FlatESLint as ESLint export](https://github.com/typescript-eslint/typescript-eslint/pull/8972) From 31ea9ec80091fc2a9f57fc4e109f2a769009122f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 24 May 2024 06:29:03 +0300 Subject: [PATCH 19/27] Apply suggestions from code review Co-authored-by: Flo Edelmann --- .../blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx index 739b58db0be1..0de46ec7dab7 100644 --- a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx @@ -76,7 +76,7 @@ typescript-eslint v8 ships with full support for ESLint v9. typescript-eslint v7 was our first version that supported ESLint's [new "flat" config file format](https://eslint.org/docs/latest/use/configure/configuration-files), which was already available in ESLint v8. ESLint v9 still supports ESLint's [older legacy config file format](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated) so our tooling does as well. However, ESLint v9 also includes a set of breaking changes that we added support for in typescript-eslint v8. -See the [ESLint v9 release blog post](https://eslint.org/blog/2024/04/eslint-v9.0.0-released) and for more details. +See the [ESLint v9 release blog post](https://eslint.org/blog/2024/04/eslint-v9.0.0-released) for more details. ### ⏳ Project Service From d4cbffcd1caa77afcb538ffbc72aca5d86e6b65b Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 24 May 2024 06:29:16 +0300 Subject: [PATCH 20/27] Missing 'this' --- .../blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx index 0de46ec7dab7..ef70e2954ada 100644 --- a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx @@ -98,7 +98,7 @@ export default tseslint.config( parserOptions: { // Remove this line project: true, - // Add line + // Add this line projectService: true, tsconfigRootDir: import.meta.dirname, }, From af8fa1f6c5d17cb457817a023805ad5553904f78 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 24 May 2024 06:30:59 +0300 Subject: [PATCH 21/27] Push date to the 27th --- ...ta.mdx => 2024-05-27-announcing-typescript-eslint-v8-beta.mdx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/website/blog/{2024-05-11-announcing-typescript-eslint-v8-beta.mdx => 2024-05-27-announcing-typescript-eslint-v8-beta.mdx} (100%) diff --git a/packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx similarity index 100% rename from packages/website/blog/2024-05-11-announcing-typescript-eslint-v8-beta.mdx rename to packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx From df2dcb0d060b89ed3536a182270adb892c4f0a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 24 May 2024 14:23:09 +0300 Subject: [PATCH 22/27] Update packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx Co-authored-by: auvred <61150013+auvred@users.noreply.github.com> --- ...7-announcing-typescript-eslint-v8-beta.mdx | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx index ef70e2954ada..e9311d893783 100644 --- a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx @@ -271,6 +271,44 @@ createRule({ See [feat(utils): allow specifying additional rule meta.docs in RuleCreator](https://github.com/typescript-eslint/typescript-eslint/pull/9025) for more details. +### Support for multi-pass fixes in `RuleTester` + +The `RuleTester` provided by `@typescript-eslint/rule-tester` is a fork of ESLint's `RuleTester`. +One limitation of the original `RuleTester` is that it is not possible to verify that test cases requiring multiple fixes to be applied provide correct fixes. +[The original `RuleTester` applies only the first fix](https://eslint.org/docs/latest/integrate/nodejs-api#testing-fixes) when there is conflict between two fixes. + +In typescript-eslint v8, `RuleTester` tries to apply all possible fixes for each test case. + +If your rule tests had some test cases that required multi-pass fixes, you will see some test failures. +To fix these failures, provide an array of strings for `output` which specifies the output after each fix pass. + +```ts +import { RuleTester } from '@typescript-eslint/rule-tester'; +import rule from '../src/rules/my-rule.ts'; + +const ruleTester = new RuleTester(); + +ruleTester.run('my-rule', rule, { + valid: [ + /* ... */ + ], + invalid: [ + { + code: 'const a = 1;', + // Remove the line with string form of `output` + output: 'const b = 1;', + // Add the line with array form of `output` + output: ['const b = 1;', 'const c = 1;'], + errors: [ + /* ... */ + ], + }, + ], +}); +``` + +See [[rule-tester] support multipass fixes](https://github.com/typescript-eslint/typescript-eslint/issues/8554) for more details. + ### Other Developer-Facing Breaking Changes - ⏳ [Repo: Rule [options] parameter should be non-nullable if defaultOptions exists](https://github.com/typescript-eslint/typescript-eslint/issues/5439) From de2f8bd38fd32d50e80659d83b42e58db8c35650 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 24 May 2024 14:28:00 +0300 Subject: [PATCH 23/27] Stabilized project service --- .../blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx index e9311d893783..bfad7713cf56 100644 --- a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx @@ -78,7 +78,7 @@ ESLint v9 still supports ESLint's [older legacy config file format](https://esli However, ESLint v9 also includes a set of breaking changes that we added support for in typescript-eslint v8. See the [ESLint v9 release blog post](https://eslint.org/blog/2024/04/eslint-v9.0.0-released) for more details. -### ⏳ Project Service +### Project Service The biggest new feature added in this version is the stability of our new "project service". In short, the project service is a new way to enable [typed linting](/getting-started/typed-linting) that is generally _easier to configure_ and _faster at runtime_ than our previous offerings. From 9b1ab46972244da6f417216650ae25af8fe26f5e Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 24 May 2024 14:32:41 +0300 Subject: [PATCH 24/27] lil phrasing nit --- .../blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx index bfad7713cf56..5969a7c34284 100644 --- a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx @@ -274,7 +274,7 @@ See [feat(utils): allow specifying additional rule meta.docs in RuleCreator](htt ### Support for multi-pass fixes in `RuleTester` The `RuleTester` provided by `@typescript-eslint/rule-tester` is a fork of ESLint's `RuleTester`. -One limitation of the original `RuleTester` is that it is not possible to verify that test cases requiring multiple fixes to be applied provide correct fixes. +One limitation of the original `RuleTester` is that it is not possible to verify the individual applied fixes when a rule provides multiple rounds of fixes. [The original `RuleTester` applies only the first fix](https://eslint.org/docs/latest/integrate/nodejs-api#testing-fixes) when there is conflict between two fixes. In typescript-eslint v8, `RuleTester` tries to apply all possible fixes for each test case. From a98f3a3c4473aed5aa21fc5c950079db038de625 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 24 May 2024 14:50:24 +0300 Subject: [PATCH 25/27] Final proofreading --- ...27-announcing-typescript-eslint-v8-beta.mdx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx index 5969a7c34284..15bca5030d8c 100644 --- a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx @@ -60,7 +60,7 @@ npm i @typescript-eslint/eslint-plugin@rc-v8 @typescript-eslint/parser@rc-v8 --s -We highly recommend then basing your ESLint configuration on the reworked typescript-eslint [recommended configurations mentioned later in this post](#reworked-configuration-names) — especially if it's been a while since you've reworked your linter config. +We highly recommend then basing your ESLint configuration on the reworked typescript-eslint [recommended configurations](/users/configs) — especially if it's been a while since you've reworked your linter config. ## User-Facing Changes @@ -113,7 +113,7 @@ This should remove the need for custom `tsconfig.eslint.json` files to lint file Typed linting for out-of-project files can be done by specifying two properties of a `parserOptions.projectService` object: -- `allowDefaultProjectForFiles`: a glob of a small number of out-of-project files to enable a slower default project on +- `allowDefaultProject`: a glob of a small number of out-of-project files to enable a slower default project on - `defaultProject`: path to a TypeScript configuration file to use for the slower default project ```js title="eslint.config.js" @@ -130,7 +130,7 @@ export default tseslint.config( project: ['packages/*/tsconfig.json', 'tsconfig.eslint.json'], // Added lines start projectService: { - allowDefaultProjectForFiles: ['./*.js'], + allowDefaultProject: ['./*.js'], defaultProject: './tsconfig.json', }, // Added lines end @@ -169,7 +169,7 @@ If your ESLint configuration contains many `rules` configurations, we suggest th ### Rule Breaking Changes -Several rules were changed in significant enough ways to be considered breaking changes: +Several rules are changed in significant enough ways to be considered breaking changes: - ⏳ [Rules: Deprecate prefer-ts-expect-error in favor of ban-ts-comment](https://github.com/typescript-eslint/typescript-eslint/issues/8333) - If you have [`@typescript-eslint/prefer-ts-expect-error`](/rules/prefer-ts-expect-error) manually enabled, remove that, and instead either use a [recommended config](/users/configs) or manually enable [`@typescript-eslint/ban-ts-comment`](/rules/ban-ts-comment) @@ -216,7 +216,7 @@ Several rules were changed in significant enough ways to be considered breaking ## Developer-Facing Changes -typescript-eslint v8 comes with a suite of cleanups and improvements for developers as well. +typescript-eslint v8 comes with a suite of cleanups and improvements for developers using its Node.js APIs as well. If you author any ESLint plugins or other tools that interact with TypeScript syntax, then we recommend you try out typescript-eslint v8 soon. It includes some breaking changes that you may need to accommodate for. @@ -226,17 +226,17 @@ If you're having trouble working with the changes, please let us know on [the ty ### AST Breaking Changes -These PRs changed the AST shapes generated by typescript-eslint when parsing code. +These changes are to the AST shapes generated by typescript-eslint when parsing code. If you author any ESLint rules that refer to the syntax mentioned by them, these are relevant to you. - ⏳ [Enhancement: add strict parent types for nodes that have well-defined parents](https://github.com/typescript-eslint/typescript-eslint/issues/6225) - This will help you remove some unnecessary conditions - we suggest using `@typescript-eslint/no-unnecessary-condition` to help find the unnecessary checks! - [feat(typescript-estree): split TSMappedType typeParameter into constraint and key](https://github.com/typescript-eslint/typescript-eslint/pull/7065) - If your code handles mapped types, change from `node.typeParameter.constraint` to `node.constraint` and from `node.typeParameter.name` to `node.key` -- ⏳ [feat(ast-spec): remove deprecated type params](https://github.com/typescript-eslint/typescript-eslint/pull/8933) +- [feat(ast-spec): remove deprecated type params](https://github.com/typescript-eslint/typescript-eslint/pull/8933) - If you haven't already you must stop using those removed AST properties that were already marked as `@deprecated` -### ⏳ Custom Rule `meta.docs` Types +### Custom Rule `meta.docs` Types `@typescript-eslint/utils` has long exported a [`RuleCreator` utility](https://typescript-eslint.io/developers/custom-rules#rulecreator) for making custom well-typed custom ESLint rules. That `RuleCreator` is used internally by `@typescript-eslint/eslint-plugin` — and in fact, up through typescript-eslint v7, it hardcoded the same types for rules' `meta.docs` as `@typescript-eslint/eslint-plugin`! @@ -321,7 +321,7 @@ See [[rule-tester] support multipass fixes](https://github.com/typescript-eslint - If you still need to use the class corresponding to legacy ("eslintrc") configs, switch from importing `ESLint` to `LegacyESLint` - [chore(type-utils): remove getTypeArguments](https://github.com/typescript-eslint/typescript-eslint/pull/8938) - If you were using `getTypeArguments`, call a TypeScript type checker's `checker.getTypeArguments` instead -- ⏳ [feat(utils): remove deprecated context helpers](https://github.com/typescript-eslint/typescript-eslint/pull/9000) +- [feat(utils): remove deprecated context helpers](https://github.com/typescript-eslint/typescript-eslint/pull/9000) - You should consider dropping support for older ESLint versions and migrate to the new APIs. ## Appreciation From 029b91cf7330ebcc78dc606ab51539c41fa25fad Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 24 May 2024 14:52:36 +0300 Subject: [PATCH 26/27] Update appreciation list --- .../blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx index 15bca5030d8c..a2e2c308ebbc 100644 --- a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx @@ -338,9 +338,11 @@ We'd like to extend a sincere _thank you_ to everybody who pitched in to make ty - [Kirk Waiblinger](https://github.com/kirkwaiblinger) - Community contributors whose PRs were merged into the 8.0.0 release: + - [Abraham Guo](https://github.com/abrahamguo) + - [Collin Bachman](https://github.com/bachmacintosh) - [Thomas Huchedé](https://github.com/thuchede) - [Yukihiro Hasegawa](https://github.com/y-hsgw) - - _(more to come as PRs are merged)_ + - _(more to come as PRs are merged!)_ See the [v8.0.0 milestone](https://github.com/typescript-eslint/typescript-eslint/milestone/9) for the list of issues and associated merged pull requests. From 054a0f125ec49622ebde63f32ecf176341628f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Fri, 24 May 2024 14:55:25 +0300 Subject: [PATCH 27/27] Update packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx Co-authored-by: auvred <61150013+auvred@users.noreply.github.com> --- .../blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx index a2e2c308ebbc..385f13fec573 100644 --- a/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx +++ b/packages/website/blog/2024-05-27-announcing-typescript-eslint-v8-beta.mdx @@ -314,7 +314,6 @@ See [[rule-tester] support multipass fixes](https://github.com/typescript-eslint - ⏳ [Repo: Rule [options] parameter should be non-nullable if defaultOptions exists](https://github.com/typescript-eslint/typescript-eslint/issues/5439) - [feat(parser): always enable comment, loc, range, tokens](https://github.com/typescript-eslint/typescript-eslint/pull/8617) - If you were manually calling `@typescript-eslint/parser` functions, those options are no longer necessary to provide -- [feat(rule-tester): support multipass fixes](https://github.com/typescript-eslint/typescript-eslint/pull/8883) - [chore(type-utils)!: remove IsNullableTypeOptions interface](https://github.com/typescript-eslint/typescript-eslint/pull/8934) - If you were using `isNullableType`, you can omit its section parameter - [feat(utils): swap LegacyESLint out for FlatESLint as ESLint export](https://github.com/typescript-eslint/typescript-eslint/pull/8972)