diff --git a/.cspell.json b/.cspell.json index c9be4caedb7..f6bb6c5cd87 100644 --- a/.cspell.json +++ b/.cspell.json @@ -106,6 +106,7 @@ "transpiled", "transpiles", "transpiling", + "triaging", "tsconfigs", "tsutils", "tsvfs", diff --git a/.eslintrc.js b/.eslintrc.js index 8e62b6d06e3..6dfb0c35362 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -257,6 +257,11 @@ module.exports = { './packages/eslint-plugin/src/rules/**/*.ts', ], rules: { + 'eslint-plugin/require-meta-docs-description': [ + 'error', + { pattern: '^(Enforce|Require|Disallow) .+[^. ]$' }, + ], + // specifically for rules - default exports makes the tooling easier 'import/no-default-export': 'off', }, @@ -308,7 +313,7 @@ module.exports = { rules: { // disallow ALL unused vars '@typescript-eslint/no-unused-vars': 'error', - '@typescript-eslint/sort-type-union-intersection-members': 'error', + '@typescript-eslint/sort-type-constituents': 'error', }, }, { diff --git a/.github/DISCUSSION_TEMPLATE/rfcs.yml b/.github/DISCUSSION_TEMPLATE/rfcs.yml new file mode 100644 index 00000000000..0e0b99abf05 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/rfcs.yml @@ -0,0 +1,24 @@ +body: + - attributes: + label: RFC + value: | + Suggested changes... + id: rfc + type: textarea + - attributes: + label: Additional Info + value: | + Any additional info... + id: additional + type: textarea + - attributes: + label: Before you submit your RFC, please confirm the following. If any of these required steps are not taken, we may not be able to review your RFC. Help us to help you! + options: + - label: I have [searched for related discussions](https://github.com/typescript-eslint/typescript-eslint/discussions) and [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues) and found none that match my proposal. + required: true + - label: I have [read the FAQ](https://typescript-eslint.io/docs/linting/troubleshooting) and my problem is not listed. + required: true + id: required-checks + type: checkboxes +labels: ['rfc'] +title: Your Title Here diff --git a/.github/SPONSORSHIPS.md b/.github/SPONSORSHIPS.md index 15638be935c..48d8ae5fc74 100644 --- a/.github/SPONSORSHIPS.md +++ b/.github/SPONSORSHIPS.md @@ -15,6 +15,23 @@ Sponsoring TypeScript ESLint helps keep our development process running reliably - Fix bugs and add new features to existing rules - Write more advanced rules to solve more areas of application correctness +### Sponsorship Benefits + +In addition to benefitting the TypeScript ecosystem, sponsoring us on Open Collective helps promote your company and development brand. +Our top sponsors may have their link, logo, and/or name featured on the homepage of [typescript-eslint.io](https://typescript-eslint.io). + +At present, sponsors must have given at least $100 to be featured on the homepage. +Placement tiers are based on total donations: + +- Platinum sponsors: Top 6 donators +- Gold supporters: The next 10 donators +- Silver supporters: The next 18 donators + +You can always view all financial contributors on [opencollective.com/typescript-eslint](https://opencollective.com/typescript-eslint). + +> Got an idea for how to make sponsorship work for you? +> Let us know at `typescripteslint@gmail.com`! + ## Sponsorship Limitations ### Project Direction @@ -25,7 +42,6 @@ If you have a need to push forward an area of work in TypeScript ESLint more urg ### Website Placement -Our top sponsors may have their link, logo, and/or name featured on the homepage of https://typescript-eslint.io. We are inclusive by default and allow all organizations that newly meet a monetary threshold to be added. However, at our discretion, we may remove organizations we feel we cannot promote in good conscience. Organizations would most commonly be removed if their core charter and/or repeated organization-wide intentional activities: @@ -35,5 +51,3 @@ Organizations would most commonly be removed if their core charter and/or repeat - Finance and/or promote other organizations that match these issues If you disagree with a choice made by the maintenance team, or would like a refund for your sponsorship, please let us know by emailing `typescripteslint@gmail.com`. - -> You can always view all financial contributors on [opencollective.com/typescript-eslint](https://opencollective.com/typescript-eslint). diff --git a/.github/replies.yml b/.github/replies.yml index 0522dfc445c..3edf22c3ca1 100644 --- a/.github/replies.yml +++ b/.github/replies.yml @@ -1,4 +1,7 @@ replies: + - body: | + ๐Ÿ‘‹ Hey @{{ author }}! Just checking in, is this still something you have time for? No worries if not - I just don't want to leave it hanging. + name: Checking In - body: | Thanks for posting! This is a duplicate of #. Before filing an issue, please [use our issue search](https://github.com/typescript-eslint/typescript-eslint/issues) to check for open and closed issues that already address what you're looking for. name: Clearly Duplicate Issue @@ -17,6 +20,25 @@ replies: \ If you need it sooner, please try the `canary` tag on NPM. name: Fix Has Been Merged + - body: | + Thanks for the report @!\ + This might be a valid issue, but we can't tell because you haven't filled in enough information.\ + Please fill in the rest of the issue template so we can take a look.\ + Thanks! + name: Needs More Info + - body: | + Thanks for the report @!\ + I can't reproduce the issue using the repository you provided.\ + Could you please comment with instructions on how to reproduce the issue?\ + Thanks! + name: Needs Full Reproduction + - body: | + Thanks for the report @!\ + I can't reproduce the issue using the code you provided.\ + Could you please create an isolated reproduction in our playground (https://typescript-eslint.io/play) and comment back when you've got one?\ + We prefer an isolated reproduction so that we as volunteer maintainers can quickly reproduce the issue and more easily find the cause.\ + Thanks! + name: Needs Playground Reproduction - body: | With any issue opened in this project โ€” it either has visible progress in the form of an attached PR, or it has no progress.\ \ @@ -33,6 +55,12 @@ replies: If this issue is important to you โ€” consider being that champion. If not โ€” please use the subscribe function and wait patiently for someone else to implement this. name: Progress - Nice + - body: | + Closing this issue as it's been stale for ~6 weeks without activity. Feel free to reopen @{{ author }} if you have time - but no worries if not! If anybody wants to drive it forward, please do either post here or in a new issue with the info we asked about. Thanks! ๐Ÿ˜Š + name: Pruning Stale Issue + - body: | + Closing this PR as it's been stale for ~6 weeks without activity. Feel free to reopen @{{ author }} if you have time - but no worries if not! If anybody wants to drive it forward, please do post your own PR - and if you use this as a start, consider adding `Co-authored-by: @{{ author }}` at the end of your PR description. Thanks! ๐Ÿ˜Š + name: Pruning Stale PR - body: | As per [our contributing guidelines](https://github.com/typescript-eslint/typescript-eslint/blob/master/CONTRIBUTING.md#addressing-feedback-and-beyond) this PR is in the queue of PRs to reviewed, and will be reviewed when we are able. \ diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index fc8cea8a8ac..a7ef3bd4965 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -17,9 +17,9 @@ jobs: - uses: dessant/lock-threads@v3 with: github-token: ${{ github.token }} - issue-inactive-days: '30' + issue-inactive-days: '7' issue-lock-reason: 'resolved' issue-comment: '' - pr-inactive-days: '30' + pr-inactive-days: '7' pr-lock-reason: 'resolved' pr-comment: '' diff --git a/.prettierignore b/.prettierignore index 637f32f77bf..bb855f41157 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,6 +12,10 @@ packages/eslint-plugin/src/configs/*.json CONTRIBUTORS.md packages/ast-spec/src/*/*/fixtures/_error_/*/fixture.ts +# prettier doesn't yet support satisfies +packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/ +packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts + # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0304329f3aa..b6e1fb0f529 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,64 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +### Bug Fixes + +- **eslint-plugin:** [no-empty-interface] disable autofix for declaration merging with class ([#5920](https://github.com/typescript-eslint/typescript-eslint/issues/5920)) ([a4f85b8](https://github.com/typescript-eslint/typescript-eslint/commit/a4f85b8cfe38ba8ea2a2ac4a56d9b11a81a8a15a)) +- **eslint-plugin:** [no-unnecessary-condition] handle index signature type ([#5912](https://github.com/typescript-eslint/typescript-eslint/issues/5912)) ([5baad08](https://github.com/typescript-eslint/typescript-eslint/commit/5baad0893f9a90633d57fffac69af7523bd1501e)) +- **eslint-plugin:** [prefer-optional-chain] handle binary expressions in negated or ([#5992](https://github.com/typescript-eslint/typescript-eslint/issues/5992)) ([2778ff0](https://github.com/typescript-eslint/typescript-eslint/commit/2778ff0c3db011148be93ed3bea5ce07af3c81ef)) +- **typescript-estree:** don't consider a cached program unless it's specified in the current `parserOptions.project` config ([#5999](https://github.com/typescript-eslint/typescript-eslint/issues/5999)) ([530e0e6](https://github.com/typescript-eslint/typescript-eslint/commit/530e0e618cdf4bb956149bf8a8484848e1b9a1f5)) + +### Features + +- **eslint-plugin:** [adjacent-overload-signatures] check BlockStatement nodes ([#5998](https://github.com/typescript-eslint/typescript-eslint/issues/5998)) ([97d3e56](https://github.com/typescript-eslint/typescript-eslint/commit/97d3e56709ee19fdec39fd8b99d080db90b306e9)) +- **eslint-plugin:** [keyword-spacing] Support spacing in import-type syntax ([#5977](https://github.com/typescript-eslint/typescript-eslint/issues/5977)) ([6a735e1](https://github.com/typescript-eslint/typescript-eslint/commit/6a735e142ef67f3af6497f922cf83706867eb6b7)) +- support parsing `satisfies` operators ([#5717](https://github.com/typescript-eslint/typescript-eslint/issues/5717)) ([20d7cae](https://github.com/typescript-eslint/typescript-eslint/commit/20d7caee35ab84ae6381fdf04338c9e2b9e2bc48)) +- update to TypeScript 4.9 ([#5716](https://github.com/typescript-eslint/typescript-eslint/issues/5716)) ([4d744ea](https://github.com/typescript-eslint/typescript-eslint/commit/4d744ea10ba03c66eebcb63e8722e9f0165fbeed)) + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +### Bug Fixes + +- **eslint-plugin:** [no-shadow] handle false positives on generics and parameters ([#5902](https://github.com/typescript-eslint/typescript-eslint/issues/5902)) ([769e8c8](https://github.com/typescript-eslint/typescript-eslint/commit/769e8c8b9a51cd3448e47d13c7b0dab0468ee23c)) +- **eslint-plugin:** [promise-function-async] handle keyword token ([#5907](https://github.com/typescript-eslint/typescript-eslint/issues/5907)) ([f25a94f](https://github.com/typescript-eslint/typescript-eslint/commit/f25a94fa75e497a6b9ec29a008bcc89818eed60d)) + +### Features + +- **eslint-plugin:** [consistent-type-imports] support fixing to inline types ([#5050](https://github.com/typescript-eslint/typescript-eslint/issues/5050)) ([75dcdf1](https://github.com/typescript-eslint/typescript-eslint/commit/75dcdf164d206c5530ba7cc095c4599ec90abe35)) +- **eslint-plugin:** [naming-convention] add support for "override" and "async" modifiers ([#5310](https://github.com/typescript-eslint/typescript-eslint/issues/5310)) ([#5610](https://github.com/typescript-eslint/typescript-eslint/issues/5610)) ([c759da1](https://github.com/typescript-eslint/typescript-eslint/commit/c759da169390ba490eee9ef773cc9edc88a32817)) +- **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5594](https://github.com/typescript-eslint/typescript-eslint/issues/5594)) ([923d486](https://github.com/typescript-eslint/typescript-eslint/commit/923d486c8c9c9096deac425e7a6cb0b6457eacbd)) + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +### Bug Fixes + +- **ast-spec:** correct misnamed ExportNamedDeclaration AST type ([#5913](https://github.com/typescript-eslint/typescript-eslint/issues/5913)) ([e88f4fa](https://github.com/typescript-eslint/typescript-eslint/commit/e88f4fa1d0127ba0ddeff578ec67f2e66a1de68b)) +- **eslint-plugin:** isTypeReadonly stack overflow ([#5875](https://github.com/typescript-eslint/typescript-eslint/issues/5875)) ([#5876](https://github.com/typescript-eslint/typescript-eslint/issues/5876)) ([2d9a33c](https://github.com/typescript-eslint/typescript-eslint/commit/2d9a33cfb2db53d76246a59253daaf2abb19ee57)) + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +### Bug Fixes + +- **ast-spec:** add TSQualifiedName to TypeNode union ([#5906](https://github.com/typescript-eslint/typescript-eslint/issues/5906)) ([5c316c1](https://github.com/typescript-eslint/typescript-eslint/commit/5c316c12f09d58aee6ee634a8055533f361f1589)) +- **eslint-plugin:** [no-extra-parens] handle type assertion in extends clause ([#5901](https://github.com/typescript-eslint/typescript-eslint/issues/5901)) ([8ed7219](https://github.com/typescript-eslint/typescript-eslint/commit/8ed72192c274249d26628fb125796e71318b857a)) +- **eslint-plugin:** enable react/jsx-curly-brace-presence lint rule in website package ([#5894](https://github.com/typescript-eslint/typescript-eslint/issues/5894)) ([344322a](https://github.com/typescript-eslint/typescript-eslint/commit/344322add846d03c6c9981e486b09e6ba1196555)) +- **typescript-estree:** don't allow single-run unless we're in type-aware linting mode ([#5893](https://github.com/typescript-eslint/typescript-eslint/issues/5893)) ([891b087](https://github.com/typescript-eslint/typescript-eslint/commit/891b0879ba9c64a4722b8c0bf9e599a725b6d6df)) + +### Features + +- **eslint-plugin:** [member-ordering] add natural sort order ([#5662](https://github.com/typescript-eslint/typescript-eslint/issues/5662)) ([1eaae09](https://github.com/typescript-eslint/typescript-eslint/commit/1eaae09ecca359f366b94f6a04665403f48b05c7)) +- **eslint-plugin:** [no-invalid-void-type] better report message for void used as a constituent inside a function return type ([#5274](https://github.com/typescript-eslint/typescript-eslint/issues/5274)) ([d806bda](https://github.com/typescript-eslint/typescript-eslint/commit/d806bda82343712a24e3c78b9b34d4345dd1de3b)) +- **scope-manager:** ignore ECMA version ([#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881)) ([3b8d449](https://github.com/typescript-eslint/typescript-eslint/commit/3b8d449696c319690536a18a48ef32749dc2f559)) +- **typescript-estree:** clarify docs and error for program project without matching TSConfig ([#5762](https://github.com/typescript-eslint/typescript-eslint/issues/5762)) ([67744db](https://github.com/typescript-eslint/typescript-eslint/commit/67744db31f61acab14b5fe027fbc2844ba198c97)) +- **utils:** add `RuleTester` API for top-level dependency constraints ([#5896](https://github.com/typescript-eslint/typescript-eslint/issues/5896)) ([0520d53](https://github.com/typescript-eslint/typescript-eslint/commit/0520d53536af411d66ce2ce0dd478365e67adbac)) +- **website:** Add a happy message to playground output pane when no errors or AST ([#5868](https://github.com/typescript-eslint/typescript-eslint/issues/5868)) ([#5873](https://github.com/typescript-eslint/typescript-eslint/issues/5873)) ([c4e0d86](https://github.com/typescript-eslint/typescript-eslint/commit/c4e0d8678e0398f3ab85510f40ad6f97832b9e6d)) + +### Reverts + +- Revert "feat(scope-manager): ignore ECMA version" (#5888) ([2ee81df](https://github.com/typescript-eslint/typescript-eslint/commit/2ee81df5a365d82ef4b3dfc124d4ec39c7bcb725)), closes [#5888](https://github.com/typescript-eslint/typescript-eslint/issues/5888) [#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881) + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) ### Bug Fixes diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 3d6d37b2190..9d9b15f70f2 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -10,83 +10,83 @@ Thanks goes to these wonderful people:
Brad Zacher

Armano

Josh Goldberg
-
Reyad Attiyat
+
Oleksandr T.
+
Michaรซl De Boey
+
Reyad Attiyat

Patricio Trevino

Sosuke Suzuki

Joshua Chen
-
Nicholas C. Zakas
-
Jed Fox
+
Nicholas C. Zakas

YeonJuan
+
Jed Fox

Rafael Santana

Ben Lichtman
-
Nikita
-
Taeheon Kim
+
Nikita
+
Taeheon Kim

Scott O'Hara

Retsam

Kai Cataldo
-
Rasmus Eneman
-
Toru Nagashima
+
Rasmus Eneman
+
Rebecca Stevens
+
Toru Nagashima

Yosuke Ota

JounQin
+ +
Lucas Azzola

Danny Fritz

Ika
- -
mackie

Simen Bekkhus
+ +
Kanitkorn Sujautra

cherryblossom

Zzzen
+
Anix
+
Daniil Dubrava
-
Anix
-
Pete Gonzalez

ldrick

Susisu
+
Bryan Mishkin

Gavin Barron
+
Kevin Partington
-
Kevin Partington

Lucas Duailibe

Niles Salter
+
Pavel Birukov
+
Shahar Dawn Or

SHIMA RYUHEI
-
koooge
+
koooge

thomas michael wallace

ulrichb

Juan Garcรญa
-
Bryan Mishkin

Daniel Cassidy
-
Daniel Nixon

Denys Kniazevych
-
Dimitri Mitropoulos

Ian MacLeod

Jonathan Delgado
- -
Philipp A.

Pig Fang
-
Tadhg McDonald-Jensen
-
Thomas den Hollander
-
Yasar Siddiqui
+
Thomas den Hollander
+
Yasar Siddiqui

Yusuke Tanaka
-
Bence Dรกnyi
-
Eric Wang
-
Soobin Bak
+
zz
diff --git a/README.md b/README.md index 782186f9373..511c8dc54cf 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ The latest version under the `canary` tag **(latest commit to `main`)** is: ### Supported TypeScript Version -**The version range of TypeScript currently supported by this parser is `>=4.2.0 <4.9.0`.** +**The version range of TypeScript currently supported by this parser is `>=4.2.0 <5.0.0`.** Note that we mirror [DefinitelyTyped's version support window](https://github.com/DefinitelyTyped/DefinitelyTyped/#support-window) - meaning we only support versions of TypeScript less than 2 years old. diff --git a/docs/MAINTENANCE.md b/docs/MAINTENANCE.md new file mode 100644 index 00000000000..75f1030c015 --- /dev/null +++ b/docs/MAINTENANCE.md @@ -0,0 +1,12 @@ +--- +id: maintenance +sidebar_label: Maintenance Guide +title: Maintenance Guide +--- + +This is the maintainers guide to working on typescript-eslint. +It's intended for use by contributors who have been given access to at least triage issues and pull requests. +We keep it in the open for visibility into our processes. + +> If you're reading this as a new maintainer: welcome! +> We're happy to have you! โค๏ธโ€๐Ÿ”ฅ diff --git a/docs/linting/TROUBLESHOOTING.md b/docs/linting/TROUBLESHOOTING.md index e477267c476..5001a0a16fa 100644 --- a/docs/linting/TROUBLESHOOTING.md +++ b/docs/linting/TROUBLESHOOTING.md @@ -86,6 +86,21 @@ module.exports = { }; ``` +## I am running into errors when parsing TypeScript in my .vue files + +If you are running into issues parsing .vue files, it might be because parsers like [`vue-eslint-parser`](https://www.npmjs.com/package/vue-eslint-parser) are required to parse `.vue` files. In this case you can move `@typescript-eslint/parser` inside `parserOptions` and use `vue-eslint-parser` as the top level parser. + +```diff +- "parser": "@typescript-eslint/parser", ++ "parser": "vue-eslint-parser", + "parserOptions": { ++ "parser": "@typescript-eslint/parser", + "sourceType": "module" + } +``` + +The `parserOptions.parser` option can also specify an object to specify multiple parsers. See the [`vue-eslint-parser` usage guide](https://eslint.vuejs.org/user-guide/#usage) for more details. + ## One of my lint rules isn't working correctly on a pure JavaScript file This is to be expected - ESLint rules do not check file extensions on purpose, as it causes issues in environments that use non-standard extensions (for example, a `.vue` and a `.md` file can both contain TypeScript code to be linted). @@ -205,6 +220,25 @@ For example: See [this issue comment](https://github.com/typescript-eslint/typescript-eslint/issues/4102#issuecomment-963265514) for more details. +## Changes to one file are not reflected when linting other files in my IDE + +> tl;dr: Restart your ESLint server to force an update. + +ESLint currently does not have any way of telling parsers such as ours when an arbitrary file is changed on disk. +That means if you change file A that is imported by file B, it won't update lint caches for file B -- even if file B's text contents have changed. +Sometimes the only solution is to restart your ESLint editor extension altogether. + +See [this issue comment](https://github.com/typescript-eslint/typescript-eslint/issues/5845#issuecomment-1283248238 'GitHub issue 5845, comment 1283248238: details on ESLint cross-file caching') for more information. + +:::tip +[VS Code's ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) provides an `ESLint: Restart ESLint Server` action. +::: + +### I get `no-unsafe-*` complaints for cross-file changes + +See [Changes to one file are not reflected in linting other files in my IDE](#changes-to-one-file-are-not-reflected-in-linting-other-files-in-my-ide). +Rules such as [`no-unsafe-argument`](https://typescript-eslint.io/rules/no-unsafe-argument), [`no-unsafe-assignment`](https://typescript-eslint.io/rules/no-unsafe-assignment), and [`no-unsafe-call`](https://typescript-eslint.io/rules/no-unsafe-call) are often impacted. + ## My linting feels really slow As mentioned in the [type-aware linting doc](./TYPED_LINTING.md), if you're using type-aware linting, your lint times should be roughly the same as your build times. diff --git a/docs/maintenance/ISSUES.md b/docs/maintenance/ISSUES.md new file mode 100644 index 00000000000..3b73d5af1a2 --- /dev/null +++ b/docs/maintenance/ISSUES.md @@ -0,0 +1,113 @@ +--- +id: issues +sidebar_label: Issues +title: Issues +--- + +This document serves as a guide for how you might manage issues, also known as issue triaging. + +Use your best judgement when triaging issues, and most of all remember to be **kind, friendly, and encouraging** when responding to users. +Many users are new to open source and/or typed linting. +It's imperative we give them a positive, uplifting experience. + +:::tip +If you're ever unsure on any part of issue management, don't hesitate to loop in a maintainer that has more context to help! +::: + +## Issue Flow + +:::note +We include a set of common responses to issues in [`.github/replies.yml`](https://github.com/typescript-eslint/typescript-eslint/blob/main/.github/replies.yml), intended to be used with the [Refined Saved Replies](https://github.com/JoshuaKGoldberg/refined-saved-replies) extension. +Don't treat these as exact responses you must use: they're just a starting copy+paste helper. +Please do adopt your specific responses to your personal tone and to match the thread for non-straightforward issues. +::: + +[Issues pending triage](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aopen+is%3Aissue+label%3Atriage) are searchable the `triage` label. +That label is added automatically when a new issue is created. +Most issues go through the following review flow when created or updated: + +1. A maintainer ensures the issue is valid: + - If the poster didn't fill out an appropriate template with enough information: + - Add the `please fill out the template` and `awaiting response` labels + - Ask the poster for more information using a _Needs More Info_ response + - If it's a duplicate of an issue that already exists: + - Add the `duplicate` label and remove the `bug` label + - If it's an obvious duplicate, post a _Clearly Duplicate Issue_ response + - If it's not an obvious duplicate, link to the existing issue and explain why + - If the code is working as intended: + - Add the `working as intended` label and remove the `bug` and `triage` labels + - If the behavior is due to the user doing something wrong, such as an incorrect config: + - Add the `fix: user error` label + - [This issue search has some examples of closing comments](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3A%22fix%3A+user+error%22+is%3Aclosed) + - If the behavior is otherwise expected, [this issue search has some examples of closing comments](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+sort%3Aupdated-desc+label%3A%22working+as+intended%22+-label%3A%22fix%3A+user+error%22+is%3Aclosed+) + - You needn't go into too much detail in your comment - just enough to explain it +2. If the report is valid, add the `accepting prs` label and remove the `triage` label +3. If you know the rough steps for a fix, consider writing a comment with links to codebase to help someone put together a fix +4. If you think that the fix is relatively straightforward, consider also adding the `good first issue` label + +Whenever an issue is waiting for the reporter to provide more information, it should be given the `awaiting response` label. +When more information is provided: + +- If you have time to go through the triage flow again, do so +- If you don't have time, add the `triage` label and remove the `awaiting response` label + +:::tip +If your link is both a "permalink" (includes a commit hash instead of a branch name) and has a line number/line range then GitHub will embed the code in your comment. +When viewing a file in GitHub pressing `y` will update the URL to a "permalink" with the current commit hash, then you can select the relevant lines and paste that URL into the comment. +::: + +### Determining Whether Code is Working As Intended + +As you become more familiar with the codebase and how everything works, this will be easier to do intuitively, but to begin with, this will likely involve investigating the documentation, code, and tests to determine if it's a bug or working as intended. +In general, if there is a passing test or documented example that is the same as or similar to the repro code โ€” that indicates it's working as intended. +If you can't find anything that matches, use your best judgement based on the spirit of the code. + +### Looking for Duplicates + +It's worth noting that, occasionally, a user will intentionally raise a duplicate issue because they feel the original issue was closed when it shouldn't have been. +If this is the case, you should read the original issue to gather context, understand the reason for it being closed, and determine if the new issue raises any new or relevant point that requires addressing. + +## Skipping Steps + +As you become more familiar with the codebase and how it's supposed to behave you'll be able to skip steps or do things out of order as you see fit. +For example, you may be able to identify if a bug report is "working as intended", or you might recognize an issue as a duplicate without having a completely filled-out issue. +In such cases you can forgo the back-and-forth and just skip to the closing steps. + +## Specific Issue Types + +### ๐Ÿ› Bug Reports + +#### ๐Ÿž "Simple" Bugs + +A simple bug is a bug that can be reproduced in a single TS file plus an ESLint config (and possibly a TSConfig) - i.e. an issue reproducible on https://typescript-eslint.io/play. +The vast majority of bug reports fall into this category. + +If you cannot reproduce the issue as described using the issue's provided playground reproduction, it has not provided enough information. +Consider using a specific response like the _Needs Playground Reproduction_ response. + +#### ๐ŸฆŸ "Complex" Bugs + +A complex bug is a bug that requires multiple files to reproduce. +This is the rarer case, but does happen when people are using library types or if there are issues when types are imported. + +These bugs should be reported with a link to a GitHub repository that can be checked out to reproduce the issue. +If you cannot reproduce the issue as described using repository's README.md and issue description, it has not provided enough information. +Consider using a specific response like the _Needs Full Reproduction_ response. + +### โœจ Rule Enhancements + +TODO: This will be filled out... soon! + +### ๐Ÿš€ New Rules + +TODO: This will be filled out... soon! + +## Pruning Old Issues + +Every so often, we like to [search for open issues `awaiting response`](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aopen+is%3Aissue+label%3A%22awaiting+response%22) to find ones that might have been forgotten. +Our flow for issues that have been waiting for >=1 month is: + +1. Ping the author with a message like the _Checking In_ template +2. Add the `stale` label to the issue +3. Wait 2 weeks +4. If they still haven't responded, close the issue with a message like the _Pruning Stale Issue_ template diff --git a/docs/maintenance/PULL_REQUESTS.md b/docs/maintenance/PULL_REQUESTS.md new file mode 100644 index 00000000000..37c6b40256c --- /dev/null +++ b/docs/maintenance/PULL_REQUESTS.md @@ -0,0 +1,34 @@ +--- +id: pull-requests +title: Pull Requests +--- + +This document serves as a guide for how you might review pull requests. + +Use your best judgement when reviewing PRs, and most of all remember to be **kind, friendly, and encouraging** when responding to users. +Many users are new to open source and/or typed linting. +It's imperative we give them a positive, uplifting experience. + +:::tip +If you're ever unsure on any part of PR reviews, don't hesitate to loop in a maintainer that has more context to help! +::: + +## PR Flow + +:::note +We include a set of common responses to PRs in [`.github/replies.yml`](https://github.com/typescript-eslint/typescript-eslint/blob/main/.github/replies.yml), intended to be used with the [Refined Saved Replies](https://github.com/JoshuaKGoldberg/refined-saved-replies) extension. +Don't treat these as exact responses you must use: they're just a starting copy+paste helper. +Please do adopt your specific responses to your personal tone and to match the thread for non-straightforward PRs. +::: + +TODO: This will be filled out... soon! + +## Pruning Old PRs + +Every so often, we like to [search for open PRs `awaiting response`](https://github.com/typescript-eslint/typescript-eslint/pulls?q=is%3Aopen+is%3Apr+label%3A%22awaiting+response%22) to find ones that might have been forgotten. +Our flow for PRs that have been waiting for >=1 month is: + +1. Ping the author with a message like the _Checking In_ template +2. Add the `stale` label to the PR +3. Wait 2 weeks +4. If they still haven't responded, close the PR with a message like the _Pruning Stale PR_ template diff --git a/docs/maintenance/RELEASES.md b/docs/maintenance/RELEASES.md new file mode 100644 index 00000000000..211294d488b --- /dev/null +++ b/docs/maintenance/RELEASES.md @@ -0,0 +1,88 @@ +--- +id: releases +sidebar_label: Releases +title: Releases +--- + +## Canary + +We release a canary version for each commit to `main` that passes all required checks. This release is performed automatically by the [`publish_canary_version` step](https://github.com/typescript-eslint/typescript-eslint/blob/5feb2dba9da2bd5e233451b7b0f1c99414b5aef9/.github/workflows/ci.yml#L234-L263). + +This release is goes to the `canary` tag on npm and it is versioned as an incremental canary patch release on top of the current `latest` version. I.e. if the current version is `5.6.1`, then the first canary version will be `5.6.2-alpha.0`, the second `5.6.2-alpha.1`, and so on. + +## Latest + +We release a latest version every Monday at 1pm US Eastern time using the latest commit to `main` at that time. This release is performed automatically by a Github action located in a private repository. This release goes to the standard `latest` tag on npm. + +See the [versioning](#versioning) section below for how the version number is calculated. + +If there have been no commits that impact public-facing packages then a patch-level release shall be released. + +Latest releases shall only ever be "minor" or "patch" releases. + +## Major Releases + +We currently do not have a set schedule around when major releases shall be performed; instead they are done as the need arises. + +We keep a backlog of breaking issues as a milestone on GitHub that is named in the form `${major}.0.0`. +When we do do a major release, we release a release candidate version to the `rc-v${major}` tag on npm for each commit to the major branch. + +### Major Release Steps + +Our releases go through three groups of steps: + +1. [Pre-Release Preparation] +1. [Merging Breaking Changes] +1. [Releasing the Version] + +#### 1. Pre-Release Preparation + +1. Create a milestone by the name of the release [example: [Milestone 6.0.0](https://github.com/typescript-eslint/typescript-eslint/milestone/8)]. +1. If an issue for changes to recommended rule configs doesn't yet exist, create one [example: [Changes to the `recommended` sets for 5.0.0](https://github.com/typescript-eslint/typescript-eslint/issues/5900)]. +1. Add any breaking changes intended for the release to that milestone. +1. Create two new branches off `main` in the project repository (not a personal fork): + - `v${major}` + - `v${major}-canary-auto-release` +1. Raise a PR from `v${major}-canary-auto-release` to `main` modifying the [`ci.yml` workflow](https://github.com/typescript-eslint/typescript-eslint/blob/main/.github/workflows/ci.yml) [example: [chore: add auto-canary release for v6](https://github.com/typescript-eslint/typescript-eslint/pull/5883)]: + - Under `pushes:` at the beginning of the file, add an `- v${major}` list item. + - Add a `publish_canary_version_v${major}` step the same as `publish_canary_version` except: + - Add the condition: `if: github.ref == 'refs/heads/v${major}'`. + - Its publish command should be `npx lerna publish premajor --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v${major}`. + - Merge this into `main` once reviewed and rebase the `v${major}` branch. + +#### 2. Merging Breaking Changes + +1. Send a PR from `v${major}` to `main` [example: [v6.0.0](https://github.com/typescript-eslint/typescript-eslint/pull/5886)]. +1. Change all [breaking change PRs](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+is%3Aopen+label%3A%22breaking+change%22) to target the `v${major}` branch. + - To signify these changes as breaking, the first line of the PR description must read as `BREAKING CHANGE:`, and second line should briefly summarize the changes. + - It is important to note that when merged the commit message must also include `BREAKING CHANGE:` as the first line in order for lerna to recognize it as a breaking change in the release notes. If you miss this it just means more manual work when writing the release documentation. +1. Wait until all required PRs have been merged +1. Let the release wait for **at least 1 week** to allow time for early adopters to help test it and discuss the changes. + - Promote it on the [`@tseslint`](https://twitter.com/tseslint) twitter to get some additional attention. +1. Once discussions have settled, rebase merge the PR on top of `main`. + +:::note +_Non_-breaking changes can be merged to `main` or the major branch. +They don't need any special treatment. +::: + +#### 3. Releasing the Version + +1. Discuss with the maintainers to be ready for an [out-of-band](#out-of-band) release. Doing this manually helps ensure someone is on-hand to action any issues that might arise from the major release. +1. Prepare the release notes. Lerna will automatically generate the release notes on GitHub, however this will be disorganized and unhelpful for users. We need to reorganize the release notes so that breaking changes are placed at the top to make them most visible. If any migrations are required, we must list the steps to make it easy for users. + +- Example release notes: [`v5.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v5.0.0), [`v4.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0), [`v3.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) + +1. Finally, tweet the release on the `@tseslint` twitter with a link to the GitHub release. Make sure you include additional information about the highlights of the release! + +## Out-of-Band + +We will do releases "out-of-band" (outside the [latest](#latest) schedule) for rare emergencies. +We assess need on a case-by-case basis though generally an emergency is defined as a critical regression specifically introduced in the latest release. + +These releases are done manually by a maintainer with the required access privileges. + +## Back-Porting Releases + +We **_do not_** back port releases to previously released major/minor versions. +We only ever release forward. diff --git a/docs/maintenance/VERSIONING.md b/docs/maintenance/VERSIONING.md new file mode 100644 index 00000000000..514215d1136 --- /dev/null +++ b/docs/maintenance/VERSIONING.md @@ -0,0 +1,72 @@ +--- +id: versioning +sidebar_label: Versioning +title: Versioning +--- + +We follow [semantic versioning (semver)](https://semver.org). +This page exists to help set guidelines around when what we consider to fall within each of the semver categories. + +All of the packages in this project are published with the same version number to make it easier to coordinate both releases and installations. + +When considering whether a change should be counted as "breaking" we first need to consider what package(s) it impacts. For example breaking changes for the parser packages have a different standard to those for the ESLint plugins. This is because not only do they have _very_ different API surfaces, they also are consumed in very different ways. + +Please note that the lists provided below are non-exhaustive and are intended to serve as examples to help guide maintainers when planning and reviewing changes. + +## Internal packages + +Any packages in this project that are not part of our public API surface (such as `eslint-plugin-internal` or `website`) shall not be considered when calculating new package versions. + +## `ast-spec` and `visitor-keys` + +A change to the AST **_shall_** be considered breaking if it: + +- Removes or renames an existing AST Node. +- Removes or renames an existing property on an AST Node. +- Changes a type in a non-refining way (i.e. `string` to `number`). + +A change to the AST **_shall not_** be considered breaking if it: + +- Adds a new property to the AST. +- Adds a new node type to the AST. +- Adds a new node type to an existing union type. +- Refines a type to be more specific (i.e. `string` to `'literal' | 'union'`). +- Removes a type from a union that was erroneously added and did not match the runtime AST. + +## `eslint-plugin` and `eslint-plugin-tslint` + +A change to the plugins **_shall_** be considered breaking if it will require the user to change their config. More specifically: + +- Removes or renames an option. +- Changes the default option of a rule. +- Changes a rule's schema to be stricter. +- Consumes type information to a rule that did not previously consume it. +- Removes or renames a rule. +- Changes any of the recommended configurations. +- Changes the default behavior of a rule in such a way that causes new reports in a large set of cases in an average codebase. + +A change to the plugins **_shall not_** be considered breaking if it: + +- Adds an option that by default does not remove existing functionality. +- Adds a rule. +- Deprecates a rule. +- Adds additional checks to an existing rule that causes new reports in a small-to-medium set of cases in an average codebase. +- Refactors a rule's code in a way that does not introduce additional reports. +- Changes to a rule's description or other metadata. +- Adds a fixer or suggestion fixer. +- Removes a fixer or suggestion fixer. +- Fixes incorrect behavior in a rule that may or may not introduce additional reports. + +### `parser`, `typescript-estree`, `scope-manager`, `types`, `type-utils`, `utils` + +A change to these packages **_shall_** be considered breaking if it: + +- Changes the API surface in a backwards-incompatible way (remove or rename functions, types, etc). + +A change to these packages **_shall not_** be considered breaking if it: + +- Adds to the API surface (add functions, types, etc). +- Deprecates parts of the API surface. +- Adds **_optional_** arguments to functions or properties to input types. +- Adds additional properties to output types. +- Adds documentation in the form of JSDoc comments. diff --git a/lerna.json b/lerna.json index 9e451c6323f..112f88b34a7 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "5.41.0", + "version": "5.44.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/nx.json b/nx.json index d5b11cdfb5a..ed1f57517e1 100644 --- a/nx.json +++ b/nx.json @@ -18,7 +18,7 @@ "default": { "runner": "@nrwl/nx-cloud", "options": { - "cacheableOperations": ["build", "test", "package", "prebuild"], + "cacheableOperations": ["build", "lint", "package", "prebuild", "test"], "accessToken": "YjFjNTBhOWUtY2JmNy00ZDhiLWE5N2UtZjliNDAwNmIzOTdjfHJlYWQtd3JpdGU=", "canTrackAnalytics": false, "showUsageWarnings": true, diff --git a/package.json b/package.json index 099a93835aa..592ff528a5f 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "lint-fix": "eslint . --fix", "lint-markdown-fix": "yarn lint-markdown --fix", "lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", - "lint": "cross-env NODE_OPTIONS=\"--max-old-space-size=16384\" eslint .", + "lint": "nx run-many --target=lint --all --parallel", "postinstall": "yarn patch-package && yarn husky install && yarn build", "pre-commit": "yarn lint-staged", "start": "nx run website:start", @@ -49,10 +49,11 @@ "node": "^14.18.0 || ^16.0.0 || >=18.0.0" }, "devDependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/eslint-parser": "^7.18.2", - "@babel/parser": "^7.18.0", - "@babel/types": "^7.18.2", + "@babel/code-frame": "^7.18.6", + "@babel/core": "^7.20.2", + "@babel/eslint-parser": "^7.19.1", + "@babel/parser": "^7.20.3", + "@babel/types": "^7.20.2", "@nrwl/nx-cloud": "14.7.0", "@nrwl/workspace": "14.8.4", "@swc/core": "^1.3.1", @@ -67,7 +68,7 @@ "@types/lodash": "^4.14.182", "@types/marked": "^4.0.3", "@types/ncp": "^2.0.5", - "@types/node": "^18.0.0", + "@types/node": "^18.11.9", "@types/prettier": "^2.6.0", "@types/rimraf": "^3.0.2", "@types/semver": "^7.3.9", @@ -90,8 +91,8 @@ "jest": "^29.0.3", "jest-diff": "^29.0.3", "jest-snapshot": "^29.0.3", - "jest-specific-snapshot": "^5.0.0", - "lerna": "6.0.1", + "jest-specific-snapshot": "^6.0.0", + "lerna": "6.0.3", "lint-staged": "^13.0.0", "make-dir": "^3.1.0", "markdownlint-cli": "^0.32.0", @@ -104,11 +105,11 @@ "tmp": "^0.2.1", "ts-node": "^10.7.0", "tslint": "^6.1.3", - "typescript": ">=4.2.4 <4.9.0" + "typescript": ">=4.2.4 <5.0.0" }, "resolutions": { - "typescript": "~4.8.3", - "@types/node": "^18.0.0", + "typescript": "~4.9.3", + "@types/node": "^18.11.9", "//": "Pin jest to v29 across the repo", "@jest/create-cache-key-function": "^29", "@jest/reporters": "^29", diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index 5d890f335a6..98f5cb54d73 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +### Features + +- support parsing `satisfies` operators ([#5717](https://github.com/typescript-eslint/typescript-eslint/issues/5717)) ([20d7cae](https://github.com/typescript-eslint/typescript-eslint/commit/20d7caee35ab84ae6381fdf04338c9e2b9e2bc48)) + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +### Bug Fixes + +- **ast-spec:** correct misnamed ExportNamedDeclaration AST type ([#5913](https://github.com/typescript-eslint/typescript-eslint/issues/5913)) ([e88f4fa](https://github.com/typescript-eslint/typescript-eslint/commit/e88f4fa1d0127ba0ddeff578ec67f2e66a1de68b)) + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +### Bug Fixes + +- **ast-spec:** add TSQualifiedName to TypeNode union ([#5906](https://github.com/typescript-eslint/typescript-eslint/issues/5906)) ([5c316c1](https://github.com/typescript-eslint/typescript-eslint/commit/5c316c12f09d58aee6ee634a8055533f361f1589)) + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/ast-spec diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index 565d3d1749b..05998bb22d9 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "5.41.0", + "version": "5.44.0", "description": "TypeScript-ESTree AST spec", "private": true, "keywords": [ @@ -34,7 +34,7 @@ "postclean": "rimraf dist && rimraf _ts3.4 && rimraf .rollup.cache && rimraf coverage", "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest", "typecheck": "tsc -p tsconfig.json --noEmit" }, diff --git a/packages/ast-spec/project.json b/packages/ast-spec/project.json index 24256b3e4d0..b892bb3fae0 100644 --- a/packages/ast-spec/project.json +++ b/packages/ast-spec/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/ast-spec/**/*.ts"] + } + } + } } diff --git a/packages/ast-spec/src/ast-node-types.ts b/packages/ast-spec/src/ast-node-types.ts index ff90dd1ee18..dbed6723fed 100644 --- a/packages/ast-spec/src/ast-node-types.ts +++ b/packages/ast-spec/src/ast-node-types.ts @@ -145,6 +145,7 @@ export enum AST_NODE_TYPES { TSQualifiedName = 'TSQualifiedName', TSReadonlyKeyword = 'TSReadonlyKeyword', TSRestType = 'TSRestType', + TSSatisfiesExpression = 'TSSatisfiesExpression', TSStaticKeyword = 'TSStaticKeyword', TSStringKeyword = 'TSStringKeyword', TSSymbolKeyword = 'TSSymbolKeyword', diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts index 061c53f4b46..b9b158eddb4 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts @@ -46,7 +46,7 @@ export interface ExportNamedDeclarationWithoutSourceWithMultiple extends ExportNamedDeclarationBase { // this will always be empty array assertions: ImportAttribute[]; - declaration: NamedExportDeclarations; + declaration: null; source: null; specifiers: ExportSpecifier[]; } @@ -55,7 +55,7 @@ export interface ExportNamedDeclarationWithoutSourceWithSingle extends ExportNamedDeclarationBase { // this will always be empty array assertions: ImportAttribute[]; - declaration: null; + declaration: NamedExportDeclarations; source: null; // this will always be empty array specifiers: ExportSpecifier[]; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/fixture.ts new file mode 100644 index 00000000000..917317da825 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/fixture.ts @@ -0,0 +1 @@ +[1,2,3] satisfies [1, 2, 3]; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..8c0e41971ea --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,149 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ArrayExpression { + type: "ArrayExpression", + elements: Array [ + Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [3, 4], + loc: { + start: { column: 3, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: "TSTupleType", + elementTypes: Array [ + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + + range: [18, 27], + loc: { + start: { column: 18, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..1bde181188c --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,166 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "[", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [2, 3], + loc: { + start: { column: 2, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [3, 4], + loc: { + start: { column: 3, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..d7f5aec514e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/3-Babel-AST.shot @@ -0,0 +1,149 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ArrayExpression { + type: "ArrayExpression", + elements: Array [ + Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [3, 4], + loc: { + start: { column: 3, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: "TSTupleType", + elementTypes: Array [ + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + + range: [18, 27], + loc: { + start: { column: 18, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..02abe5d8cba --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,166 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "[", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [2, 3], + loc: { + start: { column: 2, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [3, 4], + loc: { + start: { column: 3, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..3cf7cab2487 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..263f9da8e6c --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression array-array AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/fixture.ts new file mode 100644 index 00000000000..8478834cb78 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/fixture.ts @@ -0,0 +1 @@ +() => 1 satisfies number diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..57067f8fbff --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,68 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [6, 24], + loc: { + start: { column: 6, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..09102ae267b --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [3, 5], + loc: { + start: { column: 3, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..1ef0e54b35d --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,68 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [6, 24], + loc: { + start: { column: 6, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..24cc5b2042e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [3, 5], + loc: { + start: { column: 3, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..4697cea82c6 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..7fd90338cb4 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-no-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts new file mode 100644 index 00000000000..15624b9aaf3 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts @@ -0,0 +1 @@ +(() => 1) satisfies () => number diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..7fa95a22000 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [1, 8], + loc: { + start: { column: 1, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + typeAnnotation: TSFunctionType { + type: "TSFunctionType", + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [23, 32], + loc: { + start: { column: 23, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [20, 32], + loc: { + start: { column: 20, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b590cfdea64 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [2, 3], + loc: { + start: { column: 2, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [4, 6], + loc: { + start: { column: 4, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [23, 25], + loc: { + start: { column: 23, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..71627f35b04 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [1, 8], + loc: { + start: { column: 1, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + typeAnnotation: TSFunctionType { + type: "TSFunctionType", + parameters: Array [], + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [23, 32], + loc: { + start: { column: 23, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [20, 32], + loc: { + start: { column: 20, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..58d8821988a --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [2, 3], + loc: { + start: { column: 2, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [4, 6], + loc: { + start: { column: 4, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [23, 25], + loc: { + start: { column: 23, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..b45b591c63d --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,93 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [], + + range: [1, 8], + loc: { + start: { column: 1, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + typeAnnotation: TSFunctionType { + type: 'TSFunctionType', +- params: Array [], +- returnType: TSTypeAnnotation { ++ parameters: Array [], ++ typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [23, 32], + loc: { + start: { column: 23, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [20, 32], + loc: { + start: { column: 20, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..f3d317fb4b7 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/fixture.ts new file mode 100644 index 00000000000..65dcd3629bd --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/fixture.ts @@ -0,0 +1 @@ +foo satisfies bar satisfies baz; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..508caf4b944 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "bar", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "baz", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..dd0ebe5a72f --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "bar", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [18, 27], + loc: { + start: { column: 18, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "baz", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..190d8d14fd0 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/3-Babel-AST.shot @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "bar", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "baz", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..5afc144ecef --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "bar", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [18, 27], + loc: { + start: { column: 18, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "baz", + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..0d7d689095e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..b7cbaaf6bb8 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/fixture.ts new file mode 100644 index 00000000000..6ead32331fa --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/fixture.ts @@ -0,0 +1 @@ +foo ? 1 : 0 satisfies number; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..5674f78acdf --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ConditionalExpression { + type: "ConditionalExpression", + alternate: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "0", + value: 0, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [10, 28], + loc: { + start: { column: 10, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + consequent: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + test: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..579fa0c0615 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "?", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "0", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [12, 21], + loc: { + start: { column: 12, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..9c3ff77da55 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: ConditionalExpression { + type: "ConditionalExpression", + alternate: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "0", + value: 0, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [10, 28], + loc: { + start: { column: 10, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + consequent: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + test: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..d9c69f96e5e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "?", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "0", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [12, 21], + loc: { + start: { column: 12, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..a35b55978ba --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..220450772c1 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/fixture.ts new file mode 100644 index 00000000000..5c71ca2d0e6 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/fixture.ts @@ -0,0 +1 @@ +(foo ? 1 : 0) satisfies number; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..2194d921890 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ConditionalExpression { + type: "ConditionalExpression", + alternate: Literal { + type: "Literal", + raw: "0", + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + consequent: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + test: Identifier { + type: "Identifier", + name: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + + range: [1, 12], + loc: { + start: { column: 1, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..09ed0254895 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "?", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "0", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..39a9e9951ad --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ConditionalExpression { + type: "ConditionalExpression", + alternate: Literal { + type: "Literal", + raw: "0", + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + consequent: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + test: Identifier { + type: "Identifier", + name: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + + range: [1, 12], + loc: { + start: { column: 1, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..7ca2b46ad24 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "?", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "0", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..45e35dfc272 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..36442e7ebdc --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/fixture.ts new file mode 100644 index 00000000000..2ce6678d398 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/fixture.ts @@ -0,0 +1 @@ +foo satisfies boolean; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..7b7bb15a5af --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: "TSBooleanKeyword", + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..3563bcb2809 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "boolean", + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..8be9fb16653 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/3-Babel-AST.shot @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: "TSBooleanKeyword", + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..2559a7666c6 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "boolean", + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..c167cbcb46b --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..7dad93b1da3 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/fixture.ts new file mode 100644 index 00000000000..cdcca67f637 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/fixture.ts @@ -0,0 +1 @@ +foo satisfies { prop: 'value' }; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..6197262c7a0 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,104 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [16, 29], + loc: { + start: { column: 16, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + + range: [14, 31], + loc: { + start: { column: 14, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..99673ea1ecf --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..a2861a34b1f --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/3-Babel-AST.shot @@ -0,0 +1,104 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "'value'", + value: "value", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [16, 29], + loc: { + start: { column: 16, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + + range: [14, 31], + loc: { + start: { column: 14, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..34926c2bea7 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + String { + type: "String", + value: "'value'", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..8e025552275 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..bfb99b63e1c --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/fixture.ts new file mode 100644 index 00000000000..266a2ad0836 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/fixture.ts @@ -0,0 +1 @@ +foo satisfies [1, 2, 3]; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..57c80c5a805 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,115 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: "TSTupleType", + elementTypes: Array [ + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..07ece3eadee --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7201de5d38f --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/3-Babel-AST.shot @@ -0,0 +1,115 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: "TSTupleType", + elementTypes: Array [ + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "3", + value: 3, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..8a62c8d0380 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [4, 13], + loc: { + start: { column: 4, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "3", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..eb993d611eb --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..3f0aa9841e8 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/fixture.ts new file mode 100644 index 00000000000..09a4c612e30 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/fixture.ts @@ -0,0 +1 @@ +foo === 1 satisfies number; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..f80151c9032 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: BinaryExpression { + type: "BinaryExpression", + left: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + operator: "===", + right: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [20, 26], + loc: { + start: { column: 20, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [8, 26], + loc: { + start: { column: 8, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..5391022e27f --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "===", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [20, 26], + loc: { + start: { column: 20, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..60189a70358 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: BinaryExpression { + type: "BinaryExpression", + left: Identifier { + type: "Identifier", + name: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + operator: "===", + right: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: "TSNumberKeyword", + + range: [20, 26], + loc: { + start: { column: 20, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [8, 26], + loc: { + start: { column: 8, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..cac159f58dc --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "foo", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "===", + + range: [4, 7], + loc: { + start: { column: 4, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "number", + + range: [20, 26], + loc: { + start: { column: 20, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..a21b35204c9 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..6a3c807848a --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/fixture.ts new file mode 100644 index 00000000000..a93f5746e7c --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/fixture.ts @@ -0,0 +1 @@ +(foo === 1) satisfies boolean; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..4401893b67e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: BinaryExpression { + type: "BinaryExpression", + left: Identifier { + type: "Identifier", + name: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + operator: "===", + right: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: "TSBooleanKeyword", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..7034fce1187 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "===", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [12, 21], + loc: { + start: { column: 12, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "boolean", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..fb10fc5442e --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: BinaryExpression { + type: "BinaryExpression", + left: Identifier { + type: "Identifier", + name: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + operator: "===", + right: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: "TSBooleanKeyword", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..4c73b5cc818 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "===", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [12, 21], + loc: { + start: { column: 12, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "boolean", + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..28594822212 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..b6881fd10cf --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts new file mode 100644 index 00000000000..ec7b71c8e2b --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts @@ -0,0 +1 @@ +({ prop: 'string' }) satisfies { prop: string }; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..1ed0e662a99 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,128 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ObjectExpression { + type: "ObjectExpression", + properties: Array [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: "'string'", + value: "string", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [33, 37], + loc: { + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [37, 45], + loc: { + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [33, 45], + loc: { + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + ], + + range: [31, 47], + loc: { + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..99f068a424b --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + String { + type: "String", + value: "'string'", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [21, 30], + loc: { + start: { column: 21, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [33, 37], + loc: { + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..c5868aaf0d1 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,128 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ObjectExpression { + type: "ObjectExpression", + properties: Array [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: "'string'", + value: "string", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [33, 37], + loc: { + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [37, 45], + loc: { + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [33, 45], + loc: { + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + ], + + range: [31, 47], + loc: { + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..128fc9c6128 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + String { + type: "String", + value: "'string'", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [21, 30], + loc: { + start: { column: 21, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [33, 37], + loc: { + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..bad308efe92 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..92a052f3254 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts new file mode 100644 index 00000000000..b7726f7f140 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts @@ -0,0 +1 @@ +({ prop: 'string' } satisfies { prop: string }); diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..9100755681a --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,128 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ObjectExpression { + type: "ObjectExpression", + properties: Array [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: "'string'", + value: "string", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [36, 44], + loc: { + start: { column: 36, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [32, 44], + loc: { + start: { column: 32, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + + range: [30, 46], + loc: { + start: { column: 30, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [1, 46], + loc: { + start: { column: 1, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..388f2790bb0 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + String { + type: "String", + value: "'string'", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [45, 46], + loc: { + start: { column: 45, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..16adf4fa64a --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot @@ -0,0 +1,128 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: TSSatisfiesExpression { + type: "TSSatisfiesExpression", + expression: ObjectExpression { + type: "ObjectExpression", + properties: Array [ + Property { + type: "Property", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: "init", + method: false, + shorthand: false, + value: Literal { + type: "Literal", + raw: "'string'", + value: "string", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: "TSTypeLiteral", + members: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [36, 44], + loc: { + start: { column: 36, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + + range: [32, 44], + loc: { + start: { column: 32, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + + range: [30, 46], + loc: { + start: { column: 30, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [1, 46], + loc: { + start: { column: 1, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..bdca107f453 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "(", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [1, 2], + loc: { + start: { column: 1, line: 1 }, + end: { column: 2, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + String { + type: "String", + value: "'string'", + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "satisfies", + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [32, 36], + loc: { + start: { column: 32, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [38, 44], + loc: { + start: { column: 38, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [45, 46], + loc: { + start: { column: 45, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..982ccda73a2 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..c113b8be7e9 --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/spec.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/spec.ts new file mode 100644 index 00000000000..1297ade3eba --- /dev/null +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { Expression } from '../../unions/Expression'; +import type { TypeNode } from '../../unions/TypeNode'; + +export interface TSSatisfiesExpression extends BaseNode { + type: AST_NODE_TYPES.TSSatisfiesExpression; + expression: Expression; + typeAnnotation: TypeNode; +} diff --git a/packages/ast-spec/src/expression/spec.ts b/packages/ast-spec/src/expression/spec.ts index 9ed4a0cc756..f753672d472 100644 --- a/packages/ast-spec/src/expression/spec.ts +++ b/packages/ast-spec/src/expression/spec.ts @@ -23,6 +23,7 @@ export * from './TSAsExpression/spec'; export * from './TSEmptyBodyFunctionExpression/spec'; export * from './TSInstantiationExpression/spec'; export * from './TSNonNullExpression/spec'; +export * from './TSSatisfiesExpression/spec'; export * from './TSTypeAssertion/spec'; export * from './TaggedTemplateExpression/spec'; export * from './TemplateLiteral/spec'; diff --git a/packages/ast-spec/src/unions/Expression.ts b/packages/ast-spec/src/unions/Expression.ts index 36220bc0391..1c0ee899ec3 100644 --- a/packages/ast-spec/src/unions/Expression.ts +++ b/packages/ast-spec/src/unions/Expression.ts @@ -25,6 +25,7 @@ import type { ThisExpression } from '../expression/ThisExpression/spec'; import type { TSAsExpression } from '../expression/TSAsExpression/spec'; import type { TSInstantiationExpression } from '../expression/TSInstantiationExpression/spec'; import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSSatisfiesExpression } from '../expression/TSSatisfiesExpression/spec'; import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; import type { UnaryExpression } from '../expression/UnaryExpression/spec'; import type { UpdateExpression } from '../expression/UpdateExpression/spec'; @@ -72,6 +73,7 @@ export type Expression = | TSAsExpression | TSInstantiationExpression | TSNonNullExpression + | TSSatisfiesExpression | TSTypeAssertion | UnaryExpression | UpdateExpression diff --git a/packages/ast-spec/src/unions/Node.ts b/packages/ast-spec/src/unions/Node.ts index 6505270427b..3656a3d677a 100644 --- a/packages/ast-spec/src/unions/Node.ts +++ b/packages/ast-spec/src/unions/Node.ts @@ -53,6 +53,7 @@ import type { TSAsExpression } from '../expression/TSAsExpression/spec'; import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec'; import type { TSInstantiationExpression } from '../expression/TSInstantiationExpression/spec'; import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; +import type { TSSatisfiesExpression } from '../expression/TSSatisfiesExpression/spec'; import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; import type { UnaryExpression } from '../expression/UnaryExpression/spec'; import type { UpdateExpression } from '../expression/UpdateExpression/spec'; @@ -305,6 +306,7 @@ export type Node = | TSQualifiedName | TSReadonlyKeyword | TSRestType + | TSSatisfiesExpression | TSStaticKeyword | TSStringKeyword | TSSymbolKeyword diff --git a/packages/ast-spec/src/unions/TypeNode.ts b/packages/ast-spec/src/unions/TypeNode.ts index 461281cd4ce..f1859d7d347 100644 --- a/packages/ast-spec/src/unions/TypeNode.ts +++ b/packages/ast-spec/src/unions/TypeNode.ts @@ -25,6 +25,7 @@ import type { TSOptionalType } from '../type/TSOptionalType/spec'; import type { TSPrivateKeyword } from '../type/TSPrivateKeyword/spec'; import type { TSProtectedKeyword } from '../type/TSProtectedKeyword/spec'; import type { TSPublicKeyword } from '../type/TSPublicKeyword/spec'; +import type { TSQualifiedName } from '../type/TSQualifiedName/spec'; import type { TSReadonlyKeyword } from '../type/TSReadonlyKeyword/spec'; import type { TSRestType } from '../type/TSRestType/spec'; import type { TSStaticKeyword } from '../type/TSStaticKeyword/spec'; @@ -71,6 +72,7 @@ export type TypeNode = | TSPrivateKeyword | TSProtectedKeyword | TSPublicKeyword + | TSQualifiedName | TSReadonlyKeyword | TSRestType | TSStaticKeyword diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index 9d3e5d88ccc..beff8134d6e 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -24,5 +24,6 @@ Set { "declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-many/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-one/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts", } `; diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index eb09c888159..73d97608e26 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 489a40472ef..0b9495a98c3 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-internal", - "version": "5.41.0", + "version": "5.44.0", "private": true, "main": "dist/index.js", "scripts": { @@ -8,14 +8,15 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/scope-manager": "5.41.0", - "@typescript-eslint/utils": "5.41.0", + "@typescript-eslint/scope-manager": "5.44.0", + "@typescript-eslint/type-utils": "5.44.0", + "@typescript-eslint/utils": "5.44.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-internal/project.json b/packages/eslint-plugin-internal/project.json index 24256b3e4d0..803b12f5322 100644 --- a/packages/eslint-plugin-internal/project.json +++ b/packages/eslint-plugin-internal/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/eslint-plugin-internal/**/*.ts"] + } + } + } } diff --git a/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts b/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts index 6811c935bba..0c671d8432f 100644 --- a/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts +++ b/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts @@ -35,7 +35,7 @@ export default createRule({ type: 'problem', docs: { description: - "Enforces rules don't use TS API properties with known bad type definitions", + "Enforce that rules don't use TS API properties with known bad type definitions", recommended: 'error', requiresTypeChecking: true, }, diff --git a/packages/eslint-plugin-internal/src/rules/no-typescript-default-import.ts b/packages/eslint-plugin-internal/src/rules/no-typescript-default-import.ts index 34b911451e7..fd7279c3823 100644 --- a/packages/eslint-plugin-internal/src/rules/no-typescript-default-import.ts +++ b/packages/eslint-plugin-internal/src/rules/no-typescript-default-import.ts @@ -20,7 +20,7 @@ export default createRule({ type: 'problem', docs: { description: - "Enforces that packages rules don't do `import ts from 'typescript';`", + "Enforce that packages rules don't do `import ts from 'typescript';`", recommended: 'error', }, fixable: 'code', diff --git a/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts b/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts index 022fd98b7ca..28f7439472b 100644 --- a/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts +++ b/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts @@ -15,7 +15,7 @@ export default createRule({ meta: { type: 'problem', docs: { - description: `Enforces that eslint-plugin rules don't require anything from ${TSESTREE_NAME} or ${TYPES_NAME}`, + description: `Enforce that eslint-plugin rules don't require anything from ${TSESTREE_NAME} or ${TYPES_NAME}`, recommended: 'error', }, fixable: 'code', diff --git a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index 15386398048..f86d4946836 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -1,5 +1,6 @@ +import { getContextualType } from '@typescript-eslint/type-utils'; import type { TSESTree } from '@typescript-eslint/utils'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils'; import { format, resolveConfig } from 'prettier'; import { createRule } from '../util'; @@ -106,8 +107,9 @@ export default createRule({ meta: { type: 'problem', docs: { - description: `Enforces that eslint-plugin test snippets are correctly formatted`, + description: `Enforce that eslint-plugin test snippets are correctly formatted`, recommended: 'error', + requiresTypeChecking: true, }, fixable: 'code', schema: [ @@ -146,6 +148,11 @@ export default createRule({ ], create(context, [{ formatWithPrettier }]) { const sourceCode = context.getSourceCode(); + const { program, esTreeNodeToTSNodeMap } = + ESLintUtils.getParserServices(context); + const checker = program.getTypeChecker(); + + const checkedObjects = new Set(); function prettierFormat( code: string, @@ -448,6 +455,12 @@ export default createRule({ test: TSESTree.ObjectExpression, isErrorTest = true, ): void { + if (checkedObjects.has(test)) { + return; + } + + checkedObjects.add(test); + for (const prop of test.properties) { if ( prop.type !== AST_NODE_TYPES.Property || @@ -478,33 +491,99 @@ export default createRule({ } } - const invalidTestsSelectorPath = [ - AST_NODE_TYPES.CallExpression, - AST_NODE_TYPES.ObjectExpression, - 'Property[key.name = "invalid"]', - AST_NODE_TYPES.ArrayExpression, - AST_NODE_TYPES.ObjectExpression, - ]; - return { // valid 'CallExpression > ObjectExpression > Property[key.name = "valid"] > ArrayExpression': checkValidTest, // invalid - errors - [invalidTestsSelectorPath.join(' > ')]: checkInvalidTest, - // invalid - suggestions [[ - ...invalidTestsSelectorPath, - 'Property[key.name = "errors"]', - AST_NODE_TYPES.ArrayExpression, + AST_NODE_TYPES.CallExpression, AST_NODE_TYPES.ObjectExpression, - 'Property[key.name = "suggestions"]', + 'Property[key.name = "invalid"]', AST_NODE_TYPES.ArrayExpression, AST_NODE_TYPES.ObjectExpression, ].join(' > ')]: checkInvalidTest, // special case for our batchedSingleLineTests utility 'CallExpression[callee.name = "batchedSingleLineTests"] > ObjectExpression': checkInvalidTest, + + /** + * generic, type-aware handling for any old object + * this is a fallback to handle random variables people declare or object + * literals that are passed via array maps, etc + */ + ObjectExpression(node): void { + if (checkedObjects.has(node)) { + return; + } + + const type = getContextualType( + checker, + esTreeNodeToTSNodeMap.get(node), + ); + if (!type) { + return; + } + + const typeString = checker.typeToString(type); + if (/^RunTests\b/.test(typeString)) { + checkedObjects.add(node); + + for (const prop of node.properties) { + if ( + prop.type === AST_NODE_TYPES.SpreadElement || + prop.computed || + prop.key.type !== AST_NODE_TYPES.Identifier || + prop.value.type !== AST_NODE_TYPES.ArrayExpression + ) { + continue; + } + + switch (prop.key.name) { + case 'valid': + checkValidTest(prop.value); + break; + + case 'invalid': + for (const element of prop.value.elements) { + if (element.type === AST_NODE_TYPES.ObjectExpression) { + checkInvalidTest(element); + } + } + break; + } + } + return; + } + + if (/^ValidTestCase\b/.test(typeString)) { + checkInvalidTest(node); + return; + } + + if (/^InvalidTestCase\b/.test(typeString)) { + checkInvalidTest(node); + for (const testProp of node.properties) { + if ( + testProp.type === AST_NODE_TYPES.SpreadElement || + testProp.computed || + testProp.key.type !== AST_NODE_TYPES.Identifier || + testProp.key.name !== 'errors' || + testProp.value.type !== AST_NODE_TYPES.ArrayExpression + ) { + continue; + } + + for (const errorElement of testProp.value.elements) { + if (errorElement.type !== AST_NODE_TYPES.ObjectExpression) { + continue; + } + + checkInvalidTest(errorElement); + } + } + } + }, }; }, }); diff --git a/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts b/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts index 4b74cbe09b9..4099e2f02be 100755 --- a/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts +++ b/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts @@ -15,7 +15,7 @@ export default createRule({ docs: { recommended: 'error', description: - 'Ensures consistent usage of `AST_NODE_TYPES`, `AST_TOKEN_TYPES` and `DefinitionType` enums.', + 'Enforce consistent usage of `AST_NODE_TYPES`, `AST_TOKEN_TYPES` and `DefinitionType` enums', }, messages: { preferEnum: 'Prefer {{ enumName }}.{{ literal }} over raw literal', diff --git a/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts b/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts index 81be2118f6c..f5745996d38 100644 --- a/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts @@ -1,9 +1,11 @@ import rule from '../../src/rules/plugin-test-formatting'; -import { RuleTester } from '../RuleTester'; +import { getFixturesRootDir, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { + project: './tsconfig.json', + tsconfigRootDir: getFixturesRootDir(), sourceType: 'module', }, }); @@ -132,6 +134,44 @@ ${CODE_INDENT}const a = 1; ${CODE_INDENT}const b = 1; ${PARENT_INDENT}\``, + + // random, unannotated variables aren't checked + ` +const test1 = { + code: 'const badlyFormatted = "code"', +}; +const test2 = { + valid: [ + 'const badlyFormatted = "code"', + { + code: 'const badlyFormatted = "code"', + }, + ], + invalid: [ + { + code: 'const badlyFormatted = "code"', + errors: [], + }, + ], +}; + `, + + // TODO - figure out how to handle this pattern + ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test = [ + { + code: 'const badlyFormatted = "code1"', + }, + { + code: 'const badlyFormatted = "code2"', + }, +].map>(test => ({ + code: test.code, + errors: [], +})); + `, ], invalid: [ // Literal @@ -506,5 +546,174 @@ foo }, ], }, + + // annotated variables are checked + { + code: ` +const test: RunTests = { + valid: [ + 'const badlyFormatted = "code"', + { + code: 'const badlyFormatted = "code"', + }, + ], + invalid: [ + { + code: 'const badlyFormatted = "code"', + errors: [], + }, + ], +}; + `, + output: ` +const test: RunTests = { + valid: [ + "const badlyFormatted = 'code';", + { + code: "const badlyFormatted = 'code';", + }, + ], + invalid: [ + { + code: "const badlyFormatted = 'code';", + errors: [], + }, + ], +}; + `, + errors: [ + { + messageId: 'invalidFormatting', + }, + { + messageId: 'invalidFormatting', + }, + { + messageId: 'invalidFormattingErrorTest', + }, + ], + }, + { + code: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.RunTests<'', []> = { + valid: [ + 'const badlyFormatted = "code"', + { + code: 'const badlyFormatted = "code"', + }, + ], + invalid: [ + { + code: 'const badlyFormatted = "code"', + errors: [], + }, + ], +}; + `, + output: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.RunTests<'', []> = { + valid: [ + "const badlyFormatted = 'code';", + { + code: "const badlyFormatted = 'code';", + }, + ], + invalid: [ + { + code: "const badlyFormatted = 'code';", + errors: [], + }, + ], +}; + `, + errors: [ + { + messageId: 'invalidFormatting', + }, + { + messageId: 'invalidFormatting', + }, + { + messageId: 'invalidFormattingErrorTest', + }, + ], + }, + { + code: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.ValidTestCase<[]> = { + code: 'const badlyFormatted = "code"', +}; + `, + output: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.ValidTestCase<[]> = { + code: "const badlyFormatted = 'code';", +}; + `, + errors: [ + { + messageId: 'invalidFormattingErrorTest', + }, + ], + }, + { + code: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.InvalidTestCase<'', []> = { + code: 'const badlyFormatted = "code1"', + errors: [ + { + code: 'const badlyFormatted = "code2"', + // shouldn't get fixed as per rule ignoring output + output: 'const badlyFormatted = "code3"', + suggestions: [ + { + messageId: '', + // shouldn't get fixed as per rule ignoring output + output: 'const badlyFormatted = "code4"', + }, + ], + }, + ], +}; + `, + output: ` +import { TSESLint } from '@typescript-eslint/utils'; + +const test: TSESLint.InvalidTestCase<'', []> = { + code: "const badlyFormatted = 'code1';", + errors: [ + { + code: "const badlyFormatted = 'code2';", + // shouldn't get fixed as per rule ignoring output + output: 'const badlyFormatted = "code3"', + suggestions: [ + { + messageId: '', + // shouldn't get fixed as per rule ignoring output + output: 'const badlyFormatted = "code4"', + }, + ], + }, + ], +}; + `, + errors: [ + { + messageId: 'invalidFormattingErrorTest', + }, + { + messageId: 'invalidFormattingErrorTest', + }, + ], + }, ], }); diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index cf95068ce8e..98f50504104 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 9774098ff6f..494b4fc4292 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "5.41.0", + "version": "5.44.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -33,12 +33,12 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.41.0", + "@typescript-eslint/utils": "5.44.0", "lodash": "^4.17.21" }, "peerDependencies": { @@ -48,6 +48,6 @@ }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "5.41.0" + "@typescript-eslint/parser": "5.44.0" } } diff --git a/packages/eslint-plugin-tslint/project.json b/packages/eslint-plugin-tslint/project.json index 24256b3e4d0..6f6c19ca7c5 100644 --- a/packages/eslint-plugin-tslint/project.json +++ b/packages/eslint-plugin-tslint/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/eslint-plugin-tslint/**/*.ts"] + } + } + } } diff --git a/packages/eslint-plugin-tslint/src/rules/config.ts b/packages/eslint-plugin-tslint/src/rules/config.ts index 5f20bcd4430..9fcfa844da1 100644 --- a/packages/eslint-plugin-tslint/src/rules/config.ts +++ b/packages/eslint-plugin-tslint/src/rules/config.ts @@ -64,7 +64,7 @@ export default createRule({ meta: { docs: { description: - 'Wraps a TSLint configuration and lints the whole source using TSLint', + 'Wraps a TSLint configuration and lints the whole source using TSLint', // eslint-disable-line eslint-plugin/require-meta-docs-description recommended: false, }, fixable: 'code', diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 7b5a3d1fbc6..5346de33f1c 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,51 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +### Bug Fixes + +- **eslint-plugin:** [no-empty-interface] disable autofix for declaration merging with class ([#5920](https://github.com/typescript-eslint/typescript-eslint/issues/5920)) ([a4f85b8](https://github.com/typescript-eslint/typescript-eslint/commit/a4f85b8cfe38ba8ea2a2ac4a56d9b11a81a8a15a)) +- **eslint-plugin:** [no-unnecessary-condition] handle index signature type ([#5912](https://github.com/typescript-eslint/typescript-eslint/issues/5912)) ([5baad08](https://github.com/typescript-eslint/typescript-eslint/commit/5baad0893f9a90633d57fffac69af7523bd1501e)) +- **eslint-plugin:** [prefer-optional-chain] handle binary expressions in negated or ([#5992](https://github.com/typescript-eslint/typescript-eslint/issues/5992)) ([2778ff0](https://github.com/typescript-eslint/typescript-eslint/commit/2778ff0c3db011148be93ed3bea5ce07af3c81ef)) +- **typescript-estree:** don't consider a cached program unless it's specified in the current `parserOptions.project` config ([#5999](https://github.com/typescript-eslint/typescript-eslint/issues/5999)) ([530e0e6](https://github.com/typescript-eslint/typescript-eslint/commit/530e0e618cdf4bb956149bf8a8484848e1b9a1f5)) + +### Features + +- **eslint-plugin:** [adjacent-overload-signatures] check BlockStatement nodes ([#5998](https://github.com/typescript-eslint/typescript-eslint/issues/5998)) ([97d3e56](https://github.com/typescript-eslint/typescript-eslint/commit/97d3e56709ee19fdec39fd8b99d080db90b306e9)) +- **eslint-plugin:** [keyword-spacing] Support spacing in import-type syntax ([#5977](https://github.com/typescript-eslint/typescript-eslint/issues/5977)) ([6a735e1](https://github.com/typescript-eslint/typescript-eslint/commit/6a735e142ef67f3af6497f922cf83706867eb6b7)) + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +### Bug Fixes + +- **eslint-plugin:** [no-shadow] handle false positives on generics and parameters ([#5902](https://github.com/typescript-eslint/typescript-eslint/issues/5902)) ([769e8c8](https://github.com/typescript-eslint/typescript-eslint/commit/769e8c8b9a51cd3448e47d13c7b0dab0468ee23c)) +- **eslint-plugin:** [promise-function-async] handle keyword token ([#5907](https://github.com/typescript-eslint/typescript-eslint/issues/5907)) ([f25a94f](https://github.com/typescript-eslint/typescript-eslint/commit/f25a94fa75e497a6b9ec29a008bcc89818eed60d)) + +### Features + +- **eslint-plugin:** [consistent-type-imports] support fixing to inline types ([#5050](https://github.com/typescript-eslint/typescript-eslint/issues/5050)) ([75dcdf1](https://github.com/typescript-eslint/typescript-eslint/commit/75dcdf164d206c5530ba7cc095c4599ec90abe35)) +- **eslint-plugin:** [naming-convention] add support for "override" and "async" modifiers ([#5310](https://github.com/typescript-eslint/typescript-eslint/issues/5310)) ([#5610](https://github.com/typescript-eslint/typescript-eslint/issues/5610)) ([c759da1](https://github.com/typescript-eslint/typescript-eslint/commit/c759da169390ba490eee9ef773cc9edc88a32817)) +- **eslint-plugin:** [prefer-optional-chain] support suggesting `!foo || !foo.bar` as a valid match for the rule ([#5594](https://github.com/typescript-eslint/typescript-eslint/issues/5594)) ([923d486](https://github.com/typescript-eslint/typescript-eslint/commit/923d486c8c9c9096deac425e7a6cb0b6457eacbd)) + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +### Bug Fixes + +- **eslint-plugin:** isTypeReadonly stack overflow ([#5875](https://github.com/typescript-eslint/typescript-eslint/issues/5875)) ([#5876](https://github.com/typescript-eslint/typescript-eslint/issues/5876)) ([2d9a33c](https://github.com/typescript-eslint/typescript-eslint/commit/2d9a33cfb2db53d76246a59253daaf2abb19ee57)) + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +### Bug Fixes + +- **ast-spec:** add TSQualifiedName to TypeNode union ([#5906](https://github.com/typescript-eslint/typescript-eslint/issues/5906)) ([5c316c1](https://github.com/typescript-eslint/typescript-eslint/commit/5c316c12f09d58aee6ee634a8055533f361f1589)) +- **eslint-plugin:** [no-extra-parens] handle type assertion in extends clause ([#5901](https://github.com/typescript-eslint/typescript-eslint/issues/5901)) ([8ed7219](https://github.com/typescript-eslint/typescript-eslint/commit/8ed72192c274249d26628fb125796e71318b857a)) + +### Features + +- **eslint-plugin:** [member-ordering] add natural sort order ([#5662](https://github.com/typescript-eslint/typescript-eslint/issues/5662)) ([1eaae09](https://github.com/typescript-eslint/typescript-eslint/commit/1eaae09ecca359f366b94f6a04665403f48b05c7)) +- **eslint-plugin:** [no-invalid-void-type] better report message for void used as a constituent inside a function return type ([#5274](https://github.com/typescript-eslint/typescript-eslint/issues/5274)) ([d806bda](https://github.com/typescript-eslint/typescript-eslint/commit/d806bda82343712a24e3c78b9b34d4345dd1de3b)) + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) ### Bug Fixes diff --git a/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md b/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md index 529d0719655..d8d805df692 100644 --- a/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md +++ b/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md @@ -6,7 +6,7 @@ description: 'Require or disallow the `Record` type.' > > See **https://typescript-eslint.io/rules/consistent-indexed-object-style** for documentation. -TypeScript supports defining object show keys can be flexible using an index signature. TypeScript also has a builtin type named `Record` to create an empty object defining only an index signature. For example, the following types are equal: +TypeScript supports defining arbitrary object keys using an index signature. TypeScript also has a builtin type named `Record` to create an empty object defining only an index signature. For example, the following types are equal: ```ts interface Foo { diff --git a/packages/eslint-plugin/docs/rules/consistent-type-imports.md b/packages/eslint-plugin/docs/rules/consistent-type-imports.md index 6e6912d34cf..4ea1f755994 100644 --- a/packages/eslint-plugin/docs/rules/consistent-type-imports.md +++ b/packages/eslint-plugin/docs/rules/consistent-type-imports.md @@ -15,7 +15,7 @@ This allows transpilers to drop imports without knowing the types of the depende This option defines the expected import kind for type-only imports. Valid values for `prefer` are: -- `type-imports` will enforce that you always use `import type Foo from '...'` except referenced by metadata of decorators. It is default. +- `type-imports` will enforce that you always use `import type Foo from '...'` except referenced by metadata of decorators. It is the default. - `no-type-imports` will enforce that you always use `import Foo from '...'`. Examples of **correct** code with `{prefer: 'type-imports'}`, and **incorrect** code with `{prefer: 'no-type-imports'}`. @@ -36,6 +36,44 @@ type T = Foo; const x: Bar = 1; ``` +### `fixStyle` + +This option defines the expected type modifier to be added when an import is detected as used only in the type position. Valid values for `fixStyle` are: + +- `separate-type-imports` will add the type keyword after the import keyword `import type { A } from '...'`. It is the default. +- `inline-type-imports` will inline the type keyword `import { type A } from '...'` and is only available in TypeScript 4.5 and onwards. See [documentation here](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#type-modifiers-on-import-names 'TypeScript 4.5 documentation on type modifiers and import names'). + + + +#### โŒ Incorrect + +```ts +import { Foo } from 'Foo'; +import Bar from 'Bar'; +type T = Foo; +const x: Bar = 1; +``` + +#### โœ… With `separate-type-imports` + +```ts +import type { Foo } from 'Foo'; +import type Bar from 'Bar'; +type T = Foo; +const x: Bar = 1; +``` + +#### โœ… With `inline-type-imports` + +```ts +import { type Foo } from 'Foo'; +import type Bar from 'Bar'; +type T = Foo; +const x: Bar = 1; +``` + + + ### `disallowTypeAnnotations` If `true`, type imports in type annotations (`import()`) are not allowed. @@ -48,6 +86,12 @@ type T = import('Foo').Foo; const x: import('Bar') = 1; ``` +## Usage with `emitDecoratorMetadata` + +The `emitDecoratorMetadata` compiler option changes the code the TypeScript emits. In short - it causes TypeScript to create references to value imports when they are used in a type-only location. If you are using `emitDecoratorMetadata` then our tooling will require additional information in order for the rule to work correctly. + +If you are using [type-aware linting](https://typescript-eslint.io/docs/linting/typed-linting), then you just need to ensure that the `tsconfig.json` you've configured for `parserOptions.project` has `emitDecoratorMetadata` turned on. Otherwise you can explicitly tell our tooling to analyze your code as if the compiler option was turned on [by setting `parserOptions.emitDecoratorMetadata` to `true`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/README.md#parseroptionsemitdecoratormetadata). + ## When Not To Use It - If you specifically want to use both import kinds for stylistic reasons, you can disable this rule. diff --git a/packages/eslint-plugin/docs/rules/naming-convention.md b/packages/eslint-plugin/docs/rules/naming-convention.md index 50bd1751518..f5922ba3653 100644 --- a/packages/eslint-plugin/docs/rules/naming-convention.md +++ b/packages/eslint-plugin/docs/rules/naming-convention.md @@ -149,7 +149,7 @@ The `leadingUnderscore` / `trailingUnderscore` options control whether leading/t The `prefix` / `suffix` options control which prefix/suffix strings must exist for the identifier. Accepts an array of strings. -If these are provided, the identifier must start with one of the provided values. For example, if you provide `{ prefix: ['IFace', 'Class', 'Type'] }`, then the following names are valid: `IFaceFoo`, `ClassBar`, `TypeBaz`, but the name `Bang` is not valid, as it contains none of the prefixes. +If these are provided, the identifier must start with one of the provided values. For example, if you provide `{ prefix: ['Class', 'IFace', 'Type'] }`, then the following names are valid: `ClassBar`, `IFaceFoo`, `TypeBaz`, but the name `Bang` is not valid, as it contains none of the prefixes. **Note:** As [documented above](#format-options), the prefix is trimmed before format is validated, therefore PascalCase must be used to allow variables such as `isEnabled` using the prefix `is`. @@ -157,11 +157,11 @@ If these are provided, the identifier must start with one of the provided values - `selector` allows you to specify what types of identifiers to target. - Accepts one or array of selectors to define an option block that applies to one or multiple selectors. - - For example, if you provide `{ selector: ['variable', 'function'] }`, then it will apply the same option to variable and function nodes. + - For example, if you provide `{ selector: ['function', 'variable'] }`, then it will apply the same option to variable and function nodes. - See [Allowed Selectors, Modifiers and Types](#allowed-selectors-modifiers-and-types) below for the complete list of allowed selectors. -- `modifiers` allows you to specify which modifiers to granularly apply to, such as the accessibility (`private`/`public`/`protected`), or if the thing is `static`, etc. +- `modifiers` allows you to specify which modifiers to granularly apply to, such as the accessibility (`private`/`protected`/`public`), or if the thing is `static`, etc. - The name must match _all_ of the modifiers. - - For example, if you provide `{ modifiers: ['private', 'static', 'readonly'] }`, then it will only match something that is `private static readonly`, and something that is just `private` will not match. + - For example, if you provide `{ modifiers: ['private','readonly','static'] }`, then it will only match something that is `private static readonly`, and something that is just `private` will not match. - The following `modifiers` are allowed: - `const` - matches a variable declared as being `const` (`const x = 1`). - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, z = 2}`). @@ -171,8 +171,9 @@ If these are provided, the identifier must start with one of the provided values - `unused` - matches anything that is not used. - `requiresQuotes` - matches any name that requires quotes as it is not a valid identifier (i.e. has a space, a dash, etc in it). - `public` - matches any member that is either explicitly declared as `public`, or has no visibility modifier (i.e. implicitly public). - - `readonly`, `static`, `abstract`, `protected`, `private` - matches any member explicitly declared with the given modifier. -- `types` allows you to specify which types to match. This option supports simple, primitive types only (`boolean`, `string`, `number`, `array`, `function`). + - `abstract`,`override`,`private`,`protected`,`readonly`,`static` - matches any member explicitly declared with the given modifier. + - `async` - matches any method, function, or function variable which is async via the `async` keyword (e.g. does not match functions that return promises without using `async` keyword) +- `types` allows you to specify which types to match. This option supports simple, primitive types only (`array`,`boolean`,`function`,`number`,`string`). - The name must match _one_ of the types. - **_NOTE - Using this option will require that you lint with type information._** - For example, this lets you do things like enforce that `boolean` variables are prefixed with a verb. @@ -193,39 +194,39 @@ There are two types of selectors, individual selectors, and grouped selectors. Individual Selectors match specific, well-defined sets. There is no overlap between each of the individual selectors. -- `variable` - matches any `var` / `let` / `const` variable name. - - Allowed `modifiers`: `const`, `destructured`, `global`, `exported`, `unused`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. +- `variable` - matches any `let` / `const` / `var` variable name. + - Allowed `modifiers`: `async`, `const`, `destructured`, `exported`, `global`, `unused`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `function` - matches any named function declaration or named function expression. - - Allowed `modifiers`: `global`, `exported`, `unused`. + - Allowed `modifiers`: `async`, `exported`, `global`, `unused`. - Allowed `types`: none. - `parameter` - matches any function parameter. Does not match parameter properties. - Allowed `modifiers`: `destructured`, `unused`. - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. - `classProperty` - matches any class property. Does not match properties that have direct function expression or arrow function expression values. - - Allowed `modifiers`: `abstract`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `objectLiteralProperty` - matches any object literal property. Does not match properties that have direct function expression or arrow function expression values. - Allowed `modifiers`: `public`, `requiresQuotes`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `typeProperty` - matches any object type property. Does not match properties that have direct function expression or arrow function expression values. - Allowed `modifiers`: `public`, `readonly`, `requiresQuotes`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `parameterProperty` - matches any parameter property. - Allowed `modifiers`: `private`, `protected`, `public`, `readonly`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `classMethod` - matches any class method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. - - Allowed `modifiers`: `abstract`, `private`, `protected`, `public`, `requiresQuotes`, `static`. + - Allowed `modifiers`: `abstract`, `async`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`. - Allowed `types`: none. - `objectLiteralMethod` - matches any object literal method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. - - Allowed `modifiers`: `public`, `requiresQuotes`. + - Allowed `modifiers`: `async`, `public`, `requiresQuotes`. - Allowed `types`: none. - `typeMethod` - matches any object type method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. - Allowed `modifiers`: `public`, `requiresQuotes`. - Allowed `types`: none. - `accessor` - matches any accessor. - - Allowed `modifiers`: `abstract`, `private`, `protected`, `public`, `requiresQuotes`, `static`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `enumMember` - matches any enum member. - Allowed `modifiers`: `requiresQuotes`. - Allowed `types`: none. @@ -252,20 +253,20 @@ Group Selectors are provided for convenience, and essentially bundle up sets of - `default` - matches everything. - Allowed `modifiers`: all modifiers. - Allowed `types`: none. -- `variableLike` - matches the same as `variable`, `function` and `parameter`. - - Allowed `modifiers`: `unused`. +- `variableLike` - matches the same as `function`, `parameter` and `variable`. + - Allowed `modifiers`: `async`, `unused`. - Allowed `types`: none. -- `memberLike` - matches the same as `property`, `parameterProperty`, `method`, `accessor`, `enumMember`. - - Allowed `modifiers`: `private`, `protected`, `public`, `static`, `readonly`, `abstract`, `requiresQuotes`. +- `memberLike` - matches the same as `accessor`, `enumMember`, `method`, `parameterProperty`, `property`. + - Allowed `modifiers`: `abstract`, `async`, `override`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - Allowed `types`: none. -- `typeLike` - matches the same as `class`, `interface`, `typeAlias`, `enum`, `typeParameter`. +- `typeLike` - matches the same as `class`, `enum`, `interface`, `typeAlias`, `typeParameter`. - Allowed `modifiers`: `abstract`, `unused`. - Allowed `types`: none. - `property` - matches the same as `classProperty`, `objectLiteralProperty`, `typeProperty`. - - Allowed `modifiers`: `private`, `protected`, `public`, `static`, `readonly`, `abstract`, `requiresQuotes`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. + - Allowed `modifiers`: `abstract`, `async`, `override`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `method` - matches the same as `classMethod`, `objectLiteralMethod`, `typeMethod`. - - Allowed `modifiers`: `private`, `protected`, `public`, `static`, `readonly`, `abstract`, `requiresQuotes`. + - Allowed `modifiers`: `abstract`, `async`, `override`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - Allowed `types`: none. ## FAQ diff --git a/packages/eslint-plugin/docs/rules/no-shadow.md b/packages/eslint-plugin/docs/rules/no-shadow.md index 3adb286e317..1dfadba55aa 100644 --- a/packages/eslint-plugin/docs/rules/no-shadow.md +++ b/packages/eslint-plugin/docs/rules/no-shadow.md @@ -78,3 +78,24 @@ Examples of **correct** code with `{ ignoreFunctionTypeParameterNameValueShadow: const test = 1; type Func = (test: string) => typeof test; ``` + +## FAQ + +### Why does the rule report on enum members that share the same name as a variable in a parent scope? + +Reporting on this case isn't a bug - it is completely intentional and correct reporting! The rule reports due to a relatively unknown feature of enums - enum members create a variable within the enum scope so that they can be referenced within the enum without a qualifier. + +To illustrate this with an example: + +```ts +const A = 2; +enum Test { + A = 1, + B = A, +} + +console.log(Test.B); +// what should be logged? +``` + +Naively looking at the above code, it might look like the log should output `2`, because the outer variable `A`'s value is `2` - however, the code instead outputs `1`, which is the value of `Test.A`. This is because the unqualified code `B = A` is equivalent to the fully-qualified code `B = Test.A`. Due to this behavior, the enum member has **shadowed** the outer variable declaration. diff --git a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md index ef05bdc8681..5aa780f8002 100644 --- a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +++ b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md @@ -14,6 +14,10 @@ This rule reports when you can safely replace: - An `||` operator with `??` - An `||=` operator with `??=` +:::caution +This rule will not work as expected if [`strictNullChecks`](https://www.typescriptlang.org/tsconfig#strictNullChecks) is not enabled. +::: + ## Options ### `ignoreTernaryTests` diff --git a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md index cff46dfdf49..4a9ada8b08f 100644 --- a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md +++ b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md @@ -1,5 +1,5 @@ --- -description: 'Enforce using concise optional chain expressions instead of chained logical ands.' +description: 'Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects.' --- > ๐Ÿ›‘ This file is source code, not the primary documentation location! ๐Ÿ›‘ @@ -23,9 +23,15 @@ foo && foo.a && foo.a.b && foo.a.b.c; foo && foo['a'] && foo['a'].b && foo['a'].b.c; foo && foo.a && foo.a.b && foo.a.b.method && foo.a.b.method(); +// With empty objects (((foo || {}).a || {}).b || {}).c; (((foo || {})['a'] || {}).b || {}).c; +// With negated `or`s +!foo || !foo.bar; +!foo || !foo[bar]; +!foo || !foo.bar || !foo.bar.baz || !foo.bar.baz(); + // this rule also supports converting chained strict nullish checks: foo && foo.a != null && @@ -43,6 +49,10 @@ foo?.['a']?.b?.c; foo?.a?.b?.method?.(); foo?.a?.b?.c?.d?.e; + +!foo?.bar; +!foo?.[bar]; +!foo?.bar?.baz?.(); ``` diff --git a/packages/eslint-plugin/docs/rules/sort-type-constituents.md b/packages/eslint-plugin/docs/rules/sort-type-constituents.md new file mode 100644 index 00000000000..264ef2b52df --- /dev/null +++ b/packages/eslint-plugin/docs/rules/sort-type-constituents.md @@ -0,0 +1,101 @@ +--- +description: 'Enforce constituents of a type union/intersection to be sorted alphabetically.' +--- + +> ๐Ÿ›‘ This file is source code, not the primary documentation location! ๐Ÿ›‘ +> +> See **https://typescript-eslint.io/rules/sort-type-constituents** for documentation. + +Sorting union (`|`) and intersection (`&`) types can help: + +- keep your codebase standardized +- find repeated types +- reduce diff churn + +This rule reports on any types that aren't sorted alphabetically. + +> Types are sorted case-insensitively and treating numbers like a human would, falling back to character code sorting in case of ties. + +## Examples + + + +### โŒ Incorrect + +```ts +type T1 = B | A; + +type T2 = { b: string } & { a: string }; + +type T3 = [1, 2, 4] & [1, 2, 3]; + +type T4 = + | [1, 2, 4] + | [1, 2, 3] + | { b: string } + | { a: string } + | (() => void) + | (() => string) + | 'b' + | 'a' + | 'b' + | 'a' + | readonly string[] + | readonly number[] + | string[] + | number[] + | B + | A + | string + | any; +``` + +### โœ… Correct + +```ts +type T1 = A | B; + +type T2 = { a: string } & { b: string }; + +type T3 = [1, 2, 3] & [1, 2, 4]; + +type T4 = + | any + | string + | A + | B + | number[] + | string[] + | readonly number[] + | readonly string[] + | 'a' + | 'b' + | 'a' + | 'b' + | (() => string) + | (() => void) + | { a: string } + | { b: string } + | [1, 2, 3] + | [1, 2, 4]; +``` + +## Options + +### `groupOrder` + +Each constituent of the type is placed into a group, and then the rule sorts alphabetically within each group. +The ordering of groups is determined by this option. + +- `conditional` - Conditional types (`A extends B ? C : D`) +- `function` - Function and constructor types (`() => void`, `new () => type`) +- `import` - Import types (`import('path')`) +- `intersection` - Intersection types (`A & B`) +- `keyword` - Keyword types (`any`, `string`, etc) +- `literal` - Literal types (`1`, `'b'`, `true`, etc) +- `named` - Named types (`A`, `A['prop']`, `B[]`, `Array`) +- `object` - Object types (`{ a: string }`, `{ [key: string]: number }`) +- `operator` - Operator types (`keyof A`, `typeof B`, `readonly C[]`) +- `tuple` - Tuple types (`[A, B, C]`) +- `union` - Union types (`A | B`) +- `nullish` - `null` and `undefined` diff --git a/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md b/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md index 2a47547219b..edaa195df6b 100644 --- a/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +++ b/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md @@ -6,6 +6,11 @@ description: 'Enforce members of a type union/intersection to be sorted alphabet > > See **https://typescript-eslint.io/rules/sort-type-union-intersection-members** for documentation. +:::danger Deprecated + +This rule has been renamed to [`sort-type-constituents`](./sort-type-constituents.md). +::: + Sorting union (`|`) and intersection (`&`) types can help: - keep your codebase standardized diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 409b98a5121..936313604e1 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "5.41.0", + "version": "5.44.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -37,16 +37,16 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate:configs": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-configs.ts", - "generate:rules-lists": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-rules-lists.ts", - "lint": "eslint . --ignore-path ../../.eslintignore", + "generate:breaking-changes": "../../node_modules/.bin/ts-node tools/generate-breaking-changes.ts", + "generate:configs": "../../node_modules/.bin/ts-node tools/generate-configs.ts", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.41.0", - "@typescript-eslint/type-utils": "5.41.0", - "@typescript-eslint/utils": "5.41.0", + "@typescript-eslint/scope-manager": "5.44.0", + "@typescript-eslint/type-utils": "5.44.0", + "@typescript-eslint/utils": "5.44.0", "debug": "^4.3.4", "ignore": "^5.2.0", "natural-compare-lite": "^1.4.0", @@ -61,7 +61,9 @@ "@types/natural-compare-lite": "^1.4.0", "@types/prettier": "*", "chalk": "^5.0.1", + "cross-fetch": "^3.1.5", "json-schema": "*", + "markdown-table": "^3.0.2", "marked": "^4.0.15", "prettier": "*", "title-case": "^3.0.3", diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json index 24256b3e4d0..d3a8c23a138 100644 --- a/packages/eslint-plugin/project.json +++ b/packages/eslint-plugin/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/eslint-plugin/**/*.ts"] + } + } + } } diff --git a/packages/eslint-plugin/src/configs/all.ts b/packages/eslint-plugin/src/configs/all.ts index 1f6530ead3e..20ea892f581 100644 --- a/packages/eslint-plugin/src/configs/all.ts +++ b/packages/eslint-plugin/src/configs/all.ts @@ -154,7 +154,7 @@ export = { '@typescript-eslint/return-await': 'error', semi: 'off', '@typescript-eslint/semi': 'error', - '@typescript-eslint/sort-type-union-intersection-members': 'error', + '@typescript-eslint/sort-type-constituents': 'error', 'space-before-blocks': 'off', '@typescript-eslint/space-before-blocks': 'error', 'space-before-function-paren': 'off', diff --git a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts index 81877d08b39..5f5ddfc0aad 100644 --- a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts +++ b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts @@ -8,7 +8,8 @@ type RuleNode = | TSESTree.Program | TSESTree.TSModuleBlock | TSESTree.TSTypeLiteral - | TSESTree.TSInterfaceBody; + | TSESTree.TSInterfaceBody + | TSESTree.BlockStatement; type Member = | TSESTree.ClassElement | TSESTree.ProgramStatement @@ -121,6 +122,7 @@ export default util.createRule({ case AST_NODE_TYPES.Program: case AST_NODE_TYPES.TSModuleBlock: case AST_NODE_TYPES.TSInterfaceBody: + case AST_NODE_TYPES.BlockStatement: return node.body; case AST_NODE_TYPES.TSTypeLiteral: @@ -172,6 +174,7 @@ export default util.createRule({ TSModuleBlock: checkBodyForOverloadMethods, TSTypeLiteral: checkBodyForOverloadMethods, TSInterfaceBody: checkBodyForOverloadMethods, + BlockStatement: checkBodyForOverloadMethods, }; }, }); diff --git a/packages/eslint-plugin/src/rules/consistent-type-imports.ts b/packages/eslint-plugin/src/rules/consistent-type-imports.ts index 1817018fe7b..a812116f2f8 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-imports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-imports.ts @@ -4,11 +4,13 @@ import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; type Prefer = 'type-imports' | 'no-type-imports'; +type FixStyle = 'separate-type-imports' | 'inline-type-imports'; type Options = [ { prefer?: Prefer; disallowTypeAnnotations?: boolean; + fixStyle?: FixStyle; }, ]; @@ -19,6 +21,8 @@ interface SourceImports { typeOnlyNamedImport: TSESTree.ImportDeclaration | null; // ImportDeclaration for value-only import only with named imports. valueOnlyNamedImport: TSESTree.ImportDeclaration | null; + // ImportDeclaration for value-only import only with default imports and/or named imports. + valueImport: TSESTree.ImportDeclaration | null; } interface ReportValueImport { node: TSESTree.ImportDeclaration; @@ -79,6 +83,9 @@ export default util.createRule({ disallowTypeAnnotations: { type: 'boolean', }, + fixStyle: { + enum: ['separate-type-imports', 'inline-type-imports'], + }, }, additionalProperties: false, }, @@ -90,12 +97,14 @@ export default util.createRule({ { prefer: 'type-imports', disallowTypeAnnotations: true, + fixStyle: 'separate-type-imports', }, ], create(context, [option]) { const prefer = option.prefer ?? 'type-imports'; const disallowTypeAnnotations = option.disallowTypeAnnotations !== false; + const fixStyle = option.fixStyle ?? 'separate-type-imports'; const sourceCode = context.getSourceCode(); const sourceImportsMap: { [key: string]: SourceImports } = {}; @@ -106,13 +115,15 @@ export default util.createRule({ // prefer type imports ImportDeclaration(node): void { const source = node.source.value; + // sourceImports is the object containing all the specifics for a particular import source, type or value const sourceImports = sourceImportsMap[source] ?? (sourceImportsMap[source] = { source, - reportValueImports: [], - typeOnlyNamedImport: null, - valueOnlyNamedImport: null, + reportValueImports: [], // if there is a mismatch where type importKind but value specifiers + typeOnlyNamedImport: null, // if only type imports + valueOnlyNamedImport: null, // if only value imports with named specifiers + valueImport: null, // if only value imports }); if (node.importKind === 'type') { if ( @@ -122,6 +133,7 @@ export default util.createRule({ specifier.type === AST_NODE_TYPES.ImportSpecifier, ) ) { + // definitely import type { TypeX } sourceImports.typeOnlyNamedImport = node; } } else { @@ -133,6 +145,15 @@ export default util.createRule({ ) ) { sourceImports.valueOnlyNamedImport = node; + sourceImports.valueImport = node; + } else if ( + !sourceImports.valueImport && + node.specifiers.some( + specifier => + specifier.type === AST_NODE_TYPES.ImportDefaultSpecifier, + ) + ) { + sourceImports.valueImport = node; } } @@ -243,14 +264,15 @@ export default util.createRule({ 'Program:exit'(): void { for (const sourceImports of Object.values(sourceImportsMap)) { if (sourceImports.reportValueImports.length === 0) { + // nothing to fix. value specifiers and type specifiers are correctly written continue; } for (const report of sourceImports.reportValueImports) { if ( report.valueSpecifiers.length === 0 && - report.unusedSpecifiers.length === 0 + report.unusedSpecifiers.length === 0 && + report.node.importKind !== 'type' ) { - // import is all type-only, convert the entire import to `import type` context.report({ node: report.node, messageId: 'typeOverValue', @@ -265,12 +287,13 @@ export default util.createRule({ } else { const isTypeImport = report.node.importKind === 'type'; - // we have a mixed type/value import, so we need to split them out into multiple exports + // we have a mixed type/value import or just value imports, so we need to split them out into multiple imports if separate-type-imports is configured const importNames = ( isTypeImport - ? report.valueSpecifiers + ? report.valueSpecifiers // import type { A } from 'roo'; // WHERE A is used in value position : report.typeSpecifiers - ).map(specifier => `"${specifier.local.name}"`); + ) // import { A, B } from 'roo'; // WHERE A is used in type position and B is in value position + .map(specifier => `"${specifier.local.name}"`); const message = ((): { messageId: MessageIds; @@ -294,12 +317,12 @@ export default util.createRule({ if (isTypeImport) { return { messageId: 'someImportsInDecoMeta', - data: { typeImports }, + data: { typeImports }, // typeImports are all the value specifiers that are in the type position }; } else { return { messageId: 'someImportsAreOnlyTypes', - data: { typeImports }, + data: { typeImports }, // typeImports are all the type specifiers in the value position }; } } @@ -310,12 +333,14 @@ export default util.createRule({ ...message, *fix(fixer) { if (isTypeImport) { + // take all the valueSpecifiers and put them on a new line yield* fixToValueImportDeclaration( fixer, report, sourceImports, ); } else { + // take all the typeSpecifiers and put them on a new line yield* fixToTypeImportDeclaration( fixer, report, @@ -396,12 +421,12 @@ export default util.createRule({ } /** - * Returns information for fixing named specifiers. + * Returns information for fixing named specifiers, type or value */ function getFixesNamedSpecifiers( fixer: TSESLint.RuleFixer, node: TSESTree.ImportDeclaration, - typeNamedSpecifiers: TSESTree.ImportSpecifier[], + subsetNamedSpecifiers: TSESTree.ImportSpecifier[], allNamedSpecifiers: TSESTree.ImportSpecifier[], ): { typeNamedSpecifiersText: string; @@ -415,12 +440,12 @@ export default util.createRule({ } const typeNamedSpecifiersTexts: string[] = []; const removeTypeNamedSpecifiers: TSESLint.RuleFix[] = []; - if (typeNamedSpecifiers.length === allNamedSpecifiers.length) { + if (subsetNamedSpecifiers.length === allNamedSpecifiers.length) { // import Foo, {Type1, Type2} from 'foo' // import DefType, {Type1, Type2} from 'foo' const openingBraceToken = util.nullThrows( sourceCode.getTokenBefore( - typeNamedSpecifiers[0], + subsetNamedSpecifiers[0], util.isOpeningBraceToken, ), util.NullThrowsReasons.MissingToken('{', node.type), @@ -451,20 +476,20 @@ export default util.createRule({ ), ); } else { - const typeNamedSpecifierGroups: TSESTree.ImportSpecifier[][] = []; + const namedSpecifierGroups: TSESTree.ImportSpecifier[][] = []; let group: TSESTree.ImportSpecifier[] = []; for (const namedSpecifier of allNamedSpecifiers) { - if (typeNamedSpecifiers.includes(namedSpecifier)) { + if (subsetNamedSpecifiers.includes(namedSpecifier)) { group.push(namedSpecifier); } else if (group.length) { - typeNamedSpecifierGroups.push(group); + namedSpecifierGroups.push(group); group = []; } } if (group.length) { - typeNamedSpecifierGroups.push(group); + namedSpecifierGroups.push(group); } - for (const namedSpecifiers of typeNamedSpecifierGroups) { + for (const namedSpecifiers of namedSpecifierGroups) { const { removeRange, textRange } = getNamedSpecifierRanges( namedSpecifiers, allNamedSpecifiers, @@ -541,7 +566,53 @@ export default util.createRule({ if (!util.isCommaToken(before) && !util.isOpeningBraceToken(before)) { insertText = `,${insertText}`; } - return fixer.insertTextBefore(closingBraceToken, `${insertText}`); + return fixer.insertTextBefore(closingBraceToken, insertText); + } + + /** + * insert type keyword to named import node. + * e.g. + * import ADefault, { Already, type Type1, type Type2 } from 'foo' + * ^^^^ insert + */ + function* fixInsertTypeKeywordInNamedSpecifierList( + fixer: TSESLint.RuleFixer, + typeSpecifiers: TSESTree.ImportSpecifier[], + ): IterableIterator { + for (const spec of typeSpecifiers) { + const insertText = sourceCode.text.slice(...spec.range); + yield fixer.replaceTextRange(spec.range, `type ${insertText}`); + } + } + + function* fixInlineTypeImportDeclaration( + fixer: TSESLint.RuleFixer, + report: ReportValueImport, + sourceImports: SourceImports, + ): IterableIterator { + const { node } = report; + // For a value import, will only add an inline type to named specifiers + const { namedSpecifiers } = classifySpecifier(node); + const typeNamedSpecifiers = namedSpecifiers.filter(specifier => + report.typeSpecifiers.includes(specifier), + ); + + if (sourceImports.valueImport) { + // add import named type specifiers to its value import + // import ValueA, { type A } + // ^^^^ insert + const { namedSpecifiers: valueImportNamedSpecifiers } = + classifySpecifier(sourceImports.valueImport); + if ( + sourceImports.valueOnlyNamedImport || + valueImportNamedSpecifiers.length + ) { + yield* fixInsertTypeKeywordInNamedSpecifierList( + fixer, + typeNamedSpecifiers, + ); + } + } } function* fixToTypeImportDeclaration( @@ -567,13 +638,31 @@ export default util.createRule({ // import Type from 'foo' yield* fixInsertTypeSpecifierForImportDeclaration(fixer, node, true); return; + } else if ( + fixStyle === 'inline-type-imports' && + !report.typeSpecifiers.includes(defaultSpecifier) && + namedSpecifiers.length > 0 && + !namespaceSpecifier + ) { + // if there is a default specifier but it isn't a type specifier, then just add the inline type modifier to the named specifiers + // import AValue, {BValue, Type1, Type2} from 'foo' + yield* fixInlineTypeImportDeclaration(fixer, report, sourceImports); + return; } - } else { + } else if (!namespaceSpecifier) { if ( + fixStyle === 'inline-type-imports' && + namedSpecifiers.some(specifier => + report.typeSpecifiers.includes(specifier), + ) + ) { + // import {AValue, Type1, Type2} from 'foo' + yield* fixInlineTypeImportDeclaration(fixer, report, sourceImports); + return; + } else if ( namedSpecifiers.every(specifier => report.typeSpecifiers.includes(specifier), - ) && - !namespaceSpecifier + ) ) { // import {Type1, Type2} from 'foo' yield* fixInsertTypeSpecifierForImportDeclaration(fixer, node, false); @@ -606,12 +695,25 @@ export default util.createRule({ afterFixes.push(insertTypeNamedSpecifiers); } } else { - yield fixer.insertTextBefore( - node, - `import type {${ - fixesNamedSpecifiers.typeNamedSpecifiersText - }} from ${sourceCode.getText(node.source)};\n`, - ); + // The import is both default and named. Insert named on new line because can't mix default type import and named type imports + if (fixStyle === 'inline-type-imports') { + yield fixer.insertTextBefore( + node, + `import {${typeNamedSpecifiers + .map(spec => { + const insertText = sourceCode.text.slice(...spec.range); + return `type ${insertText}`; + }) + .join(', ')}} from ${sourceCode.getText(node.source)};\n`, + ); + } else { + yield fixer.insertTextBefore( + node, + `import type {${ + fixesNamedSpecifiers.typeNamedSpecifiersText + }} from ${sourceCode.getText(node.source)};\n`, + ); + } } } @@ -736,8 +838,6 @@ export default util.createRule({ closingBraceToken.range[1], ); if (node.specifiers.length > 1) { - // import type Foo from 'foo' - // import type {...} from 'foo' // <- insert yield fixer.insertTextAfter( node, `\nimport type${specifiersText} from ${sourceCode.getText( @@ -794,6 +894,9 @@ export default util.createRule({ } } + // we have some valueSpecifiers intermixed in types that need to be put on their own line + // import type { Type1, A } from 'foo' + // import type { A } from 'foo' const valueNamedSpecifiers = namedSpecifiers.filter(specifier => report.valueSpecifiers.includes(specifier), ); @@ -819,6 +922,8 @@ export default util.createRule({ afterFixes.push(insertTypeNamedSpecifiers); } } else { + // some are types. + // Add new value import and later remove those value specifiers from import type yield fixer.insertTextBefore( node, `import {${ @@ -862,6 +967,8 @@ export default util.createRule({ fixer: TSESLint.RuleFixer, node: TSESTree.ImportSpecifier, ): IterableIterator { + // import { type Foo } from 'foo' + // ^^^^ remove const typeToken = util.nullThrows( sourceCode.getFirstToken(node, isTypeToken), util.NullThrowsReasons.MissingToken('type', node.type), diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 851661400fb..8a3c2bbf437 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -115,6 +115,7 @@ import restrictPlusOperands from './restrict-plus-operands'; import restrictTemplateExpressions from './restrict-template-expressions'; import returnAwait from './return-await'; import semi from './semi'; +import sortTypeConstituents from './sort-type-constituents'; import sortTypeUnionIntersectionMembers from './sort-type-union-intersection-members'; import spaceBeforeBlocks from './space-before-blocks'; import spaceBeforeFunctionParen from './space-before-function-paren'; @@ -245,6 +246,7 @@ export default { 'restrict-template-expressions': restrictTemplateExpressions, 'return-await': returnAwait, semi: semi, + 'sort-type-constituents': sortTypeConstituents, 'sort-type-union-intersection-members': sortTypeUnionIntersectionMembers, 'space-before-blocks': spaceBeforeBlocks, 'space-before-function-paren': spaceBeforeFunctionParen, diff --git a/packages/eslint-plugin/src/rules/keyword-spacing.ts b/packages/eslint-plugin/src/rules/keyword-spacing.ts index bcb90573836..6af42e5c2fb 100644 --- a/packages/eslint-plugin/src/rules/keyword-spacing.ts +++ b/packages/eslint-plugin/src/rules/keyword-spacing.ts @@ -1,3 +1,4 @@ +import type { TSESTree } from '@typescript-eslint/utils'; import { AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; @@ -50,6 +51,37 @@ export default util.createRule({ // make sure to reset the type afterward so we don't permanently mutate the AST asToken.type = oldTokenType; }, + 'ImportDeclaration[importKind=type]'( + node: TSESTree.ImportDeclaration, + ): void { + const typeToken = sourceCode.getFirstToken(node, { skip: 1 })!; + const punctuatorToken = sourceCode.getTokenAfter(typeToken)!; + const spacesBetweenTypeAndPunctuator = + punctuatorToken.range[0] - typeToken.range[1]; + if (context.options[0].after && spacesBetweenTypeAndPunctuator === 0) { + context.report({ + loc: punctuatorToken.loc, + messageId: 'expectedBefore', + data: { value: punctuatorToken.value }, + fix(fixer) { + return fixer.insertTextBefore(punctuatorToken, ' '); + }, + }); + } + if (!context.options[0].after && spacesBetweenTypeAndPunctuator > 0) { + context.report({ + loc: punctuatorToken.loc, + messageId: 'unexpectedBefore', + data: { value: punctuatorToken.value }, + fix(fixer) { + return fixer.removeRange([ + typeToken.range[1], + typeToken.range[1] + spacesBetweenTypeAndPunctuator, + ]); + }, + }); + } + }, }; }, }); diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts index c9460305847..bc2547ffa3f 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts @@ -102,6 +102,10 @@ enum Modifiers { unused = 1 << 10, // properties that require quoting requiresQuotes = 1 << 11, + // class members that are overridden + override = 1 << 12, + // class methods, object function properties, or functions that are async via the `async` keyword + async = 1 << 13, // make sure TypeModifiers starts at Modifiers + 1 or else sorting won't work } diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts index fab1d1bc2b6..179b6dd7f43 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts @@ -170,15 +170,21 @@ const SCHEMA: JSONSchema.JSONSchema4 = { selectorsSchema(), ...selectorSchema('default', false, util.getEnumNames(Modifiers)), - ...selectorSchema('variableLike', false, ['unused']), + ...selectorSchema('variableLike', false, ['unused', 'async']), ...selectorSchema('variable', true, [ 'const', 'destructured', 'exported', 'global', 'unused', + 'async', + ]), + ...selectorSchema('function', false, [ + 'exported', + 'global', + 'unused', + 'async', ]), - ...selectorSchema('function', false, ['exported', 'global', 'unused']), ...selectorSchema('parameter', true, ['destructured', 'unused']), ...selectorSchema('memberLike', false, [ @@ -189,6 +195,8 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'readonly', 'requiresQuotes', 'static', + 'override', + 'async', ]), ...selectorSchema('classProperty', true, [ 'abstract', @@ -198,6 +206,7 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'readonly', 'requiresQuotes', 'static', + 'override', ]), ...selectorSchema('objectLiteralProperty', true, [ 'public', @@ -222,6 +231,8 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'readonly', 'requiresQuotes', 'static', + 'override', + 'async', ]), ...selectorSchema('classMethod', false, [ @@ -231,10 +242,13 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'public', 'requiresQuotes', 'static', + 'override', + 'async', ]), ...selectorSchema('objectLiteralMethod', false, [ 'public', 'requiresQuotes', + 'async', ]), ...selectorSchema('typeMethod', false, ['public', 'requiresQuotes']), ...selectorSchema('method', false, [ @@ -244,6 +258,8 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'public', 'requiresQuotes', 'static', + 'override', + 'async', ]), ...selectorSchema('accessor', true, [ 'abstract', @@ -252,6 +268,7 @@ const SCHEMA: JSONSchema.JSONSchema4 = { 'public', 'requiresQuotes', 'static', + 'override', ]), ...selectorSchema('enumMember', false, ['requiresQuotes']), diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 6e38dfa3a6d..5a1ff941686 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -136,6 +136,9 @@ export default util.createRule({ if ('readonly' in node && node.readonly) { modifiers.add(Modifiers.readonly); } + if ('override' in node && node.override) { + modifiers.add(Modifiers.override); + } if ( node.type === AST_NODE_TYPES.TSAbstractPropertyDefinition || node.type === AST_NODE_TYPES.TSAbstractMethodDefinition @@ -180,6 +183,34 @@ export default util.createRule({ ); } + function isAsyncMemberOrProperty( + propertyOrMemberNode: + | TSESTree.PropertyNonComputedName + | TSESTree.TSMethodSignatureNonComputedName + | TSESTree.PropertyDefinitionNonComputedName + | TSESTree.TSAbstractPropertyDefinitionNonComputedName + | TSESTree.MethodDefinitionNonComputedName + | TSESTree.TSAbstractMethodDefinitionNonComputedName, + ): boolean { + return Boolean( + 'value' in propertyOrMemberNode && + propertyOrMemberNode.value && + 'async' in propertyOrMemberNode.value && + propertyOrMemberNode.value.async, + ); + } + + function isAsyncVariableIdentifier(id: TSESTree.Identifier): boolean { + return Boolean( + id.parent && + (('async' in id.parent && id.parent.async) || + ('init' in id.parent && + id.parent.init && + 'async' in id.parent.init && + id.parent.init.async)), + ); + } + return { // #region variable @@ -217,6 +248,10 @@ export default util.createRule({ modifiers.add(Modifiers.unused); } + if (isAsyncVariableIdentifier(id)) { + modifiers.add(Modifiers.async); + } + validator(id, modifiers); }); }, @@ -252,6 +287,10 @@ export default util.createRule({ modifiers.add(Modifiers.unused); } + if (node.async) { + modifiers.add(Modifiers.async); + } + validator(node.id, modifiers); }, @@ -358,6 +397,11 @@ export default util.createRule({ | TSESTree.TSMethodSignatureNonComputedName, ): void { const modifiers = new Set([Modifiers.public]); + + if (isAsyncMemberOrProperty(node)) { + modifiers.add(Modifiers.async); + } + handleMember(validators.objectLiteralMethod, node, modifiers); }, @@ -374,6 +418,11 @@ export default util.createRule({ | TSESTree.TSAbstractMethodDefinitionNonComputedName, ): void { const modifiers = getMemberModifiers(node); + + if (isAsyncMemberOrProperty(node)) { + modifiers.add(Modifiers.async); + } + handleMember(validators.classMethod, node, modifiers); }, diff --git a/packages/eslint-plugin/src/rules/no-empty-interface.ts b/packages/eslint-plugin/src/rules/no-empty-interface.ts index 4e037e9cc8a..d74034114bb 100644 --- a/packages/eslint-plugin/src/rules/no-empty-interface.ts +++ b/packages/eslint-plugin/src/rules/no-empty-interface.ts @@ -1,4 +1,5 @@ import type { TSESLint } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; @@ -73,29 +74,39 @@ export default util.createRule({ )}${typeParam} = ${sourceCode.getText(extend[0])}`, ); }; + const scope = context.getScope(); - // Check if interface is within ambient declaration - let useAutoFix = true; - if (util.isDefinitionFile(filename)) { - const scope = context.getScope(); - if (scope.type === 'tsModule' && scope.block.declare) { - useAutoFix = false; - } - } + const mergedWithClassDeclaration = scope.set + .get(node.id.name) + ?.defs?.some( + def => def.node.type === AST_NODE_TYPES.ClassDeclaration, + ); + + const isInAmbientDeclaration = !!( + util.isDefinitionFile(filename) && + scope.type === 'tsModule' && + scope.block.declare + ); + + const useAutoFix = !( + isInAmbientDeclaration || mergedWithClassDeclaration + ); context.report({ node: node.id, messageId: 'noEmptyWithSuper', ...(useAutoFix ? { fix } - : { + : !mergedWithClassDeclaration + ? { suggest: [ { messageId: 'noEmptyWithSuper', fix, }, ], - }), + } + : null), }); } } diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index 3a4a5973074..a44276a0a76 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -141,8 +141,30 @@ export default util.createRule({ }, BinaryExpression: binaryExp, CallExpression: callExp, - // ClassDeclaration - // ClassExpression + ClassDeclaration(node) { + if (node.superClass?.type === AST_NODE_TYPES.TSAsExpression) { + return rules.ClassDeclaration({ + ...node, + superClass: { + ...node.superClass, + type: AST_NODE_TYPES.SequenceExpression as any, + }, + }); + } + return rules.ClassDeclaration(node); + }, + ClassExpression(node) { + if (node.superClass?.type === AST_NODE_TYPES.TSAsExpression) { + return rules.ClassExpression({ + ...node, + superClass: { + ...node.superClass, + type: AST_NODE_TYPES.SequenceExpression as any, + }, + }); + } + return rules.ClassExpression(node); + }, ConditionalExpression(node) { // reduces the precedence of the node so the rule thinks it needs to be wrapped if (util.isTypeAssertion(node.test)) { diff --git a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts index 7cda184e4fd..9f938ac438f 100644 --- a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts +++ b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts @@ -13,7 +13,8 @@ type MessageIds = | 'invalidVoidNotReturnOrGeneric' | 'invalidVoidNotReturn' | 'invalidVoidNotReturnOrThisParam' - | 'invalidVoidNotReturnOrThisParamOrGeneric'; + | 'invalidVoidNotReturnOrThisParamOrGeneric' + | 'invalidVoidUnionConstituent'; export default util.createRule<[Options], MessageIds>({ name: 'no-invalid-void-type', @@ -25,14 +26,16 @@ export default util.createRule<[Options], MessageIds>({ }, messages: { invalidVoidForGeneric: - '{{ generic }} may not have void as a type variable.', + '{{ generic }} may not have void as a type argument.', invalidVoidNotReturnOrGeneric: - 'void is only valid as a return type or generic type variable.', + 'void is only valid as a return type or generic type argument.', invalidVoidNotReturn: 'void is only valid as a return type.', invalidVoidNotReturnOrThisParam: 'void is only valid as return type or type of `this` parameter.', invalidVoidNotReturnOrThisParamOrGeneric: - 'void is only valid as a return type or generic type variable or the type of a `this` parameter.', + 'void is only valid as a return type or generic type argument or the type of a `this` parameter.', + invalidVoidUnionConstituent: + 'void is not valid as a constituent in a union type', }, schema: [ { @@ -136,7 +139,7 @@ export default util.createRule<[Options], MessageIds>({ ): void { if (parentNode.default !== node) { context.report({ - messageId: 'invalidVoidNotReturnOrGeneric', + messageId: getNotReturnOrGenericMessageId(node), node, }); } @@ -218,7 +221,7 @@ export default util.createRule<[Options], MessageIds>({ allowInGenericTypeArguments && allowAsThisParameter ? 'invalidVoidNotReturnOrThisParamOrGeneric' : allowInGenericTypeArguments - ? 'invalidVoidNotReturnOrGeneric' + ? getNotReturnOrGenericMessageId(node) : allowAsThisParameter ? 'invalidVoidNotReturnOrThisParam' : 'invalidVoidNotReturn', @@ -228,3 +231,11 @@ export default util.createRule<[Options], MessageIds>({ }; }, }); + +function getNotReturnOrGenericMessageId( + node: TSESTree.TSVoidKeyword, +): MessageIds { + return node.parent!.type === AST_NODE_TYPES.TSUnionType + ? 'invalidVoidUnionConstituent' + : 'invalidVoidNotReturnOrGeneric'; +} diff --git a/packages/eslint-plugin/src/rules/no-shadow.ts b/packages/eslint-plugin/src/rules/no-shadow.ts index 1f746a3201c..7d8eff0b9e2 100644 --- a/packages/eslint-plugin/src/rules/no-shadow.ts +++ b/packages/eslint-plugin/src/rules/no-shadow.ts @@ -147,8 +147,9 @@ export default util.createRule({ return false; } - const id = variable.identifiers[0]; - return util.isFunctionType(id.parent); + return variable.defs.every( + def => def.node.type === AST_NODE_TYPES.TSFunctionType, + ); } function isGenericOfStaticMethod( diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index 51d42f82926..030ed4fe188 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -554,7 +554,12 @@ export default createRule({ type, property.name, ); - return propType && isNullableType(propType, { allowUndefined: true }); + + if (propType) { + return isNullableType(propType, { allowUndefined: true }); + } + + return !!checker.getIndexInfoOfType(type, ts.IndexKind.String); }); return ( !isOwnNullable && isNullableType(prevType, { allowUndefined: true }) diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index dc9b514e353..73fbcc27af3 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -35,7 +35,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: - 'Enforce using concise optional chain expressions instead of chained logical ands', + 'Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects', recommended: 'strict', }, hasSuggestions: true, @@ -111,6 +111,81 @@ export default util.createRule({ ], }); }, + [[ + 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > Identifier', + 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > MemberExpression', + 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > ChainExpression > MemberExpression', + ].join(',')]( + initialIdentifierOrNotEqualsExpr: + | TSESTree.Identifier + | TSESTree.MemberExpression, + ): void { + // selector guarantees this cast + const initialExpression = ( + initialIdentifierOrNotEqualsExpr.parent!.type === + AST_NODE_TYPES.ChainExpression + ? initialIdentifierOrNotEqualsExpr.parent.parent + : initialIdentifierOrNotEqualsExpr.parent + )!.parent as TSESTree.LogicalExpression; + + if ( + initialExpression.left.type !== AST_NODE_TYPES.UnaryExpression || + initialExpression.left.argument !== initialIdentifierOrNotEqualsExpr + ) { + // the node(identifier or member expression) is not the deepest left node + return; + } + + // walk up the tree to figure out how many logical expressions we can include + let previous: TSESTree.LogicalExpression = initialExpression; + let current: TSESTree.Node = initialExpression; + let previousLeftText = getText(initialIdentifierOrNotEqualsExpr); + let optionallyChainedCode = previousLeftText; + let expressionCount = 1; + while (current.type === AST_NODE_TYPES.LogicalExpression) { + if ( + current.right.type !== AST_NODE_TYPES.UnaryExpression || + !isValidChainTarget( + current.right.argument, + // only allow unary '!' with identifiers for the first chain - !foo || !foo() + expressionCount === 1, + ) + ) { + break; + } + const { rightText, shouldBreak } = breakIfInvalid({ + rightNode: current.right.argument, + previousLeftText, + }); + if (shouldBreak) { + break; + } + + ({ + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + } = normalizeRepeatingPatterns( + rightText, + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + )); + } + + reportIfMoreThanOne({ + expressionCount, + previous, + optionallyChainedCode, + sourceCode, + context, + shouldHandleChainedAnds: false, + }); + }, [[ 'LogicalExpression[operator="&&"] > Identifier', 'LogicalExpression[operator="&&"] > MemberExpression', @@ -155,94 +230,76 @@ export default util.createRule({ ) { break; } - - const leftText = previousLeftText; - const rightText = getText(current.right); - // can't just use startsWith because of cases like foo && fooBar.baz; - const matchRegex = new RegExp( - `^${ - // escape regex characters - leftText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') - }[^a-zA-Z0-9_$]`, - ); - if ( - !matchRegex.test(rightText) && - // handle redundant cases like foo.bar && foo.bar - leftText !== rightText - ) { + const { rightText, shouldBreak } = breakIfInvalid({ + rightNode: current.right, + previousLeftText, + }); + if (shouldBreak) { break; } - // omit weird doubled up expression that make no sense like foo.bar && foo.bar - if (rightText !== leftText) { - expressionCount += 1; - previousLeftText = rightText; - - /* - Diff the left and right text to construct the fix string - There are the following cases: - 1) - rightText === 'foo.bar.baz.buzz' - leftText === 'foo.bar.baz' - diff === '.buzz' - 2) - rightText === 'foo.bar.baz.buzz()' - leftText === 'foo.bar.baz' - diff === '.buzz()' - 3) - rightText === 'foo.bar.baz.buzz()' - leftText === 'foo.bar.baz.buzz' - diff === '()' - 4) - rightText === 'foo.bar.baz[buzz]' - leftText === 'foo.bar.baz' - diff === '[buzz]' - 5) - rightText === 'foo.bar.baz?.buzz' - leftText === 'foo.bar.baz' - diff === '?.buzz' - */ - const diff = rightText.replace(leftText, ''); - if (diff.startsWith('?')) { - // item was "pre optional chained" - optionallyChainedCode += diff; - } else { - const needsDot = diff.startsWith('(') || diff.startsWith('['); - optionallyChainedCode += `?${needsDot ? '.' : ''}${diff}`; - } - } - - previous = current; - current = util.nullThrows( - current.parent, - util.NullThrowsReasons.MissingParent, - ); + ({ + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + } = normalizeRepeatingPatterns( + rightText, + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + )); } - if (expressionCount > 1) { - if (previous.right.type === AST_NODE_TYPES.BinaryExpression) { - // case like foo && foo.bar !== someValue - optionallyChainedCode += ` ${ - previous.right.operator - } ${sourceCode.getText(previous.right.right)}`; - } - - context.report({ - node: previous, - messageId: 'preferOptionalChain', - suggest: [ - { - messageId: 'optionalChainSuggest', - fix: (fixer): TSESLint.RuleFix[] => [ - fixer.replaceText(previous, optionallyChainedCode), - ], - }, - ], - }); - } + reportIfMoreThanOne({ + expressionCount, + previous, + optionallyChainedCode, + sourceCode, + context, + shouldHandleChainedAnds: true, + }); }, }; + interface BreakIfInvalidResult { + leftText: string; + rightText: string; + shouldBreak: boolean; + } + + interface BreakIfInvalidOptions { + previousLeftText: string; + rightNode: ValidChainTarget; + } + + function breakIfInvalid({ + previousLeftText, + rightNode, + }: BreakIfInvalidOptions): BreakIfInvalidResult { + let shouldBreak = false; + + const rightText = getText(rightNode); + // can't just use startsWith because of cases like foo && fooBar.baz; + const matchRegex = new RegExp( + `^${ + // escape regex characters + previousLeftText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + }[^a-zA-Z0-9_$]`, + ); + if ( + !matchRegex.test(rightText) && + // handle redundant cases like foo.bar && foo.bar + previousLeftText !== rightText + ) { + shouldBreak = true; + } + return { shouldBreak, leftText: previousLeftText, rightText }; + } + function getText(node: ValidChainTarget): string { if (node.type === AST_NODE_TYPES.BinaryExpression) { return getText( @@ -299,6 +356,11 @@ export default util.createRule({ return getText(node.expression); } + if (node.object.type === AST_NODE_TYPES.TSNonNullExpression) { + // Not supported mixing with TSNonNullExpression + return ''; + } + return getMemberExpressionText(node); } @@ -338,6 +400,7 @@ export default util.createRule({ case AST_NODE_TYPES.Literal: case AST_NODE_TYPES.TemplateLiteral: + case AST_NODE_TYPES.BinaryExpression: propertyText = sourceCode.getText(node.property); break; @@ -389,6 +452,132 @@ const ALLOWED_NON_COMPUTED_PROP_TYPES: ReadonlySet = new Set([ AST_NODE_TYPES.Identifier, ]); +interface ReportIfMoreThanOneOptions { + expressionCount: number; + previous: TSESTree.LogicalExpression; + optionallyChainedCode: string; + sourceCode: Readonly; + context: Readonly< + TSESLint.RuleContext< + 'preferOptionalChain' | 'optionalChainSuggest', + never[] + > + >; + shouldHandleChainedAnds: boolean; +} + +function reportIfMoreThanOne({ + expressionCount, + previous, + optionallyChainedCode, + sourceCode, + context, + shouldHandleChainedAnds, +}: ReportIfMoreThanOneOptions): void { + if (expressionCount > 1) { + if ( + shouldHandleChainedAnds && + previous.right.type === AST_NODE_TYPES.BinaryExpression + ) { + // case like foo && foo.bar !== someValue + optionallyChainedCode += ` ${ + previous.right.operator + } ${sourceCode.getText(previous.right.right)}`; + } + + context.report({ + node: previous, + messageId: 'preferOptionalChain', + suggest: [ + { + messageId: 'optionalChainSuggest', + fix: (fixer): TSESLint.RuleFix[] => [ + fixer.replaceText( + previous, + `${shouldHandleChainedAnds ? '' : '!'}${optionallyChainedCode}`, + ), + ], + }, + ], + }); + } +} + +interface NormalizedPattern { + expressionCount: number; + previousLeftText: string; + optionallyChainedCode: string; + previous: TSESTree.LogicalExpression; + current: TSESTree.Node; +} + +function normalizeRepeatingPatterns( + rightText: string, + expressionCount: number, + previousLeftText: string, + optionallyChainedCode: string, + previous: TSESTree.Node, + current: TSESTree.Node, +): NormalizedPattern { + const leftText = previousLeftText; + // omit weird doubled up expression that make no sense like foo.bar && foo.bar + if (rightText !== previousLeftText) { + expressionCount += 1; + previousLeftText = rightText; + + /* + Diff the left and right text to construct the fix string + There are the following cases: + + 1) + rightText === 'foo.bar.baz.buzz' + leftText === 'foo.bar.baz' + diff === '.buzz' + + 2) + rightText === 'foo.bar.baz.buzz()' + leftText === 'foo.bar.baz' + diff === '.buzz()' + + 3) + rightText === 'foo.bar.baz.buzz()' + leftText === 'foo.bar.baz.buzz' + diff === '()' + + 4) + rightText === 'foo.bar.baz[buzz]' + leftText === 'foo.bar.baz' + diff === '[buzz]' + + 5) + rightText === 'foo.bar.baz?.buzz' + leftText === 'foo.bar.baz' + diff === '?.buzz' + */ + const diff = rightText.replace(leftText, ''); + if (diff.startsWith('?')) { + // item was "pre optional chained" + optionallyChainedCode += diff; + } else { + const needsDot = diff.startsWith('(') || diff.startsWith('['); + optionallyChainedCode += `?${needsDot ? '.' : ''}${diff}`; + } + } + + previous = current as TSESTree.LogicalExpression; + current = util.nullThrows( + current.parent, + util.NullThrowsReasons.MissingParent, + ); + return { + expressionCount, + previousLeftText, + optionallyChainedCode, + previous, + current, + }; +} + function isValidChainTarget( node: TSESTree.Node, allowIdentifier: boolean, diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index ba3c3d9478f..4387bc52c9b 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -175,7 +175,10 @@ export default util.createRule({ } // if current token is a keyword like `static` or `public` then skip it - while (keyToken.type === AST_TOKEN_TYPES.Keyword) { + while ( + keyToken.type === AST_TOKEN_TYPES.Keyword && + keyToken.range[0] < method.key.range[0] + ) { keyToken = sourceCode.getTokenAfter(keyToken)!; } diff --git a/packages/eslint-plugin/src/rules/sort-type-constituents.ts b/packages/eslint-plugin/src/rules/sort-type-constituents.ts new file mode 100644 index 00000000000..1abeddcf823 --- /dev/null +++ b/packages/eslint-plugin/src/rules/sort-type-constituents.ts @@ -0,0 +1,270 @@ +import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; + +import * as util from '../util'; +import { getEnumNames } from '../util'; + +enum Group { + conditional = 'conditional', + function = 'function', + import = 'import', + intersection = 'intersection', + keyword = 'keyword', + nullish = 'nullish', + literal = 'literal', + named = 'named', + object = 'object', + operator = 'operator', + tuple = 'tuple', + union = 'union', +} + +function getGroup(node: TSESTree.TypeNode): Group { + switch (node.type) { + case AST_NODE_TYPES.TSConditionalType: + return Group.conditional; + + case AST_NODE_TYPES.TSConstructorType: + case AST_NODE_TYPES.TSFunctionType: + return Group.function; + + case AST_NODE_TYPES.TSImportType: + return Group.import; + + case AST_NODE_TYPES.TSIntersectionType: + return Group.intersection; + + case AST_NODE_TYPES.TSAnyKeyword: + case AST_NODE_TYPES.TSBigIntKeyword: + case AST_NODE_TYPES.TSBooleanKeyword: + case AST_NODE_TYPES.TSNeverKeyword: + case AST_NODE_TYPES.TSNumberKeyword: + case AST_NODE_TYPES.TSObjectKeyword: + case AST_NODE_TYPES.TSStringKeyword: + case AST_NODE_TYPES.TSSymbolKeyword: + case AST_NODE_TYPES.TSThisType: + case AST_NODE_TYPES.TSUnknownKeyword: + case AST_NODE_TYPES.TSIntrinsicKeyword: + return Group.keyword; + + case AST_NODE_TYPES.TSNullKeyword: + case AST_NODE_TYPES.TSUndefinedKeyword: + case AST_NODE_TYPES.TSVoidKeyword: + return Group.nullish; + + case AST_NODE_TYPES.TSLiteralType: + case AST_NODE_TYPES.TSTemplateLiteralType: + return Group.literal; + + case AST_NODE_TYPES.TSArrayType: + case AST_NODE_TYPES.TSIndexedAccessType: + case AST_NODE_TYPES.TSInferType: + case AST_NODE_TYPES.TSTypeReference: + case AST_NODE_TYPES.TSQualifiedName: + return Group.named; + + case AST_NODE_TYPES.TSMappedType: + case AST_NODE_TYPES.TSTypeLiteral: + return Group.object; + + case AST_NODE_TYPES.TSTypeOperator: + case AST_NODE_TYPES.TSTypeQuery: + return Group.operator; + + case AST_NODE_TYPES.TSTupleType: + return Group.tuple; + + case AST_NODE_TYPES.TSUnionType: + return Group.union; + + // These types should never occur as part of a union/intersection + case AST_NODE_TYPES.TSAbstractKeyword: + case AST_NODE_TYPES.TSAsyncKeyword: + case AST_NODE_TYPES.TSDeclareKeyword: + case AST_NODE_TYPES.TSExportKeyword: + case AST_NODE_TYPES.TSNamedTupleMember: + case AST_NODE_TYPES.TSOptionalType: + case AST_NODE_TYPES.TSPrivateKeyword: + case AST_NODE_TYPES.TSProtectedKeyword: + case AST_NODE_TYPES.TSPublicKeyword: + case AST_NODE_TYPES.TSReadonlyKeyword: + case AST_NODE_TYPES.TSRestType: + case AST_NODE_TYPES.TSStaticKeyword: + case AST_NODE_TYPES.TSTypePredicate: + /* istanbul ignore next */ + throw new Error(`Unexpected Type ${node.type}`); + } +} + +function requiresParentheses(node: TSESTree.TypeNode): boolean { + return ( + node.type === AST_NODE_TYPES.TSFunctionType || + node.type === AST_NODE_TYPES.TSConstructorType + ); +} + +export type Options = [ + { + checkIntersections?: boolean; + checkUnions?: boolean; + groupOrder?: string[]; + }, +]; +export type MessageIds = 'notSorted' | 'notSortedNamed' | 'suggestFix'; + +export default util.createRule({ + name: 'sort-type-constituents', + meta: { + type: 'suggestion', + docs: { + description: + 'Enforce constituents of a type union/intersection to be sorted alphabetically', + recommended: false, + }, + fixable: 'code', + hasSuggestions: true, + messages: { + notSorted: '{{type}} type constituents must be sorted.', + notSortedNamed: '{{type}} type {{name}} constituents must be sorted.', + suggestFix: 'Sort constituents of type (removes all comments).', + }, + schema: [ + { + type: 'object', + properties: { + checkIntersections: { + description: 'Whether to check intersection types.', + type: 'boolean', + }, + checkUnions: { + description: 'Whether to check union types.', + type: 'boolean', + }, + groupOrder: { + description: 'Ordering of the groups.', + type: 'array', + items: { + type: 'string', + enum: getEnumNames(Group), + }, + }, + }, + }, + ], + }, + defaultOptions: [ + { + checkIntersections: true, + checkUnions: true, + groupOrder: [ + Group.named, + Group.keyword, + Group.operator, + Group.literal, + Group.function, + Group.import, + Group.conditional, + Group.object, + Group.tuple, + Group.intersection, + Group.union, + Group.nullish, + ], + }, + ], + create(context, [{ checkIntersections, checkUnions, groupOrder }]) { + const sourceCode = context.getSourceCode(); + + const collator = new Intl.Collator('en', { + sensitivity: 'base', + numeric: true, + }); + + function checkSorting( + node: TSESTree.TSIntersectionType | TSESTree.TSUnionType, + ): void { + const sourceOrder = node.types.map(type => { + const group = groupOrder?.indexOf(getGroup(type)) ?? -1; + return { + group: group === -1 ? Number.MAX_SAFE_INTEGER : group, + node: type, + text: sourceCode.getText(type), + }; + }); + const expectedOrder = [...sourceOrder].sort((a, b) => { + if (a.group !== b.group) { + return a.group - b.group; + } + + return ( + collator.compare(a.text, b.text) || + (a.text < b.text ? -1 : a.text > b.text ? 1 : 0) + ); + }); + + const hasComments = node.types.some(type => { + const count = + sourceCode.getCommentsBefore(type).length + + sourceCode.getCommentsAfter(type).length; + return count > 0; + }); + + for (let i = 0; i < expectedOrder.length; i += 1) { + if (expectedOrder[i].node !== sourceOrder[i].node) { + let messageId: MessageIds = 'notSorted'; + const data = { + name: '', + type: + node.type === AST_NODE_TYPES.TSIntersectionType + ? 'Intersection' + : 'Union', + }; + if (node.parent?.type === AST_NODE_TYPES.TSTypeAliasDeclaration) { + messageId = 'notSortedNamed'; + data.name = node.parent.id.name; + } + + const fix: TSESLint.ReportFixFunction = fixer => { + const sorted = expectedOrder + .map(t => (requiresParentheses(t.node) ? `(${t.text})` : t.text)) + .join( + node.type === AST_NODE_TYPES.TSIntersectionType ? ' & ' : ' | ', + ); + + return fixer.replaceText(node, sorted); + }; + return context.report({ + node, + messageId, + data, + // don't autofix if any of the types have leading/trailing comments + // the logic for preserving them correctly is a pain - we may implement this later + ...(hasComments + ? { + suggest: [ + { + messageId: 'suggestFix', + fix, + }, + ], + } + : { fix }), + }); + } + } + } + + return { + ...(checkIntersections && { + TSIntersectionType(node): void { + checkSorting(node); + }, + }), + ...(checkUnions && { + TSUnionType(node): void { + checkSorting(node); + }, + }), + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts index ded7212c6c9..1fbf91b9ae8 100644 --- a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts +++ b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts @@ -60,6 +60,7 @@ function getGroup(node: TSESTree.TypeNode): Group { case AST_NODE_TYPES.TSIndexedAccessType: case AST_NODE_TYPES.TSInferType: case AST_NODE_TYPES.TSTypeReference: + case AST_NODE_TYPES.TSQualifiedName: return Group.named; case AST_NODE_TYPES.TSMappedType: @@ -114,6 +115,7 @@ export type MessageIds = 'notSorted' | 'notSortedNamed' | 'suggestFix'; export default util.createRule({ name: 'sort-type-union-intersection-members', meta: { + deprecated: true, type: 'suggestion', docs: { description: @@ -127,6 +129,7 @@ export default util.createRule({ notSortedNamed: '{{type}} type {{name}} members must be sorted.', suggestFix: 'Sort members of type (removes all comments).', }, + replacedBy: ['@typescript-eslint/sort-type-constituents'], schema: [ { type: 'object', diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index 7479d99f29a..7c46b9a12f5 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -6,5 +6,10 @@ function getFixturesRootDir(): string { } const { batchedSingleLineTests, RuleTester, noFormat } = ESLintUtils; +export { + RunTests, + ValidTestCase, + InvalidTestCase, +} from '@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester'; export { batchedSingleLineTests, getFixturesRootDir, noFormat, RuleTester }; diff --git a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts index 12cf859a84a..9a20771b4af 100644 --- a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts @@ -250,12 +250,64 @@ class Test { '#private'(): void; '#private'(arg: number): void {} +} + `, + // block statement + ` +function wrap() { + function foo(s: string); + function foo(n: number); + function foo(sn: string | number) {} +} + `, + ` +if (true) { + function foo(s: string); + function foo(n: number); + function foo(sn: string | number) {} } `, ], invalid: [ { code: ` +function wrap() { + function foo(s: string); + function foo(n: number); + type bar = number; + function foo(sn: string | number) {} +} + `, + errors: [ + { + messageId: 'adjacentSignature', + data: { name: 'foo' }, + line: 6, + column: 3, + }, + ], + }, + { + code: ` +if (true) { + function foo(s: string); + function foo(n: number); + let a = 1; + function foo(sn: string | number) {} + foo(a); +} + `, + errors: [ + { + messageId: 'adjacentSignature', + data: { name: 'foo' }, + line: 6, + column: 3, + }, + ], + }, + { + code: ` export function foo(s: string); export function foo(n: number); export function bar(): void {} diff --git a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts index 518050bebcf..e5f7bfbc2d3 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts @@ -266,6 +266,9 @@ export { type T, T }; type T = 1; export type { T, T }; `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'typeOverValue', @@ -283,6 +286,9 @@ export { type/* */T, type /* */T, T }; type T = 1; export type { /* */T, /* */T, T }; `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'typeOverValue', @@ -303,6 +309,9 @@ const x = 1; export type { T, T }; export { x }; `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'singleExportIsType', @@ -322,6 +331,9 @@ type T = 1; const x = 1; export { type T, x }; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ fixMixedExportsWithInlineTypeSpecifier: true }], errors: [ { @@ -340,6 +352,9 @@ export { type T, T }; type T = 1; export type { T, T }; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ fixMixedExportsWithInlineTypeSpecifier: true }], errors: [ { @@ -362,6 +377,9 @@ export { export type { AnalyzeOptions, Definition as Foo, BlockScope as BScope } from '@typescript-eslint/scope-manager'; export { CatchScope as CScope } from '@typescript-eslint/scope-manager'; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ fixMixedExportsWithInlineTypeSpecifier: false }], errors: [ { @@ -388,6 +406,9 @@ export { CatchScope as CScope, } from '@typescript-eslint/scope-manager'; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ fixMixedExportsWithInlineTypeSpecifier: true }], errors: [ { diff --git a/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts index b1389b26e6b..2d41b0c3f98 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts @@ -7,6 +7,10 @@ const ruleTester = new RuleTester({ ecmaVersion: 2020, sourceType: 'module', }, + // type-only imports were first added in TS3.8 + dependencyConstraints: { + typescript: '3.8', + }, }); const withMetaParserOptions = { @@ -118,11 +122,83 @@ ruleTester.run('consistent-type-imports', rule, { `, options: [{ prefer: 'no-type-imports' }], }, + ` + import { type A } from 'foo'; + type T = A; + `, ` import { type A, B } from 'foo'; type T = A; const b = B; `, + ` + import { type A, type B } from 'foo'; + type T = A; + type Z = B; + `, + ` + import { B } from 'foo'; + import { type A } from 'foo'; + type T = A; + const b = B; + `, + { + code: ` + import { B, type A } from 'foo'; + type T = A; + const b = B; + `, + options: [{ fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { B } from 'foo'; + import type A from 'baz'; + type T = A; + const b = B; + `, + options: [{ fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { type B } from 'foo'; + import type { A } from 'foo'; + type T = A; + const b = B; + `, + options: [{ fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { B, type C } from 'foo'; + import type A from 'baz'; + type T = A; + type Z = C; + const b = B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { B } from 'foo'; + import type { A } from 'foo'; + type T = A; + const b = B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + }, + { + code: ` + import { B } from 'foo'; + import { A } from 'foo'; + type T = A; + const b = B; + `, + options: [{ prefer: 'no-type-imports', fixStyle: 'inline-type-imports' }], + dependencyConstraints: { + typescript: '4.5', + }, + }, // exports ` import Type from 'foo'; @@ -512,6 +588,24 @@ export type Y = { }, ], }, + { + code: ` + import Foo from 'foo'; + let foo: Foo; + `, + output: ` + import type Foo from 'foo'; + let foo: Foo; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 9, + }, + ], + }, { code: ` import { A, B } from 'foo'; @@ -1804,6 +1898,9 @@ import { A, B } from 'foo'; type T = A; const b = B; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ prefer: 'no-type-imports' }], errors: [ { @@ -1824,6 +1921,9 @@ import { B, type C } from 'foo'; type T = A | C; const b = B; `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ prefer: 'type-imports' }], errors: [ { @@ -1833,5 +1933,277 @@ const b = B; }, ], }, + + // inline-type-imports + { + code: ` + import { A, B } from 'foo'; + let foo: A; + let bar: B; + `, + output: ` + import { type A, type B } from 'foo'; + let foo: A; + let bar: B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 9, + }, + ], + }, + { + code: ` + import { A, B } from 'foo'; + + let foo: A; + B(); + `, + output: ` + import { type A, B } from 'foo'; + + let foo: A; + B(); + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 9, + }, + ], + }, + { + code: ` + import { A, B } from 'foo'; + type T = A; + B(); + `, + output: ` + import { type A, B } from 'foo'; + type T = A; + B(); + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 9, + }, + ], + }, + { + code: ` + import { A } from 'foo'; + import { B } from 'foo'; + type T = A; + type U = B; + `, + output: ` + import { type A } from 'foo'; + import { type B } from 'foo'; + type T = A; + type U = B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 9, + }, + { + messageId: 'typeOverValue', + line: 3, + column: 9, + }, + ], + }, + { + code: ` + import { A } from 'foo'; + import B from 'foo'; + type T = A; + type U = B; + `, + output: ` + import { type A } from 'foo'; + import type B from 'foo'; + type T = A; + type U = B; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 9, + }, + { + messageId: 'typeOverValue', + line: 3, + column: 9, + }, + ], + }, + { + code: ` +import A, { B, C } from 'foo'; +type T = B; +type U = C; +A(); + `, + output: ` +import A, { type B, type C } from 'foo'; +type T = B; +type U = C; +A(); + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'someImportsAreOnlyTypes', + line: 2, + column: 1, + }, + ], + }, + { + code: ` +import A, { B, C } from 'foo'; +type T = B; +type U = C; +type V = A; + `, + output: ` +import {type B, type C} from 'foo'; +import type A from 'foo'; +type T = B; +type U = C; +type V = A; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 1, + }, + ], + }, + { + code: ` +import A, { B, C as D } from 'foo'; +type T = B; +type U = D; +type V = A; + `, + output: ` +import {type B, type C as D} from 'foo'; +import type A from 'foo'; +type T = B; +type U = D; +type V = A; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'typeOverValue', + line: 2, + column: 1, + }, + ], + }, + { + code: ` + import { /* comment */ A, B } from 'foo'; + type T = A; + `, + output: ` + import { /* comment */ type A, B } from 'foo'; + type T = A; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 9, + }, + ], + }, + { + code: ` + import { B, /* comment */ A } from 'foo'; + type T = A; + `, + output: ` + import { B, /* comment */ type A } from 'foo'; + type T = A; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 9, + }, + ], + }, + { + code: ` +import { A, B, C } from 'foo'; +import type { D } from 'deez'; + +const foo: A = B(); +let bar: C; +let baz: D; + `, + output: ` +import { type A, B, type C } from 'foo'; +import type { D } from 'deez'; + +const foo: A = B(); +let bar: C; +let baz: D; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'someImportsAreOnlyTypes', + line: 2, + column: 1, + }, + ], + }, + { + code: ` +import { A, B, type C } from 'foo'; +import type { D } from 'deez'; +const foo: A = B(); +let bar: C; +let baz: D; + `, + output: ` +import { type A, B, type C } from 'foo'; +import type { D } from 'deez'; +const foo: A = B(); +let bar: C; +let baz: D; + `, + options: [{ prefer: 'type-imports', fixStyle: 'inline-type-imports' }], + errors: [ + { + messageId: 'aImportIsOnlyTypes', + line: 2, + column: 1, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts b/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts index c2694829b35..b8a1a72d2ca 100644 --- a/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts @@ -114,6 +114,16 @@ ruleTester.run('keyword-spacing', rule, { options: [{ overrides: { as: {} } }], parserOptions: { ecmaVersion: 6, sourceType: 'module' }, }, + { + code: 'import type { foo } from "foo";', + options: [{ overrides: { as: {} } }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, + { + code: "import type * as Foo from 'foo'", + options: [{ overrides: { as: {} } }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + }, ], invalid: [ //---------------------------------------------------------------------- @@ -152,5 +162,33 @@ ruleTester.run('keyword-spacing', rule, { parserOptions: { ecmaVersion: 6, sourceType: 'module' }, errors: expectedAfter('as'), }, + { + code: 'import type{ foo } from "foo";', + output: 'import type { foo } from "foo";', + options: [{ after: true, before: true }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'expectedBefore', data: { value: '{' } }], + }, + { + code: 'import type { foo } from"foo";', + output: 'import type{ foo } from"foo";', + options: [{ after: false, before: true }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'unexpectedBefore', data: { value: '{' } }], + }, + { + code: 'import type* as foo from "foo";', + output: 'import type * as foo from "foo";', + options: [{ after: true, before: true }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'expectedBefore', data: { value: '*' } }], + }, + { + code: 'import type * as foo from"foo";', + output: 'import type* as foo from"foo";', + options: [{ after: false, before: true }], + parserOptions: { ecmaVersion: 6, sourceType: 'module' }, + errors: [{ messageId: 'unexpectedBefore', data: { value: '*' } }], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/member-ordering.test.ts b/packages/eslint-plugin/tests/rules/member-ordering.test.ts index 68bbfa7eff6..cfff3691476 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering.test.ts @@ -1,130 +1,132 @@ -import type { TSESLint } from '@typescript-eslint/utils'; - import type { MessageIds, Options } from '../../src/rules/member-ordering'; import rule from '../../src/rules/member-ordering'; +import type { RunTests } from '../RuleTester'; import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const grouped: TSESLint.RunTests = { +const grouped: RunTests = { valid: [ ` // no accessibility === public interface Foo { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - new(); - G(); - H(); - I(); - J(); - K(); - L(); + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + new (); + G(); + H(); + I(); + J(); + K(); + L(); } - `, + `, { + dependencyConstraints: { + typescript: '4.5', + }, code: ` // no accessibility === public interface Foo { - A: string; - J(); - K(); - D: string; - E: string; - F: string; - new(); - G(); - H(); - [Z: string]: any; - B: string; - C: string; - I(); - L(); + A: string; + J(); + K(); + D: string; + E: string; + F: string; + new (); + G(); + H(); + [Z: string]: any; + B: string; + C: string; + I(); + L(); } - `, + `, options: [{ default: 'never' }], }, { code: ` // no accessibility === public interface Foo { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - new(); - G(); - H(); - I(); - J(); - K(); - L(); + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + new (); + G(); + H(); + I(); + J(); + K(); + L(); } - `, + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` interface X { (): void; - a: unknown; + a: unknown; b(): void; } - `, + `, options: [{ default: ['call-signature', 'field', 'method'] }], }, { code: ` // no accessibility === public interface Foo { - A: string; - J(); - K(); - D: string; - [Z: string]: any; - E: string; - F: string; - new(); - G(); - B: string; - C: string; - H(); - I(); - L(); + A: string; + J(); + K(); + D: string; + [Z: string]: any; + E: string; + F: string; + new (); + G(); + B: string; + C: string; + H(); + I(); + L(); } - `, + `, options: [{ interfaces: 'never' }], }, { code: ` // no accessibility === public interface Foo { - [Z: string]: any; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; + [Z: string]: any; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; } - `, + `, options: [ { interfaces: ['signature', 'method', 'constructor', 'field'] }, ], @@ -133,22 +135,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - G(); - H(); - I(); - J(); - K(); - L(); - new(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; } - `, + `, options: [ { default: ['signature', 'field', 'constructor', 'method'], @@ -160,23 +162,23 @@ interface Foo { code: ` // no accessibility === public interface Foo { - G(); - H(); - I(); - new(); - [Z: string]: any; - D: string; - E: string; - F: string; - G?: string; - J(); - K(); - L(); - A: string; - B: string; - C: string; + G(); + H(); + I(); + new (); + [Z: string]: any; + D: string; + E: string; + F: string; + G?: string; + J(); + K(); + L(); + A: string; + B: string; + C: string; } - `, + `, options: [ { default: [ @@ -191,22 +193,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - G(); - H(); - I(); - J(); - K(); - L(); - [Z: string]: any; - D: string; - E: string; - F: string; - new(); - A: string; - B: string; - C: string; + G(); + H(); + I(); + J(); + K(); + L(); + [Z: string]: any; + D: string; + E: string; + F: string; + new (); + A: string; + B: string; + C: string; } - `, + `, options: [ { default: ['method', 'public-constructor', 'protected-static-field'], @@ -216,147 +218,147 @@ interface Foo { ` // no accessibility === public type Foo = { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - new(); - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + new (); + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, { code: ` // no accessibility === public type Foo = { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, options: [{ default: 'never' }], }, { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - new(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + [Z: string]: any; + new (); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, options: [{ default: ['field', 'method'] }], }, { code: ` // no accessibility === public type Foo = { - G(); - H(); - [Z: string]: any; - K(); - L(); - A: string; - B: string; - I(); - J(); - C: string; - D: string; - E: string; - F: string; -} - `, + G(); + H(); + [Z: string]: any; + K(); + L(); + A: string; + B: string; + I(); + J(); + C: string; + D: string; + E: string; + F: string; +}; + `, options: [{ typeLiterals: 'never' }], }, { code: ` // no accessibility === public type Foo = { - G(); - H(); - I(); - J(); - K(); - L(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; -} - `, + G(); + H(); + I(); + J(); + K(); + L(); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; +}; + `, options: [{ typeLiterals: ['method', 'field', 'signature'] }], }, { code: ` // no accessibility === public type Foo = { - G(); - H(); - I(); - J(); - K(); - L(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; -} - `, + G(); + H(); + I(); + J(); + K(); + L(); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; +}; + `, options: [ { typeLiterals: ['method', 'constructor', 'field', 'signature'] }, ], @@ -365,21 +367,21 @@ type Foo = { code: ` // no accessibility === public type Foo = { - G(); - H(); - I(); - J(); - K(); - L(); - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - [Z: string]: any; -} - `, + G(); + H(); + I(); + J(); + K(); + L(); + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + [Z: string]: any; +}; + `, options: [ { default: ['signature', 'field', 'constructor', 'method'], @@ -391,21 +393,21 @@ type Foo = { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - D: string; - E: string; - F: string; - A: string; - B: string; - C: string; - G(); - H(); - I(); - J(); - K(); - L(); -} - `, + [Z: string]: any; + D: string; + E: string; + F: string; + A: string; + B: string; + C: string; + G(); + H(); + I(); + J(); + K(); + L(); +}; + `, options: [ { default: [ @@ -419,182 +421,182 @@ type Foo = { }, ` class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} } - `, + `, { code: ` class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} } - `, + `, options: [{ default: 'never' }], }, { code: ` class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} } - `, + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` class Foo { - [Z: string]: any; - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + [Z: string]: any; + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} } - `, + `, options: [{ default: ['field', 'method'] }], }, { code: ` class Foo { - public static G() {} - protected K() {} - private L() {} - private static I() {} - public J() {} - public D: string = ""; - [Z: string]: any; - protected static H() {} - public static A: string; - protected static B: string = ""; - constructor() {} - private static C: string = ""; - protected E: string = ""; - private F: string = ""; + public static G() {} + protected K() {} + private L() {} + private static I() {} + public J() {} + public D: string = ''; + [Z: string]: any; + protected static H() {} + public static A: string; + protected static B: string = ''; + constructor() {} + private static C: string = ''; + protected E: string = ''; + private F: string = ''; } - `, + `, options: [{ classes: 'never' }], }, { code: ` class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} } - `, + `, options: [{ classes: ['method', 'field'] }], }, { code: ` class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + [Z: string]: any; } - `, + `, options: [{ classes: ['method', 'constructor', 'field', 'signature'] }], }, { code: ` class Foo { - private required: boolean; - private typeChecker: (data: any) => boolean; - constructor(validator: (data: any) => boolean) { - this.typeChecker = validator; - } - check(data: any): boolean { - return this.typeChecker(data); - } + private required: boolean; + private typeChecker: (data: any) => boolean; + constructor(validator: (data: any) => boolean) { + this.typeChecker = validator; + } + check(data: any): boolean { + return this.typeChecker(data); + } } - `, + `, options: [{ classes: ['field', 'constructor', 'method'] }], }, { code: ` class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + [Z: string]: any; } - `, + `, options: [ { default: ['signature', 'field', 'constructor', 'method'], @@ -605,22 +607,22 @@ class Foo { { code: ` class Foo { - public J() {} - public static G() {} - protected static H() {} - private static I() {} - protected K() {} - private L() {} - [Z: string]: any; - constructor() {} - public D: string = ""; - public static A: string; - private static C: string = ""; - private F: string = ""; - protected static B: string = ""; - protected E: string = ""; + public J() {} + public static G() {} + protected static H() {} + private static I() {} + protected K() {} + private L() {} + [Z: string]: any; + constructor() {} + public D: string = ''; + public static A: string; + private static C: string = ''; + private F: string = ''; + protected static B: string = ''; + protected E: string = ''; } - `, + `, options: [ { classes: [ @@ -637,22 +639,22 @@ class Foo { { code: ` class Foo { - public static G() {} - private static I() {} - protected static H() {} - public J() {} - private L() {} - protected K() {} - [Z: string]: any; - constructor() {} - public D: string = ""; - public static A: string; - protected static B: string = ""; - protected E: string = ""; - private static C: string = ""; - private F: string = ""; + public static G() {} + private static I() {} + protected static H() {} + public J() {} + private L() {} + protected K() {} + [Z: string]: any; + constructor() {} + public D: string = ''; + public static A: string; + protected static B: string = ''; + protected E: string = ''; + private static C: string = ''; + private F: string = ''; } - `, + `, options: [ { classes: [ @@ -672,22 +674,22 @@ class Foo { { code: ` class Foo { - public J() {} - public static G() {} - public D: string = ""; - public static A: string = ""; - constructor() {} - protected K() {} - private L() {} - protected static H() {} - private static I() {} - protected static B: string = ""; - private static C: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; + public J() {} + public static G() {} + public D: string = ''; + public static A: string = ''; + constructor() {} + protected K() {} + private L() {} + protected static H() {} + private static I() {} + protected static B: string = ''; + private static C: string = ''; + protected E: string = ''; + private F: string = ''; + [Z: string]: any; } - `, + `, options: [ { default: [ @@ -704,22 +706,22 @@ class Foo { { code: ` class Foo { - public J() {} - public static G() {} - protected static H() {} - private static I() {} - protected K() {} - private L() {} - constructor() {} - [Z: string]: any; - public static A: string; - private F: string = ""; - protected static B: string = ""; - public D: string = ""; - private static C: string = ""; - protected E: string = ""; + public J() {} + public static G() {} + protected static H() {} + private static I() {} + protected K() {} + private L() {} + constructor() {} + [Z: string]: any; + public static A: string; + private F: string = ''; + protected static B: string = ''; + public D: string = ''; + private static C: string = ''; + protected E: string = ''; } - `, + `, options: [ { classes: [ @@ -738,22 +740,22 @@ class Foo { { code: ` class Foo { - private L() {} - private static I() {} - protected static H() {} - protected static B: string = ""; - public static G() {} - public J() {} - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - [Z: string]: any; + private L() {} + private static I() {} + protected static H() {} + protected static B: string = ''; + public static G() {} + public J() {} + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} + [Z: string]: any; } - `, + `, options: [ { classes: ['private-instance-method', 'protected-static-field'], @@ -763,22 +765,22 @@ class Foo { { code: ` class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - [Z: string]: any; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} + [Z: string]: any; } - `, + `, options: [ { default: ['public-instance-method', 'protected-static-field'], @@ -788,22 +790,22 @@ class Foo { { code: ` class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - [Z: string]: any; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} + [Z: string]: any; } - `, + `, options: [ { classes: ['public-instance-method', 'protected-static-field'], @@ -813,22 +815,22 @@ class Foo { { code: ` class Foo { - [Z: string]: any; - public D: string = ""; - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - private constructor() {} - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; + [Z: string]: any; + public D: string = ''; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + private constructor() {} + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; } - `, + `, options: [ { default: [ @@ -847,22 +849,22 @@ class Foo { { code: ` class Foo { - public constructor() {} - public D: string = ""; - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - [Z: string]: any; - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; + public constructor() {} + public D: string = ''; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + [Z: string]: any; + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; } - `, + `, options: [ { default: [ @@ -880,146 +882,146 @@ class Foo { }, ` const foo = class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} -} - `, + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} +}; + `, { code: ` const foo = class Foo { - constructor() {} - public static A: string; - protected static B: string = ""; - private static I() {} - public J() {} - private F: string = ""; - [Z: string]: any; - public static G() {} - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - protected static H() {} - protected K() {} - private L() {} -} - `, + constructor() {} + public static A: string; + protected static B: string = ''; + private static I() {} + public J() {} + private F: string = ''; + [Z: string]: any; + public static G() {} + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + protected static H() {} + protected K() {} + private L() {} +}; + `, options: [{ default: 'never' }], }, { code: ` const foo = class Foo { - [Z: string]: any; - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} -} - `, + [Z: string]: any; + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} +}; + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` const foo = class Foo { - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} -} - `, + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + [Z: string]: any; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} +}; + `, options: [{ default: ['field', 'method'] }], }, { code: ` const foo = class Foo { - private L() {} - protected static H() {} - constructor() {} - private static I() {} - public J() {} - private static C: string = ""; - [Z: string]: any; - public D: string = ""; - protected K() {} - public static G() {} - public static A: string; - protected static B: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + private L() {} + protected static H() {} + constructor() {} + private static I() {} + public J() {} + private static C: string = ''; + [Z: string]: any; + public D: string = ''; + protected K() {} + public static G() {} + public static A: string; + protected static B: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [{ classExpressions: 'never' }], }, { code: ` const foo = class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - [Z: string]: any; -} - `, + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + [Z: string]: any; +}; + `, options: [{ classExpressions: ['method', 'field'] }], }, { code: ` const foo = class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - [Z: string]: any; - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + [Z: string]: any; + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [ { classExpressions: ['method', 'signature', 'constructor', 'field'] }, ], @@ -1027,22 +1029,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - [Z: string]: any; - constructor() {} - public static A: string; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + [Z: string]: any; + constructor() {} + public static A: string; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [ { default: ['field', 'constructor', 'method'], @@ -1053,23 +1055,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - [Z: string]: any; - private L() {} - private static I() {} - protected static H() {} - protected static B: string = ""; - public static G() {} - public J() {} - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + [Z: string]: any; + private L() {} + private static I() {} + protected static H() {} + protected static B: string = ''; + public static G() {} + public J() {} + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { classExpressions: [ @@ -1082,23 +1083,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - [Z: string]: any; - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + [Z: string]: any; + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { default: ['public-instance-method', 'protected-static-field'], @@ -1108,23 +1108,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - [Z: string]: any; - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + [Z: string]: any; + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { classExpressions: [ @@ -1137,22 +1136,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - public D: string = ""; - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - [Z: string]: any; - private constructor() {} - protected static B: string = ""; - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; -} - `, + public D: string = ''; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + [Z: string]: any; + private constructor() {} + protected static B: string = ''; + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; +}; + `, options: [ { default: [ @@ -1176,22 +1175,22 @@ const foo = class Foo { { code: ` const foo = class Foo { - public constructor() {} - public D: string = ""; - private L() {} - private static I() {} - protected static H() {} - public static G() {} - public J() {} - protected static B: string = ""; - protected K() {} - [Z: string]: any; - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; -} - `, + public constructor() {} + public D: string = ''; + private L() {} + private static I() {} + protected static H() {} + public static G() {} + public J() {} + protected static B: string = ''; + protected K() {} + [Z: string]: any; + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; +}; + `, options: [ { default: [ @@ -1214,36 +1213,36 @@ const foo = class Foo { }, ` class Foo { - [Z: string]: any; - A: string; - constructor () {} - J() {} - K = () => {} + [Z: string]: any; + A: string; + constructor() {} + J() {} + K = () => {}; } - `, + `, { code: ` class Foo { - J() {} - K = () => {} - constructor () {} - A: string; - [Z: string]: any; + J() {} + K = () => {}; + constructor() {} + A: string; + [Z: string]: any; } - `, + `, options: [{ default: ['method', 'constructor', 'field', 'signature'] }], }, { code: ` class Foo { - J() {} - K = () => {} - constructor () {} - [Z: string]: any; - A: string; - L: () => {} + J() {} + K = () => {}; + constructor() {} + [Z: string]: any; + A: string; + L: () => {}; } - `, + `, options: [{ default: ['method', 'constructor', 'signature', 'field'] }], }, { @@ -1253,7 +1252,10 @@ class Foo { m() {} f = 1; } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['static-initialization', 'method', 'field'] }], }, { @@ -1263,7 +1265,10 @@ class Foo { f = 1; static {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['method', 'field', 'static-initialization'] }], }, { @@ -1273,108 +1278,113 @@ class Foo { static {} m() {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['field', 'static-initialization', 'method'] }], }, ` interface Foo { - [Z: string]: any; - A: string; - K: () => {}; - J(); + [Z: string]: any; + A: string; + K: () => {}; + J(); } - `, + `, { code: ` interface Foo { - [Z: string]: any; - J(); - K: () => {} - A: string; + [Z: string]: any; + J(); + K: () => {}; + A: string; } - `, + `, options: [{ default: ['signature', 'method', 'constructor', 'field'] }], }, ` type Foo = { - [Z: string]: any; - A: string; - K: () => {} - J(); -} - `, + [Z: string]: any; + A: string; + K: () => {}; + J(); +}; + `, { code: ` type Foo = { - J(); - [Z: string]: any; - K: () => {} - A: string; -} - `, + J(); + [Z: string]: any; + K: () => {}; + A: string; +}; + `, options: [{ default: ['method', 'constructor', 'signature', 'field'] }], }, { code: ` abstract class Foo { - B: string; - abstract A: () => {} + B: string; + abstract A: () => {}; } - `, + `, }, { code: ` interface Foo { - [A:string]: number; - public B: string; + [A: string]: number; + B: string; } - `, + `, }, { code: ` abstract class Foo { - [Z: string]: any; - private static C: string; - B: string; - private D: string; - protected static F(): {}; - public E(): {}; - public abstract A(): void; - protected abstract G(): void; + [Z: string]: any; + private static C: string; + B: string; + private D: string; + protected static F(): {}; + public E(): {}; + public abstract A(): void; + protected abstract G(): void; } - `, + `, }, { code: ` abstract class Foo { - protected typeChecker: (data: any) => boolean; - public abstract required: boolean; - abstract verify(): void; + protected typeChecker: (data: any) => boolean; + public abstract required: boolean; + abstract verify(): void; } - `, + `, options: [{ classes: ['signature', 'field', 'constructor', 'method'] }], }, { code: ` class Foo { - @Dec() B: string; - @Dec() A: string; - constructor() {} - D: string; - C: string; - E(): void; - F(): void; -} `, + @Dec() B: string; + @Dec() A: string; + constructor() {} + D: string; + C: string; + E(): void; + F(): void; +} + `, options: [{ default: ['decorated-field', 'field'] }], }, { code: ` class Foo { - A: string; - B: string; - @Dec() private C: string; - private D: string; -} `, + A: string; + B: string; + @Dec() private C: string; + private D: string; +} + `, options: [ { default: ['public-field', 'private-decorated-field', 'private-field'], @@ -1384,12 +1394,13 @@ class Foo { { code: ` class Foo { - constructor() {} - @Dec() public A(): void; - @Dec() private B: string; - private C(): void; - private D: string; -} `, + constructor() {} + @Dec() public A(): void; + @Dec() private B: string; + private C(): void; + private D: string; +} + `, options: [ { default: [ @@ -1403,12 +1414,13 @@ class Foo { { code: ` class Foo { - @Dec() private A(): void; - @Dec() private B: string; - constructor() {} - private C(): void; - private D: string; -} `, + @Dec() private A(): void; + @Dec() private B: string; + constructor() {} + private C(): void; + private D: string; +} + `, options: [ { default: [ @@ -1423,9 +1435,10 @@ class Foo { { code: ` class Foo { - public A: string; - @Dec() private B: string; -} `, + public A: string; + @Dec() private B: string; +} + `, options: [ { default: ['private-decorated-field', 'public-instance-field'], @@ -1437,12 +1450,13 @@ class Foo { { code: ` class Foo { - public A(): string; - @Dec() public B(): string; - public C(): string; + public A(): string; + @Dec() public B(): string; + public C(): string; - d: string; -} `, + d: string; +} + `, options: [ { default: ['public-method', 'field'], @@ -1452,14 +1466,15 @@ class Foo { { code: ` class Foo { - A: string; - constructor() {} - get B() {} - set B() {} - get C() {} - set C() {} - D(): void; -} `, + A: string; + constructor() {} + get B() {} + set B() {} + get C() {} + set C() {} + D(): void; +} + `, options: [ { default: ['field', 'constructor', ['get', 'set'], 'method'], @@ -1469,10 +1484,11 @@ class Foo { { code: ` class Foo { - A: string; - constructor() {} - B(): void; -} `, + A: string; + constructor() {} + B(): void; +} + `, options: [ { default: ['field', 'constructor', [], 'method'], @@ -1482,13 +1498,14 @@ class Foo { { code: ` class Foo { - A: string; - constructor() {} - @Dec() private B: string; - private C(): void; - set D() {} - E(): void; -} `, + A: string; + constructor() {} + @Dec() private B: string; + private C(): void; + set D() {} + E(): void; +} + `, options: [ { default: [ @@ -1503,14 +1520,15 @@ class Foo { { code: ` class Foo { - A: string; - constructor() {} - get B() {} - get C() {} - set B() {} - set C() {} - D(): void; -} `, + A: string; + constructor() {} + get B() {} + get C() {} + set B() {} + set C() {} + D(): void; +} + `, options: [ { default: ['field', 'constructor', ['get'], ['set'], 'method'], @@ -1523,22 +1541,22 @@ class Foo { code: ` // no accessibility === public interface Foo { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -1547,18 +1565,18 @@ interface Foo { rank: 'method', }, line: 17, - column: 5, + column: 3, }, ], }, { code: ` interface X { - a: unknown; + a: unknown; (): void; b(): void; } - `, + `, options: [{ default: ['call-signature', 'field', 'method'] }], errors: [ { @@ -1576,22 +1594,22 @@ interface X { code: ` // no accessibility === public interface Foo { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + [Z: string]: any; } - `, + `, options: [{ default: ['signature', 'method', 'constructor', 'field'] }], errors: [ { @@ -1601,7 +1619,7 @@ interface Foo { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1610,7 +1628,7 @@ interface Foo { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1619,7 +1637,7 @@ interface Foo { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1628,7 +1646,7 @@ interface Foo { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1637,7 +1655,7 @@ interface Foo { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1646,7 +1664,7 @@ interface Foo { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1655,7 +1673,7 @@ interface Foo { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1664,7 +1682,7 @@ interface Foo { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -1672,22 +1690,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + [Z: string]: any; } - `, + `, options: [ { interfaces: ['method', 'signature', 'constructor', 'field'] }, ], @@ -1699,7 +1717,7 @@ interface Foo { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1708,7 +1726,7 @@ interface Foo { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1717,7 +1735,7 @@ interface Foo { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1726,7 +1744,7 @@ interface Foo { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1735,7 +1753,7 @@ interface Foo { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1744,7 +1762,7 @@ interface Foo { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1753,7 +1771,7 @@ interface Foo { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1762,7 +1780,7 @@ interface Foo { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -1770,22 +1788,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + [Z: string]: any; } - `, + `, options: [ { default: ['field', 'method', 'constructor', 'signature'], @@ -1800,7 +1818,7 @@ interface Foo { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1809,7 +1827,7 @@ interface Foo { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1818,7 +1836,7 @@ interface Foo { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1827,7 +1845,7 @@ interface Foo { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1836,7 +1854,7 @@ interface Foo { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1845,7 +1863,7 @@ interface Foo { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1854,7 +1872,7 @@ interface Foo { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1863,7 +1881,7 @@ interface Foo { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -1871,22 +1889,22 @@ interface Foo { code: ` // no accessibility === public interface Foo { - [Z: string]: any; - new(); - A: string; - G(); - B: string; - H(); - C: string; - I(); - D: string; - J(); - E: string; - K(); - F: string; - L(); + [Z: string]: any; + new (); + A: string; + G(); + B: string; + H(); + C: string; + I(); + D: string; + J(); + E: string; + K(); + F: string; + L(); } - `, + `, options: [ { interfaces: ['signature', 'constructor', 'field', 'method'], @@ -1900,7 +1918,7 @@ interface Foo { rank: 'method', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1909,7 +1927,7 @@ interface Foo { rank: 'method', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1918,7 +1936,7 @@ interface Foo { rank: 'method', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1927,7 +1945,7 @@ interface Foo { rank: 'method', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -1936,7 +1954,7 @@ interface Foo { rank: 'method', }, line: 16, - column: 5, + column: 3, }, ], }, @@ -1944,22 +1962,22 @@ interface Foo { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); -} - `, + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); +}; + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -1968,7 +1986,7 @@ type Foo = { rank: 'method', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -1976,22 +1994,22 @@ type Foo = { code: ` // no accessibility === public type Foo = { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - [Z: string]: any; - new(); -} - `, + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + [Z: string]: any; + new (); +}; + `, options: [{ default: ['method', 'constructor', 'signature', 'field'] }], errors: [ { @@ -2001,7 +2019,7 @@ type Foo = { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2010,7 +2028,7 @@ type Foo = { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2019,7 +2037,7 @@ type Foo = { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2028,7 +2046,7 @@ type Foo = { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2037,7 +2055,7 @@ type Foo = { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2046,7 +2064,7 @@ type Foo = { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2055,7 +2073,7 @@ type Foo = { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2064,7 +2082,7 @@ type Foo = { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -2072,22 +2090,22 @@ type Foo = { code: ` // no accessibility === public type Foo = { - [Z: string]: any; - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); -} - `, + [Z: string]: any; + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); +}; + `, options: [ { typeLiterals: ['method', 'constructor', 'signature', 'field'] }, ], @@ -2099,7 +2117,7 @@ type Foo = { rank: 'signature', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2108,7 +2126,7 @@ type Foo = { rank: 'signature', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2117,7 +2135,7 @@ type Foo = { rank: 'signature', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2126,7 +2144,7 @@ type Foo = { rank: 'signature', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2135,7 +2153,7 @@ type Foo = { rank: 'signature', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2144,7 +2162,7 @@ type Foo = { rank: 'signature', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2153,7 +2171,7 @@ type Foo = { rank: 'signature', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -2161,22 +2179,22 @@ type Foo = { code: ` // no accessibility === public type Foo = { - A: string; - B: string; - C: string; - D: string; - E: string; - F: string; - G(); - H(); - I(); - J(); - K(); - L(); - new(); - [Z: string]: any; -} - `, + A: string; + B: string; + C: string; + D: string; + E: string; + F: string; + G(); + H(); + I(); + J(); + K(); + L(); + new (); + [Z: string]: any; +}; + `, options: [ { default: ['field', 'method', 'constructor', 'signature'], @@ -2191,7 +2209,7 @@ type Foo = { rank: 'field', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2200,7 +2218,7 @@ type Foo = { rank: 'field', }, line: 11, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2209,7 +2227,7 @@ type Foo = { rank: 'field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2218,7 +2236,7 @@ type Foo = { rank: 'field', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2227,7 +2245,7 @@ type Foo = { rank: 'field', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2236,7 +2254,7 @@ type Foo = { rank: 'field', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2245,7 +2263,7 @@ type Foo = { rank: 'field', }, line: 16, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2254,7 +2272,7 @@ type Foo = { rank: 'field', }, line: 17, - column: 5, + column: 3, }, ], }, @@ -2262,22 +2280,22 @@ type Foo = { code: ` // no accessibility === public type Foo = { - new(); - [Z: string]: any; - A: string; - G(); - B: string; - H(); - C: string; - I(); - D: string; - J(); - E: string; - K(); - F: string; - L(); -} - `, + new (); + [Z: string]: any; + A: string; + G(); + B: string; + H(); + C: string; + I(); + D: string; + J(); + E: string; + K(); + F: string; + L(); +}; + `, options: [ { typeLiterals: ['constructor', 'signature', 'field', 'method'], @@ -2291,7 +2309,7 @@ type Foo = { rank: 'method', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2300,7 +2318,7 @@ type Foo = { rank: 'method', }, line: 10, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2309,7 +2327,7 @@ type Foo = { rank: 'method', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2318,7 +2336,7 @@ type Foo = { rank: 'method', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2327,29 +2345,29 @@ type Foo = { rank: 'method', }, line: 16, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - [Z: string]: any; - public static A: string = ""; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public J() {} - protected K() {} - private L() {} - public static G() {} - protected static H() {} - private static I() {} + [Z: string]: any; + public static A: string = ''; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public J() {} + protected K() {} + private L() {} + public static G() {} + protected static H() {} + private static I() {} } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -2358,7 +2376,7 @@ class Foo { rank: 'public instance method', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2367,7 +2385,7 @@ class Foo { rank: 'public instance method', }, line: 15, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2376,29 +2394,29 @@ class Foo { rank: 'public instance method', }, line: 16, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - constructor() {} - public static A: string = ""; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - public J() {} - protected K() {} - private L() {} - public static G() {} - protected static H() {} - private static I() {} - [Z: string]: any; + constructor() {} + public static A: string = ''; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + public J() {} + protected K() {} + private L() {} + public static G() {} + protected static H() {} + private static I() {} + [Z: string]: any; } - `, + `, options: [{ default: ['field', 'constructor', 'method', 'signature'] }], errors: [ { @@ -2408,7 +2426,7 @@ class Foo { rank: 'constructor', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2417,7 +2435,7 @@ class Foo { rank: 'constructor', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2426,7 +2444,7 @@ class Foo { rank: 'constructor', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2435,7 +2453,7 @@ class Foo { rank: 'constructor', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2444,7 +2462,7 @@ class Foo { rank: 'constructor', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2453,28 +2471,28 @@ class Foo { rank: 'constructor', }, line: 9, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - constructor() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - public static G() {} - public static A: string; - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} + constructor() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + public static G() {} + public static A: string; + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} } - `, + `, options: [{ default: ['field', 'method'] }], errors: [ { @@ -2484,28 +2502,28 @@ class Foo { rank: 'method', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - public static G() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + public static G() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} } - `, + `, options: [{ default: ['method', 'field'] }], errors: [ { @@ -2515,28 +2533,28 @@ class Foo { rank: 'field', }, line: 9, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public static G() {} - protected static H() {} - protected static B: string = ""; - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - constructor() {} - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; + public static G() {} + protected static H() {} + protected static B: string = ''; + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + constructor() {} + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; } - `, + `, options: [{ classes: ['method', 'constructor', 'field'] }], errors: [ { @@ -2546,7 +2564,7 @@ class Foo { rank: 'field', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2555,7 +2573,7 @@ class Foo { rank: 'field', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2564,7 +2582,7 @@ class Foo { rank: 'field', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2573,7 +2591,7 @@ class Foo { rank: 'field', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2582,28 +2600,28 @@ class Foo { rank: 'field', }, line: 11, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public static A: string; - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - constructor() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; + public static A: string; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + constructor() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; } - `, + `, options: [ { default: ['field', 'constructor', 'method'], @@ -2618,7 +2636,7 @@ class Foo { rank: 'field', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2627,7 +2645,7 @@ class Foo { rank: 'field', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2636,7 +2654,7 @@ class Foo { rank: 'field', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2645,7 +2663,7 @@ class Foo { rank: 'field', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2654,7 +2672,7 @@ class Foo { rank: 'field', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2663,7 +2681,7 @@ class Foo { rank: 'field', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2672,30 +2690,30 @@ class Foo { rank: 'field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - private L() {} - public J() {} - public static G() {} - protected static H() {} - private static I() {} - protected K() {} - constructor() {} - public D: string = ""; - private static C: string = ""; - public static A: string; - private static C: string = ""; - protected static B: string = ""; - private F: string = ""; - protected static B: string = ""; - protected E: string = ""; + private L() {} + public J() {} + public static G() {} + protected static H() {} + private static I() {} + protected K() {} + constructor() {} + public D: string = ''; + private static C: string = ''; + public static A: string; + private static C: string = ''; + protected static B: string = ''; + private F: string = ''; + protected static B: string = ''; + protected E: string = ''; } - `, + `, options: [ { classes: [ @@ -2715,7 +2733,7 @@ class Foo { rank: 'private field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2724,28 +2742,28 @@ class Foo { rank: 'protected field', }, line: 15, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public static G() {} - private static I() {} - public J() {} - protected static H() {} - private L() {} - protected K() {} - public D: string = ""; - constructor() {} - public static A: string; - protected static B: string = ""; - protected E: string = ""; - private static C: string = ""; - private F: string = ""; + public static G() {} + private static I() {} + public J() {} + protected static H() {} + private L() {} + protected K() {} + public D: string = ''; + constructor() {} + public static A: string; + protected static B: string = ''; + protected E: string = ''; + private static C: string = ''; + private F: string = ''; } - `, + `, options: [ { classes: [ @@ -2768,7 +2786,7 @@ class Foo { rank: 'public instance method', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2777,28 +2795,28 @@ class Foo { rank: 'public field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public J() {} - public static G() {} - public D: string = ""; - public static A: string = ""; - private L() {} - constructor() {} - protected K() {} - protected static H() {} - private static I() {} - protected static B: string = ""; - private static C: string = ""; - protected E: string = ""; - private F: string = ""; + public J() {} + public static G() {} + public D: string = ''; + public static A: string = ''; + private L() {} + constructor() {} + protected K() {} + protected static H() {} + private static I() {} + protected static B: string = ''; + private static C: string = ''; + protected E: string = ''; + private F: string = ''; } - `, + `, options: [ { default: [ @@ -2818,28 +2836,28 @@ class Foo { rank: 'method', }, line: 8, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - public J() {} - private static I() {} - public static G() {} - protected static H() {} - protected K() {} - private L() {} - constructor() {} - public static A: string; - private F: string = ""; - protected static B: string = ""; - public D: string = ""; - private static C: string = ""; - protected E: string = ""; + public J() {} + private static I() {} + public static G() {} + protected static H() {} + protected K() {} + private L() {} + constructor() {} + public static A: string; + private F: string = ''; + protected static B: string = ''; + public D: string = ''; + private static C: string = ''; + protected E: string = ''; } - `, + `, options: [ { classes: [ @@ -2861,7 +2879,7 @@ class Foo { rank: 'private static method', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2870,28 +2888,28 @@ class Foo { rank: 'private static method', }, line: 6, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - private static I() {} - protected static H() {} - protected static B: string = ""; - public static G() {} - public J() {} - protected K() {} - private static C: string = ""; - private L() {} - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} + private static I() {} + protected static H() {} + protected static B: string = ''; + public static G() {} + public J() {} + protected K() {} + private static C: string = ''; + private L() {} + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} } - `, + `, options: [ { classes: ['private-instance-method', 'protected-static-field'], @@ -2905,29 +2923,28 @@ class Foo { rank: 'protected static field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - protected static B: string = ""; - public J() {} - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - + private L() {} + private static I() {} + protected static H() {} + public static G() {} + protected static B: string = ''; + public J() {} + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} } - `, + `, options: [ { default: ['public-instance-method', 'protected-static-field'], @@ -2941,28 +2958,28 @@ class Foo { rank: 'protected static field', }, line: 8, - column: 5, + column: 3, }, ], }, { code: ` const foo = class Foo { - public static A: string = ""; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} - public J() {} - protected K() {} - private L() {} - public static G() {} - protected static H() {} - private static I() {} -} - `, + public static A: string = ''; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} + public J() {} + protected K() {} + private L() {} + public static G() {} + protected static H() {} + private static I() {} +}; + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -2971,7 +2988,7 @@ const foo = class Foo { rank: 'public instance method', }, line: 13, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2980,7 +2997,7 @@ const foo = class Foo { rank: 'public instance method', }, line: 14, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -2989,29 +3006,29 @@ const foo = class Foo { rank: 'public instance method', }, line: 15, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - [Z: string]: any; - constructor() {} - public static A: string = ""; - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - public J() {} - protected K() {} - private L() {} - public static G() {} - protected static H() {} - private static I() {} -} - `, + [Z: string]: any; + constructor() {} + public static A: string = ''; + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + public J() {} + protected K() {} + private L() {} + public static G() {} + protected static H() {} + private static I() {} +}; + `, options: [{ default: ['signature', 'field', 'constructor', 'method'] }], errors: [ { @@ -3021,7 +3038,7 @@ const foo = class { rank: 'constructor', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3030,7 +3047,7 @@ const foo = class { rank: 'constructor', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3039,7 +3056,7 @@ const foo = class { rank: 'constructor', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3048,7 +3065,7 @@ const foo = class { rank: 'constructor', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3057,7 +3074,7 @@ const foo = class { rank: 'constructor', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3066,29 +3083,29 @@ const foo = class { rank: 'constructor', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - constructor() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - [Z: string]: any; - public static G() {} - public static A: string; - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} -} - `, + constructor() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + [Z: string]: any; + public static G() {} + public static A: string; + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} +}; + `, options: [{ default: ['field', 'method'] }], errors: [ { @@ -3098,28 +3115,28 @@ const foo = class { rank: 'method', }, line: 11, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - public static G() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; - constructor() {} -} - `, + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + public static G() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; + constructor() {} +}; + `, options: [{ default: ['method', 'field'] }], errors: [ { @@ -3129,29 +3146,29 @@ const foo = class { rank: 'field', }, line: 9, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public static G() {} - protected static H() {} - protected static B: string = ""; - private static I() {} - public J() {} - protected K() {} - private L() {} - public static A: string; - constructor() {} - [Z: string]: any; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public static G() {} + protected static H() {} + protected static B: string = ''; + private static I() {} + public J() {} + protected K() {} + private L() {} + public static A: string; + constructor() {} + [Z: string]: any; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [{ classExpressions: ['method', 'constructor', 'field'] }], errors: [ { @@ -3161,7 +3178,7 @@ const foo = class { rank: 'field', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3170,7 +3187,7 @@ const foo = class { rank: 'field', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3179,7 +3196,7 @@ const foo = class { rank: 'field', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3188,7 +3205,7 @@ const foo = class { rank: 'field', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3197,28 +3214,28 @@ const foo = class { rank: 'field', }, line: 11, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public static A: string; - public static G() {} - protected static H() {} - private static I() {} - public J() {} - protected K() {} - private L() {} - constructor() {} - protected static B: string = ""; - private static C: string = ""; - public D: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public static A: string; + public static G() {} + protected static H() {} + private static I() {} + public J() {} + protected K() {} + private L() {} + constructor() {} + protected static B: string = ''; + private static C: string = ''; + public D: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [ { default: ['field', 'constructor', 'method'], @@ -3233,7 +3250,7 @@ const foo = class { rank: 'field', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3242,7 +3259,7 @@ const foo = class { rank: 'field', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3251,7 +3268,7 @@ const foo = class { rank: 'field', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3260,7 +3277,7 @@ const foo = class { rank: 'field', }, line: 7, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3269,7 +3286,7 @@ const foo = class { rank: 'field', }, line: 8, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3278,7 +3295,7 @@ const foo = class { rank: 'field', }, line: 9, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3287,30 +3304,30 @@ const foo = class { rank: 'field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - private L() {} - public J() {} - public static G() {} - protected static H() {} - private static I() {} - protected K() {} - constructor() {} - public D: string = ""; - private static C: string = ""; - public static A: string; - private static C: string = ""; - protected static B: string = ""; - private F: string = ""; - protected static B: string = ""; - protected E: string = ""; -} - `, + private L() {} + public J() {} + public static G() {} + protected static H() {} + private static I() {} + protected K() {} + constructor() {} + public D: string = ''; + private static C: string = ''; + public static A: string; + private static C: string = ''; + protected static B: string = ''; + private F: string = ''; + protected static B: string = ''; + protected E: string = ''; +}; + `, options: [ { classExpressions: [ @@ -3330,7 +3347,7 @@ const foo = class { rank: 'private field', }, line: 12, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3339,28 +3356,28 @@ const foo = class { rank: 'protected field', }, line: 15, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public static G() {} - private static I() {} - public J() {} - protected static H() {} - private L() {} - protected K() {} - public D: string = ""; - constructor() {} - public static A: string; - protected static B: string = ""; - protected E: string = ""; - private static C: string = ""; - private F: string = ""; -} - `, + public static G() {} + private static I() {} + public J() {} + protected static H() {} + private L() {} + protected K() {} + public D: string = ''; + constructor() {} + public static A: string; + protected static B: string = ''; + protected E: string = ''; + private static C: string = ''; + private F: string = ''; +}; + `, options: [ { classExpressions: [ @@ -3383,7 +3400,7 @@ const foo = class { rank: 'public instance method', }, line: 6, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3392,28 +3409,28 @@ const foo = class { rank: 'public field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public J() {} - public static G() {} - public D: string = ""; - public static A: string = ""; - private L() {} - constructor() {} - protected K() {} - protected static H() {} - private static I() {} - protected static B: string = ""; - private static C: string = ""; - protected E: string = ""; - private F: string = ""; -} - `, + public J() {} + public static G() {} + public D: string = ''; + public static A: string = ''; + private L() {} + constructor() {} + protected K() {} + protected static H() {} + private static I() {} + protected static B: string = ''; + private static C: string = ''; + protected E: string = ''; + private F: string = ''; +}; + `, options: [ { default: [ @@ -3433,28 +3450,28 @@ const foo = class { rank: 'method', }, line: 8, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - public J() {} - private static I() {} - public static G() {} - protected static H() {} - protected K() {} - private L() {} - constructor() {} - public static A: string; - private F: string = ""; - protected static B: string = ""; - public D: string = ""; - private static C: string = ""; - protected E: string = ""; -} - `, + public J() {} + private static I() {} + public static G() {} + protected static H() {} + protected K() {} + private L() {} + constructor() {} + public static A: string; + private F: string = ''; + protected static B: string = ''; + public D: string = ''; + private static C: string = ''; + protected E: string = ''; +}; + `, options: [ { classExpressions: [ @@ -3476,7 +3493,7 @@ const foo = class { rank: 'private static method', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3485,29 +3502,28 @@ const foo = class { rank: 'private static method', }, line: 6, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - private static I() {} - protected static H() {} - protected static B: string = ""; - public static G() {} - public J() {} - protected K() {} - private static C: string = ""; - private L() {} - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + private static I() {} + protected static H() {} + protected static B: string = ''; + public static G() {} + public J() {} + protected K() {} + private static C: string = ''; + private L() {} + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { classExpressions: [ @@ -3524,29 +3540,28 @@ const foo = class { rank: 'protected static field', }, line: 10, - column: 5, + column: 3, }, ], }, { code: ` const foo = class { - private L() {} - private static I() {} - protected static H() {} - public static G() {} - protected static B: string = ""; - public J() {} - protected K() {} - private static C: string = ""; - private F: string = ""; - protected E: string = ""; - public static A: string; - public D: string = ""; - constructor() {} - -} - `, + private L() {} + private static I() {} + protected static H() {} + public static G() {} + protected static B: string = ''; + public J() {} + protected K() {} + private static C: string = ''; + private F: string = ''; + protected E: string = ''; + public static A: string; + public D: string = ''; + constructor() {} +}; + `, options: [ { default: ['public-instance-method', 'protected-static-field'], @@ -3560,20 +3575,20 @@ const foo = class { rank: 'protected static field', }, line: 8, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - K = () => {} - A: string; - constructor () {} - [Z: string]: any; - J() {} + K = () => {}; + A: string; + constructor() {} + [Z: string]: any; + J() {} } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3582,7 +3597,7 @@ class Foo { rank: 'public instance method', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3591,7 +3606,7 @@ class Foo { rank: 'public instance method', }, line: 5, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3600,20 +3615,20 @@ class Foo { rank: 'public instance method', }, line: 6, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - J() {} - constructor () {} - K = () => {} - A: string; - [Z: string]: any; + J() {} + constructor() {} + K = () => {}; + A: string; + [Z: string]: any; } - `, + `, options: [{ default: ['method', 'constructor', 'field', 'signature'] }], errors: [ { @@ -3623,20 +3638,20 @@ class Foo { rank: 'constructor', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - J() {} - constructor () {} - K = () => {} - L: () => {} - A: string; + J() {} + constructor() {} + K = () => {}; + L: () => {}; + A: string; } - `, + `, options: [{ default: ['method', 'constructor', 'field'] }], errors: [ { @@ -3646,18 +3661,18 @@ class Foo { rank: 'constructor', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` interface Foo { - K: () => {} - J(); - A: string; + K: () => {}; + J(); + A: string; } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3666,18 +3681,18 @@ interface Foo { rank: 'method', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` type Foo = { - K: () => {} - J(); - A: string; -} - `, + K: () => {}; + J(); + A: string; +}; + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3686,18 +3701,18 @@ type Foo = { rank: 'method', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` type Foo = { - A: string; - K: () => {} - J(); -} - `, + A: string; + K: () => {}; + J(); +}; + `, options: [{ default: ['method', 'constructor', 'field'] }], errors: [ { @@ -3707,17 +3722,17 @@ type Foo = { rank: 'field', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` abstract class Foo { - abstract A(): void; - B: string; + abstract A(): void; + B: string; } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3726,17 +3741,17 @@ abstract class Foo { rank: 'public abstract method', }, line: 4, - column: 5, + column: 3, }, ], }, { code: ` abstract class Foo { - abstract A: () => {}; - B: string; + abstract A: () => {}; + B: string; } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3745,20 +3760,20 @@ abstract class Foo { rank: 'public abstract field', }, line: 4, - column: 5, + column: 3, }, ], }, { code: ` abstract class Foo { - abstract A: () => {}; - B: string; - public C() {}; - private D() {}; - abstract E() {}; + abstract A: () => {}; + B: string; + public C() {} + private D() {} + abstract E() {} } - `, + `, errors: [ { messageId: 'incorrectGroupOrder', @@ -3767,19 +3782,19 @@ abstract class Foo { rank: 'public abstract field', }, line: 4, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - C: number; - [A:string]: number; - public static D(): {}; - private static [B:string]: number; + C: number; + [A: string]: number; + public static D(): {}; + private static [B: string]: number; } - `, + `, options: [ { default: [ @@ -3799,18 +3814,18 @@ class Foo { rank: 'signature', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` abstract class Foo { - abstract B: string; - abstract A(): void; - public C(): {}; + abstract B: string; + abstract A(): void; + public C(): {}; } - `, + `, options: [{ default: ['method', 'constructor', 'field'] }], errors: [ { @@ -3820,7 +3835,7 @@ abstract class Foo { rank: 'field', }, line: 4, - column: 5, + column: 3, }, { messageId: 'incorrectGroupOrder', @@ -3829,7 +3844,7 @@ abstract class Foo { rank: 'field', }, line: 5, - column: 5, + column: 3, }, ], }, @@ -3837,13 +3852,14 @@ abstract class Foo { code: ` // no accessibility === public class Foo { - B: string; - @Dec() A: string = ""; - C: string = ""; - constructor() {} - D() {} - E() {} -} `, + B: string; + @Dec() A: string = ''; + C: string = ''; + constructor() {} + D() {} + E() {} +} + `, options: [{ default: ['decorated-field', 'field'] }], errors: [ { @@ -3853,18 +3869,19 @@ class Foo { rank: 'field', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A() {} + A() {} - @Decorator() - B() {} -} `, + @Decorator() + B() {} +} + `, options: [{ default: ['decorated-method', 'method'] }], errors: [ { @@ -3874,16 +3891,17 @@ class Foo { rank: 'method', }, line: 5, // Symbol starts at the line with decorator - column: 5, + column: 3, }, ], }, { code: ` class Foo { - @Decorator() C() {} - A() {} -} `, + @Decorator() C() {} + A() {} +} + `, options: [{ default: ['public-method', 'decorated-method'] }], errors: [ { @@ -3893,19 +3911,20 @@ class Foo { rank: 'decorated method', }, line: 4, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A(): void; - B(): void; - private C() {} - constructor() {} - @Dec() private D() {} -} `, + A(): void; + B(): void; + private C() {} + constructor() {} + @Dec() private D() {} +} + `, options: [ { classes: ['public-method', 'decorated-method', 'private-method'], @@ -3919,21 +3938,22 @@ class Foo { rank: 'private method', }, line: 7, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A: string; - get B() {} - constructor() {} - set B() {} - get C() {} - set C() {} - D(): void; -} `, + A: string; + get B() {} + constructor() {} + set B() {} + get C() {} + set C() {} + D(): void; +} + `, options: [ { default: ['field', 'constructor', ['get', 'set'], 'method'], @@ -3947,20 +3967,21 @@ class Foo { rank: 'get, set', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A: string; - private C(): void; - constructor() {} - @Dec() private B: string; - set D() {} - E(): void; -} `, + A: string; + private C(): void; + constructor() {} + @Dec() private B: string; + set D() {} + E(): void; +} + `, options: [ { default: [ @@ -3979,21 +4000,22 @@ class Foo { rank: 'private decorated field, public set, private method', }, line: 5, - column: 5, + column: 3, }, ], }, { code: ` class Foo { - A: string; - constructor() {} - get B() {} - set B() {} - get C() {} - set C() {} - D(): void; -} `, + A: string; + constructor() {} + get B() {} + set B() {} + get C() {} + set C() {} + D(): void; +} + `, options: [ { default: ['field', 'constructor', 'get', ['set'], 'method'], @@ -4007,7 +4029,7 @@ class Foo { rank: 'set', }, line: 7, - column: 5, + column: 3, }, ], }, @@ -4018,7 +4040,10 @@ class Foo { m() {} f = 1; } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['method', 'field', 'static-initialization'] }], errors: [ { @@ -4048,7 +4073,10 @@ class Foo { f = 1; static {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['static-initialization', 'method', 'field'] }], errors: [ { @@ -4069,7 +4097,10 @@ class Foo { static {} m() {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['static-initialization', 'field', 'method'] }], errors: [ { @@ -4090,7 +4121,10 @@ class Foo { f = 1; m() {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [{ default: ['field', 'static-initialization', 'method'] }], errors: [ { @@ -4113,7 +4147,10 @@ class Foo { @dec md() {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [ { default: ['decorated-method', 'static-initialization', 'method'] }, ], diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts index 3eecfc999c9..fd10c55fe91 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts @@ -1,23 +1,22 @@ -import type { TSESLint } from '@typescript-eslint/utils'; - import type { MessageIds, Options } from '../../../src/rules/member-ordering'; import rule, { defaultOrder } from '../../../src/rules/member-ordering'; +import type { RunTests } from '../../RuleTester'; import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const sortedCiWithoutGrouping: TSESLint.RunTests = { +const sortedCiWithoutGrouping: RunTests = { valid: [ // default option + interface + lower/upper case { code: ` interface Foo { - a : b; - B : b; + a: b; + B: b; } - `, + `, options: [ { default: { @@ -32,10 +31,10 @@ interface Foo { { code: ` type Foo = { - a : b; - B : b; -} - `, + a: b; + B: b; +}; + `, options: [ { default: { @@ -50,10 +49,10 @@ type Foo = { { code: ` class Foo { - public static a : string; - public static B : string; + public static a: string; + public static B: string; } - `, + `, options: [ { default: { @@ -68,10 +67,10 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - public static B : string; -} - `, + public static a: string; + public static B: string; +}; + `, options: [ { default: { @@ -86,11 +85,11 @@ const foo = class Foo { { code: ` class Foo { - public static a : string; - @Dec() static B : string; - public static c : string; + public static a: string; + @Dec() static B: string; + public static c: string; } - `, + `, options: [ { default: { @@ -106,11 +105,11 @@ class Foo { { code: ` interface Foo { - c : string; - B : string; - a : string; + c: string; + B: string; + a: string; } - `, + `, options: [ { default: { @@ -141,10 +140,10 @@ interface Foo { { code: ` interface Foo { - B : b; - a : b; + B: b; + a: b; } - `, + `, options: [ { default: { @@ -168,10 +167,10 @@ interface Foo { { code: ` type Foo = { - B : b; - a : b; -} - `, + B: b; + a: b; +}; + `, options: [ { default: { @@ -195,10 +194,10 @@ type Foo = { { code: ` class Foo { - public static B : string; - public static a : string; + public static B: string; + public static a: string; } - `, + `, options: [ { default: { @@ -222,10 +221,10 @@ class Foo { { code: ` const foo = class Foo { - public static B : string; - public static a : string; -} - `, + public static B: string; + public static a: string; +}; + `, options: [ { default: { @@ -247,27 +246,27 @@ const foo = class Foo { ], }; -const sortedCiWithGrouping: TSESLint.RunTests = { +const sortedCiWithGrouping: RunTests = { valid: [ // default option + interface + default order + alphabetically { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - new () : Bar; + new (): Bar; - a() : void; - B() : void; - c() : void; + a(): void; + B(): void; + c(): void; } - `, + `, options: [ { default: { @@ -282,20 +281,20 @@ interface Foo { { code: ` interface Foo { - new () : Bar; + new (): Bar; - a() : void; - B() : void; - c() : void; + a(): void; + B(): void; + c(): void; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - [a: string] : number; - () : Baz; + [a: string]: number; + (): Baz; } - `, + `, options: [ { default: { @@ -310,21 +309,21 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - new () : Bar; + new (): Bar; - a() : void; - B() : void; - c() : void; -} - `, + a(): void; + B(): void; + c(): void; +}; + `, options: [ { default: { @@ -339,21 +338,21 @@ type Foo = { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - new () : Bar; + new (): Bar; - a() : void; - B() : void; - c() : void; + a(): void; + B(): void; + c(): void; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - () : Baz; -} - `, + (): Baz; +}; + `, options: [ { default: { @@ -369,16 +368,16 @@ type Foo = { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected E: string = ""; - private f: string = ""; + public d: string = ''; + protected E: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [ { default: { @@ -393,20 +392,20 @@ class Foo { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; @Dec() public d: string; @Dec() protected E: string; @Dec() private f: string; - public g: string = ""; - protected h: string = ""; - private i: string = ""; + public g: string = ''; + protected h: string = ''; + private i: string = ''; constructor() {} } - `, + `, options: [ { default: { @@ -423,15 +422,15 @@ class Foo { class Foo { constructor() {} - public d: string = ""; - protected E: string = ""; - private f: string = ""; + public d: string = ''; + protected E: string = ''; + private f: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; } - `, + `, options: [ { default: { @@ -447,16 +446,16 @@ class Foo { code: ` const foo = class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected E: string = ""; - private f: string = ""; + public d: string = ''; + protected E: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [ { default: { @@ -473,15 +472,15 @@ const foo = class Foo { const foo = class Foo { constructor() {} - public d: string = ""; - protected E: string = ""; - private f: string = ""; + public d: string = ''; + protected E: string = ''; + private f: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; -} - `, + protected static b: string = ''; + private static c: string = ''; +}; + `, options: [ { default: { @@ -499,7 +498,10 @@ class Foo { static {} static {} } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, options: [ { default: { @@ -515,21 +517,21 @@ class Foo { { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - c() : void; - B() : void; - a() : void; + c(): void; + B(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; + new (): Bar; } - `, + `, options: [ { default: { @@ -560,21 +562,21 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - a : x; - B : x; - c : x; + a: x; + B: x; + c: x; - c() : void; - B() : void; - a() : void; + c(): void; + B(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; -} - `, + new (): Bar; +}; + `, options: [ { default: { @@ -605,15 +607,15 @@ type Foo = { { code: ` class Foo { - public static c: string = ""; - public static B: string = ""; + public static c: string = ''; + public static B: string = ''; public static a: string; constructor() {} - public d: string = ""; + public d: string = ''; } - `, + `, options: [ { default: { @@ -637,15 +639,15 @@ class Foo { { code: ` const foo = class Foo { - public static c: string = ""; - public static B: string = ""; + public static c: string = ''; + public static B: string = ''; public static a: string; constructor() {} - public d: string = ""; -} - `, + public d: string = ''; +}; + `, options: [ { default: { diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts index afa1a5df810..338b3a50ee9 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts @@ -1,16 +1,12 @@ -import type { TSESLint } from '@typescript-eslint/utils'; - import type { MessageIds, Options } from '../../../src/rules/member-ordering'; import rule, { defaultOrder } from '../../../src/rules/member-ordering'; +import type { RunTests } from '../../RuleTester'; import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const sortedWithoutGroupingDefaultOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithoutGroupingDefaultOption: RunTests = { valid: [ // default option + interface + multiple types { @@ -20,7 +16,7 @@ interface Foo { a(): Foo; b(): Foo; } - `, + `, options: [ { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], @@ -30,10 +26,10 @@ interface Foo { { code: ` interface Foo { - A : b; - a : b; + A: b; + a: b; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -41,10 +37,10 @@ interface Foo { { code: ` interface Foo { - a1 : b; - aa : b; + a1: b; + aa: b; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -52,11 +48,11 @@ interface Foo { { code: ` interface Foo { - a : Foo; - 'b.c' : Foo; - "b.d" : Foo; + a: Foo; + 'b.c': Foo; + 'b.d': Foo; } - `, + `, options: [{ default: { order: 'alphabetically' } }], }, @@ -64,13 +60,13 @@ interface Foo { { code: ` type Foo = { - a : b; - [a: string] : number; - b() : void; - () : Baz; - new () : Bar; -} - `, + a: b; + [a: string]: number; + b(): void; + (): Baz; + new (): Bar; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -78,10 +74,10 @@ type Foo = { { code: ` type Foo = { - A : b; - a : b; -} - `, + A: b; + a: b; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -89,10 +85,10 @@ type Foo = { { code: ` type Foo = { - a1 : b; - aa : b; -} - `, + a1: b; + aa: b; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -100,11 +96,11 @@ type Foo = { { code: ` type Foo = { - a : Foo; - 'b.c' : Foo; - "b.d" : Foo; -} - `, + a: Foo; + 'b.c': Foo; + 'b.d': Foo; +}; + `, options: [{ default: { order: 'alphabetically' } }], }, @@ -112,17 +108,17 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; constructor() {} @Dec() d: string; - public e : string = ""; - @Dec() f : string = ""; - protected g : string = ""; - private h : string = ""; + public e: string = ''; + @Dec() f: string = ''; + protected g: string = ''; + private h: string = ''; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -130,10 +126,10 @@ class Foo { { code: ` class Foo { - public static A : string; - public static a : string; + public static A: string; + public static a: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -141,10 +137,10 @@ class Foo { { code: ` class Foo { - public static a1 : string; - public static aa : string; + public static a1: string; + public static aa: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -152,15 +148,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; -} - `, + public d: string = ''; + protected e: string = ''; + private f: string = ''; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -168,10 +164,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static A : string; - public static a : string; -} - `, + public static A: string; + public static a: string; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -179,10 +175,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a1 : string; - public static aa : string; -} - `, + public static a1: string; + public static aa: string; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -190,11 +186,11 @@ const foo = class Foo { { code: ` class Foo { - public static a : string; - @Dec() static b : string; - public static c : string; + public static a: string; + @Dec() static b: string; + public static c: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -217,13 +213,13 @@ class Foo { { code: ` interface Foo { - b() : void; - a : b; - [a: string] : number; - new () : Bar; - () : Baz; + b(): void; + a: b; + [a: string]: number; + new (): Bar; + (): Baz; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -247,11 +243,11 @@ interface Foo { { code: ` interface Foo { - "b.d" : Foo; - 'b.c' : Foo; - a : Foo; + 'b.d': Foo; + 'b.c': Foo; + a: Foo; } - `, + `, options: [{ default: { order: 'alphabetically' } }], errors: [ { @@ -275,11 +271,11 @@ interface Foo { { code: ` interface Foo { - c : string; - b : string; - a : string; + c: string; + b: string; + a: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -303,13 +299,13 @@ interface Foo { { code: ` type Foo = { - b() : void; - a : b; - [a: string] : number; - new () : Bar; - () : Baz; -} - `, + b(): void; + a: b; + [a: string]: number; + new (): Bar; + (): Baz; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -333,11 +329,11 @@ type Foo = { { code: ` type Foo = { - "b.d" : Foo; - 'b.c' : Foo; - a : Foo; -} - `, + 'b.d': Foo; + 'b.c': Foo; + a: Foo; +}; + `, options: [{ default: { order: 'alphabetically' } }], errors: [ { @@ -361,11 +357,11 @@ type Foo = { { code: ` type Foo = { - c : string; - b : string; - a : string; -} - `, + c: string; + b: string; + a: string; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -389,15 +385,15 @@ type Foo = { { code: ` class Foo { - protected static b : string = ""; - public static a : string; - private static c : string = ""; + protected static b: string = ''; + public static a: string; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -418,7 +414,7 @@ class Foo { public static b: string; public static a: string; } - `, + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -442,15 +438,15 @@ class Foo { { code: ` const foo = class Foo { - protected static b : string = ""; - public static a : string; - private static c : string = ""; + protected static b: string = ''; + public static a: string; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; -} - `, + public d: string = ''; + protected e: string = ''; + private f: string = ''; +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -470,8 +466,8 @@ const foo = class Foo { public static c: string; public static b: string; public static a: string; -} - `, +}; + `, options: [{ default: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -493,22 +489,19 @@ const foo = class Foo { ], }; -const sortedWithoutGroupingClassesOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithoutGroupingClassesOption: RunTests = { valid: [ // classes option + interface + multiple types --> Only member group order is checked (default config) { code: ` interface Foo { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -516,10 +509,10 @@ interface Foo { { code: ` interface Foo { - a : b; - A : b; + a: b; + A: b; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -527,10 +520,10 @@ interface Foo { { code: ` interface Foo { - aa : b; - a1 : b; + aa: b; + a1: b; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -538,13 +531,13 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; -} - `, + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -552,10 +545,10 @@ type Foo = { { code: ` type Foo = { - a : b; - A : b; -} - `, + a: b; + A: b; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -563,10 +556,10 @@ type Foo = { { code: ` type Foo = { - aa : b; - a1 : b; -} - `, + aa: b; + a1: b; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -574,16 +567,16 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - @Dec() private static c : string = ""; + public static a: string; + protected static b: string = ''; + @Dec() private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; + public d: string = ''; + protected e: string = ''; @Dec() - private f : string = ""; + private f: string = ''; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -591,10 +584,10 @@ class Foo { { code: ` class Foo { - public static A : string; - public static a : string; + public static A: string; + public static a: string; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -602,10 +595,10 @@ class Foo { { code: ` class Foo { - public static a1 : string; - public static aa : string; + public static a1: string; + public static aa: string; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -613,15 +606,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -629,10 +622,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a : string; - public static A : string; -} - `, + public static a: string; + public static A: string; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, @@ -640,10 +633,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static aa : string; - public static a1 : string; -} - `, + public static aa: string; + public static a1: string; +}; + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], }, ], @@ -652,15 +645,15 @@ const foo = class Foo { { code: ` class Foo { - protected static b : string = ""; - public static a : string; - private static c : string = ""; + protected static b: string = ''; + public static a: string; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -681,7 +674,7 @@ class Foo { public static b: string; public static a: string; } - `, + `, options: [{ classes: { memberTypes: 'never', order: 'alphabetically' } }], errors: [ { @@ -703,7 +696,7 @@ class Foo { ], }; -const sortedWithoutGroupingClassExpressionsOption: TSESLint.RunTests< +const sortedWithoutGroupingClassExpressionsOption: RunTests< MessageIds, Options > = { @@ -712,13 +705,13 @@ const sortedWithoutGroupingClassExpressionsOption: TSESLint.RunTests< { code: ` interface Foo { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -728,10 +721,10 @@ interface Foo { { code: ` interface Foo { - a : b; - A : b; + a: b; + A: b; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -741,10 +734,10 @@ interface Foo { { code: ` interface Foo { - aa : b; - a1 : b; + aa: b; + a1: b; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -754,13 +747,13 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; -} - `, + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -770,10 +763,10 @@ type Foo = { { code: ` type Foo = { - a : b; - A : b; -} - `, + a: b; + A: b; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -783,10 +776,10 @@ type Foo = { { code: ` type Foo = { - aa : b; - a1 : b; -} - `, + aa: b; + a1: b; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -796,15 +789,15 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -814,10 +807,10 @@ class Foo { { code: ` class Foo { - public static a : string; - public static A : string; + public static a: string; + public static A: string; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -827,10 +820,10 @@ class Foo { { code: ` class Foo { - public static aa : string; - public static a1 : string; + public static aa: string; + public static a1: string; } - `, + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -840,15 +833,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; -} - `, + public d: string = ''; + protected e: string = ''; + private f: string = ''; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -858,10 +851,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static A : string; - public static a : string; -} - `, + public static A: string; + public static a: string; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -871,10 +864,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a1 : string; - public static aa : string; -} - `, + public static a1: string; + public static aa: string; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -885,15 +878,15 @@ const foo = class Foo { { code: ` const foo = class Foo { - protected static b : string = ""; - public static a : string; - private static c : string = ""; + protected static b: string = ''; + public static a: string; + private static c: string = ''; constructor() {} - public d : string = ""; - protected e : string = ""; - private f : string = ""; -} - `, + public d: string = ''; + protected e: string = ''; + private f: string = ''; +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -915,8 +908,8 @@ const foo = class Foo { public static c: string; public static b: string; public static a: string; -} - `, +}; + `, options: [ { classExpressions: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -940,22 +933,19 @@ const foo = class Foo { ], }; -const sortedWithoutGroupingInterfacesOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithoutGroupingInterfacesOption: RunTests = { valid: [ // interfaces option + interface + multiple types { code: ` interface Foo { - [a: string] : number; - a : b; - b() : void; - () : Baz; - new () : Bar; + [a: string]: number; + a: b; + b(): void; + (): Baz; + new (): Bar; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -965,10 +955,10 @@ interface Foo { { code: ` interface Foo { - A : b; - a : b; + A: b; + a: b; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -978,10 +968,10 @@ interface Foo { { code: ` interface Foo { - a1 : b; - aa : b; + a1: b; + aa: b; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -991,13 +981,13 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; -} - `, + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1007,10 +997,10 @@ type Foo = { { code: ` type Foo = { - a : b; - A : b; -} - `, + a: b; + A: b; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1020,10 +1010,10 @@ type Foo = { { code: ` type Foo = { - aa : b; - a1 : b; -} - `, + aa: b; + a1: b; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1033,15 +1023,15 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1051,10 +1041,10 @@ class Foo { { code: ` class Foo { - public static a : string; - public static A : string; + public static a: string; + public static A: string; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1064,10 +1054,10 @@ class Foo { { code: ` class Foo { - public static aa : string; - public static a1 : string; + public static aa: string; + public static a1: string; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1077,15 +1067,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1095,10 +1085,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a : string; - public static A : string; -} - `, + public static a: string; + public static A: string; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1108,10 +1098,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static aa : string; - public static a1 : string; -} - `, + public static aa: string; + public static a1: string; +}; + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1122,13 +1112,13 @@ const foo = class Foo { { code: ` interface Foo { - b() : void; - a : b; - [a: string] : number; - new () : Bar; - () : Baz; + b(): void; + a: b; + [a: string]: number; + new (): Bar; + (): Baz; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1154,11 +1144,11 @@ interface Foo { { code: ` interface Foo { - c : string; - b : string; - a : string; + c: string; + b: string; + a: string; } - `, + `, options: [ { interfaces: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1182,22 +1172,19 @@ interface Foo { ], }; -const sortedWithoutGroupingTypeLiteralsOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithoutGroupingTypeLiteralsOption: RunTests = { valid: [ // typeLiterals option + interface + multiple types --> Only member group order is checked (default config) { code: ` interface Foo { - [a: string] : number; - () : Baz; - c : b; - new () : Bar; - b() : void; + [a: string]: number; + (): Baz; + c: b; + new (): Bar; + b(): void; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1207,10 +1194,10 @@ interface Foo { { code: ` interface Foo { - a : b; - A : b; + a: b; + A: b; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1220,10 +1207,10 @@ interface Foo { { code: ` interface Foo { - aa : b; - a1 : b; + aa: b; + a1: b; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1233,13 +1220,13 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; - a : b; - b() : void; - () : Baz; - new () : Bar; -} - `, + [a: string]: number; + a: b; + b(): void; + (): Baz; + new (): Bar; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1249,10 +1236,10 @@ type Foo = { { code: ` type Foo = { - A : b; - a : b; -} - `, + A: b; + a: b; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1262,10 +1249,10 @@ type Foo = { { code: ` type Foo = { - a1 : b; - aa : b; -} - `, + a1: b; + aa: b; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1275,15 +1262,15 @@ type Foo = { { code: ` class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1293,10 +1280,10 @@ class Foo { { code: ` class Foo { - public static a : string; - public static A : string; + public static a: string; + public static A: string; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1306,10 +1293,10 @@ class Foo { { code: ` class Foo { - public static aa : string; - public static a1 : string; + public static aa: string; + public static a1: string; } - `, + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1319,15 +1306,15 @@ class Foo { { code: ` const foo = class Foo { - public static a : string; - protected static b : string = ""; - private static c : string = ""; - public d : string = ""; - protected e : string = ""; - private f : string = ""; + public static a: string; + protected static b: string = ''; + private static c: string = ''; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1337,10 +1324,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static a : string; - public static A : string; -} - `, + public static a: string; + public static A: string; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1350,10 +1337,10 @@ const foo = class Foo { { code: ` const foo = class Foo { - public static aa : string; - public static a1 : string; -} - `, + public static aa: string; + public static a1: string; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1364,13 +1351,13 @@ const foo = class Foo { { code: ` type Foo = { - b() : void; - a : b; - [a: string] : number; - new () : Bar; - () : Baz; -} - `, + b(): void; + a: b; + [a: string]: number; + new (): Bar; + (): Baz; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1396,11 +1383,11 @@ type Foo = { { code: ` type Foo = { - c : string; - b : string; - a : string; -} - `, + c: string; + b: string; + a: string; +}; + `, options: [ { typeLiterals: { memberTypes: 'never', order: 'alphabetically' } }, ], @@ -1424,145 +1411,144 @@ type Foo = { ], }; -const sortedWithGroupingDefaultOption: TSESLint.RunTests = - { - valid: [ - // default option + interface + default order + alphabetically - { - code: ` +const sortedWithGroupingDefaultOption: RunTests = { + valid: [ + // default option + interface + default order + alphabetically + { + code: ` interface Foo { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + interface + custom order + alphabetically - { - code: ` + // default option + interface + custom order + alphabetically + { + code: ` interface Foo { - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - [a: string] : number; - () : Baz; + [a: string]: number; + (): Baz; } - `, - options: [ - { - default: { - memberTypes: ['constructor', 'method', 'field'], - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + type literal + default order + alphabetically - { - code: ` + // default option + type literal + default order + alphabetically + { + code: ` type Foo = { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + a(): void; + b(): void; + c(): void; +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + type literal + custom order + alphabetically - { - code: ` + // default option + type literal + custom order + alphabetically + { + code: ` type Foo = { - [a: string] : number; + [a: string]: number; - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - () : Baz; -} - `, - options: [ - { - default: { - memberTypes: ['constructor', 'method', 'field'], - order: 'alphabetically', - }, + (): Baz; +}; + `, + options: [ + { + default: { + memberTypes: ['constructor', 'method', 'field'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + class + default order + alphabetically - { - code: ` + // default option + class + default order + alphabetically + { + code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + class + defaultOrder + alphabetically - { - code: ` + // default option + class + defaultOrder + alphabetically + { + code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} @@ -1570,20 +1556,20 @@ class Foo { set g() {} } - `, - options: [ - { - default: { - memberTypes: defaultOrder, - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: defaultOrder, + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + class + custom + alphabetically - { - code: ` + // default option + class + custom + alphabetically + { + code: ` class Foo { get a() {} @@ -1595,141 +1581,144 @@ class Foo { @Bar set d() {} } - `, - options: [ - { - default: { - memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + class + decorators + default order + alphabetically - { - code: ` + // default option + class + decorators + default order + alphabetically + { + code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; @Dec() public d: string; @Dec() protected e: string; @Dec() private f: string; - public g: string = ""; - protected h: string = ""; - private i: string = ""; + public g: string = ''; + protected h: string = ''; + private i: string = ''; constructor() {} } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + class + custom order + alphabetically - { - code: ` + // default option + class + custom order + alphabetically + { + code: ` class Foo { constructor() {} - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; } - `, - options: [ - { - default: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: ['constructor', 'instance-field', 'static-field'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + class expression + default order + alphabetically - { - code: ` + // default option + class expression + default order + alphabetically + { + code: ` const foo = class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + }, - // default option + class expression + custom order + alphabetically - { - code: ` + // default option + class expression + custom order + alphabetically + { + code: ` const foo = class Foo { constructor() {} - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; -} - `, - options: [ - { - default: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', - }, + protected static b: string = ''; + private static c: string = ''; +}; + `, + options: [ + { + default: { + memberTypes: ['constructor', 'instance-field', 'static-field'], + order: 'alphabetically', }, - ], - }, + }, + ], + }, - // default option + static blocks; should always be valid - { - code: ` + // default option + static blocks; should always be valid + { + code: ` class Foo { static {} static {} } - `, - options: [ - { - default: { - memberTypes: 'never', - order: 'alphabetically', - }, - }, - ], + `, + dependencyConstraints: { + typescript: '4.4', }, - ], - invalid: [ - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` + options: [ + { + default: { + memberTypes: 'never', + order: 'alphabetically', + }, + }, + ], + }, + ], + invalid: [ + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` class FooTestGetter { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; get h() {} @@ -1737,29 +1726,29 @@ class FooTestGetter { constructor() {} } - `, - options: [ - { - default: { - memberTypes: defaultOrder, - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: defaultOrder, + order: 'alphabetically', }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'constructor', - rank: 'public instance get', - }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'constructor', + rank: 'public instance get', }, - ], - }, + }, + ], + }, - // default option + class + custom + alphabetically - { - code: ` + // default option + class + custom + alphabetically + { + code: ` class Foo { @Bar get a() {} @@ -1771,44 +1760,44 @@ class Foo { set d() {} } - `, - options: [ - { - default: { - memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: ['get', 'decorated-get', 'set', 'decorated-set'], + order: 'alphabetically', }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'b', - rank: 'decorated get', - }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'b', + rank: 'decorated get', }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'decorated set', - }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'decorated set', }, - ], - }, + }, + ], + }, - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` class FooTestGetter { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; set g() {} @@ -1816,489 +1805,341 @@ class FooTestGetter { get h() {} } - `, - options: [ - { - default: { - memberTypes: defaultOrder, - order: 'alphabetically', - }, + `, + options: [ + { + default: { + memberTypes: defaultOrder, + order: 'alphabetically', }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'constructor', - rank: 'public instance set', - }, + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'constructor', + rank: 'public instance set', }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'h', - rank: 'public instance set', - }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'h', + rank: 'public instance set', }, - ], - }, + }, + ], + }, - // default option + interface + wrong order within group and wrong group order + alphabetically - { - code: ` + // default option + interface + wrong order within group and wrong group order + alphabetically + { + code: ` interface Foo { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; + new (): Bar; } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'call', - rank: 'field', - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'call', + rank: 'field', }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'new', - rank: 'method', - }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'new', + rank: 'method', }, - ], - }, + }, + ], + }, - // default option + type literal + wrong order within group and wrong group order + alphabetically - { - code: ` + // default option + type literal + wrong order within group and wrong group order + alphabetically + { + code: ` type Foo = { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'call', - rank: 'field', - }, - }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'new', - rank: 'method', - }, - }, - ], - }, - - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` -class Foo { - public static c: string = ""; - public static b: string = ""; - public static a: string; - - constructor() {} - - public d: string = ""; -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'public constructor', - }, - }, - ], - }, - - // default option + class expression + wrong order within group and wrong group order + alphabetically - { - code: ` -const foo = class Foo { - public static c: string = ""; - public static b: string = ""; - public static a: string; - - constructor() {} - - public d: string = ""; -} - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'public constructor', - }, - }, - ], - }, - // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically - { - code: ` -class Foo { - @Dec() a1: string; - @Dec() - a3: string; - @Dec() - a2: string; - - constructor() {} - - b1: string; - b2: string; - - public c(): void; - @Dec() d(): void -} - `, - options: [ - { - default: { - memberTypes: [ - 'decorated-field', - 'field', - 'constructor', - 'decorated-method', - ], - order: 'alphabetically', - }, - }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'b1', - rank: 'constructor', - }, + new (): Bar; +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'call', + rank: 'field', }, - { - messageId: 'incorrectGroupOrder', - data: { - name: 'b2', - rank: 'constructor', - }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'new', + rank: 'method', }, - ], - }, - ], - }; - -const sortedWithGroupingClassesOption: TSESLint.RunTests = - { - valid: [ - // classes option + interface + alphabetically --> Default order applies - { - code: ` -interface Foo { - [a: string] : number; - - () : Baz; - - c : x; - b : x; - a : x; - - new () : Bar; - - c() : void; - b() : void; - a() : void; -} - `, - options: [{ classes: { order: 'alphabetically' } }], - }, - - // classes option + type literal + alphabetically --> Default order applies - { - code: ` -type Foo = { - [a: string] : number; - - () : Baz; - - c : x; - b : x; - a : x; - - new () : Bar; - - c() : void; - b() : void; - a() : void; -} - `, - options: [{ classes: { order: 'alphabetically' } }], - }, + }, + ], + }, - // classes option + class + default order + alphabetically - { - code: ` + // default option + class + wrong order within group and wrong group order + alphabetically + { + code: ` class Foo { + public static c: string = ''; + public static b: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; - - public d: string = ""; - protected e: string = ""; - private f: string = ""; - - constructor() {} -} - `, - options: [ - { classes: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - }, - - // classes option + class + custom order + alphabetically - { - code: ` -class Foo { - constructor() {} - public d: string = ""; - protected e: string = ""; - private f: string = ""; + constructor() {} - public static a: string; - protected static b: string = ""; - private static c: string = ""; + public d: string = ''; } - `, - options: [ - { - classes: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', - }, + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'public constructor', }, - ], - }, + }, + ], + }, - // classes option + class expression + alphabetically --> Default order applies - { - code: ` + // default option + class expression + wrong order within group and wrong group order + alphabetically + { + code: ` const foo = class Foo { + public static c: string = ''; + public static b: string = ''; public static a: string; - protected static b: string = ""; - private static c: string = ""; - - public d: string = ""; - protected e: string = ""; - private f: string = ""; constructor() {} -} - `, - options: [{ classes: { order: 'alphabetically' } }], - }, - ], - invalid: [ - // default option + class + wrong order within group and wrong group order + alphabetically - { - code: ` + + public d: string = ''; +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'public constructor', + }, + }, + ], + }, + // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically + { + code: ` class Foo { - public static c: string = ""; - public static b: string = ""; - public static a: string; + @Dec() a1: string; + @Dec() + a3: string; + @Dec() + a2: string; constructor() {} - public d: string = ""; + b1: string; + b2: string; + + public c(): void; + @Dec() d(): void; } - `, - options: [ - { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, - ], - errors: [ - { - messageId: 'incorrectGroupOrder', - data: { - name: 'd', - rank: 'public constructor', - }, + `, + options: [ + { + default: { + memberTypes: [ + 'decorated-field', + 'field', + 'constructor', + 'decorated-method', + ], + order: 'alphabetically', }, - ], - }, - ], - }; + }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'b1', + rank: 'constructor', + }, + }, + { + messageId: 'incorrectGroupOrder', + data: { + name: 'b2', + rank: 'constructor', + }, + }, + ], + }, + ], +}; -const sortedWithGroupingClassExpressionsOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithGroupingClassesOption: RunTests = { valid: [ - // classExpressions option + interface + alphabetically --> Default order applies + // classes option + interface + alphabetically --> Default order applies { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - c : x; - b : x; - a : x; + c: x; + b: x; + a: x; - new () : Bar; + new (): Bar; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; } - `, - options: [{ classExpressions: { order: 'alphabetically' } }], + `, + options: [{ classes: { order: 'alphabetically' } }], }, - // classExpressions option + type literal + alphabetically --> Default order applies + // classes option + type literal + alphabetically --> Default order applies { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - c : x; - b : x; - a : x; + c: x; + b: x; + a: x; - new () : Bar; + new (): Bar; - c() : void; - b() : void; - a() : void; -} - `, - options: [{ classExpressions: { order: 'alphabetically' } }], + c(): void; + b(): void; + a(): void; +}; + `, + options: [{ classes: { order: 'alphabetically' } }], }, - // classExpressions option + class + alphabetically --> Default order applies + // classes option + class + default order + alphabetically { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, - options: [{ classExpressions: { order: 'alphabetically' } }], + `, + options: [ + { classes: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], }, - // classExpressions option + class expression + default order + alphabetically + // classes option + class + custom order + alphabetically { code: ` -const foo = class Foo { - public static a: string; - protected static b: string = ""; - private static c: string = ""; +class Foo { + constructor() {} - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; - constructor() {} + public static a: string; + protected static b: string = ''; + private static c: string = ''; } - `, + `, options: [ { - classExpressions: { - memberTypes: defaultOrder, + classes: { + memberTypes: ['constructor', 'instance-field', 'static-field'], order: 'alphabetically', }, }, ], }, - // classExpressions option + class expression + custom order + alphabetically + // classes option + class expression + alphabetically --> Default order applies { code: ` const foo = class Foo { - constructor() {} + public static a: string; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; - public static a: string; - protected static b: string = ""; - private static c: string = ""; -} - `, - options: [ - { - classExpressions: { - memberTypes: ['constructor', 'instance-field', 'static-field'], - order: 'alphabetically', - }, - }, - ], + constructor() {} +}; + `, + options: [{ classes: { order: 'alphabetically' } }], }, ], invalid: [ - // default option + class expression + wrong order within group and wrong group order + alphabetically + // default option + class + wrong order within group and wrong group order + alphabetically { code: ` -const foo = class Foo { - public static c: string = ""; - public static b: string = ""; +class Foo { + public static c: string = ''; + public static b: string = ''; public static a: string; constructor() {} - public d: string = ""; + public d: string = ''; } - `, + `, options: [ { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], @@ -2315,30 +2156,172 @@ const foo = class Foo { ], }; -const sortedWithGroupingInterfacesOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithGroupingClassExpressionsOption: RunTests = + { + valid: [ + // classExpressions option + interface + alphabetically --> Default order applies + { + code: ` +interface Foo { + [a: string]: number; + + (): Baz; + + c: x; + b: x; + a: x; + + new (): Bar; + + c(): void; + b(): void; + a(): void; +} + `, + options: [{ classExpressions: { order: 'alphabetically' } }], + }, + + // classExpressions option + type literal + alphabetically --> Default order applies + { + code: ` +type Foo = { + [a: string]: number; + + (): Baz; + + c: x; + b: x; + a: x; + + new (): Bar; + + c(): void; + b(): void; + a(): void; +}; + `, + options: [{ classExpressions: { order: 'alphabetically' } }], + }, + + // classExpressions option + class + alphabetically --> Default order applies + { + code: ` +class Foo { + public static a: string; + protected static b: string = ''; + private static c: string = ''; + + public d: string = ''; + protected e: string = ''; + private f: string = ''; + + constructor() {} +} + `, + options: [{ classExpressions: { order: 'alphabetically' } }], + }, + + // classExpressions option + class expression + default order + alphabetically + { + code: ` +const foo = class Foo { + public static a: string; + protected static b: string = ''; + private static c: string = ''; + + public d: string = ''; + protected e: string = ''; + private f: string = ''; + + constructor() {} +}; + `, + options: [ + { + classExpressions: { + memberTypes: defaultOrder, + order: 'alphabetically', + }, + }, + ], + }, + + // classExpressions option + class expression + custom order + alphabetically + { + code: ` +const foo = class Foo { + constructor() {} + + public d: string = ''; + protected e: string = ''; + private f: string = ''; + + public static a: string; + protected static b: string = ''; + private static c: string = ''; +}; + `, + options: [ + { + classExpressions: { + memberTypes: ['constructor', 'instance-field', 'static-field'], + order: 'alphabetically', + }, + }, + ], + }, + ], + invalid: [ + // default option + class expression + wrong order within group and wrong group order + alphabetically + { + code: ` +const foo = class Foo { + public static c: string = ''; + public static b: string = ''; + public static a: string; + + constructor() {} + + public d: string = ''; +}; + `, + options: [ + { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, + ], + errors: [ + { + messageId: 'incorrectGroupOrder', + data: { + name: 'd', + rank: 'public constructor', + }, + }, + ], + }, + ], + }; + +const sortedWithGroupingInterfacesOption: RunTests = { valid: [ // interfaces option + interface + default order + alphabetically { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - new () : Bar; + new (): Bar; - () : Baz; + (): Baz; } - `, + `, options: [ { interfaces: { @@ -2353,20 +2336,20 @@ interface Foo { { code: ` interface Foo { - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - [a: string] : number; - () : Baz; + [a: string]: number; + (): Baz; } - `, + `, options: [ { interfaces: { @@ -2381,21 +2364,21 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - c : x; - b : x; - a : x; + c: x; + b: x; + a: x; - new () : Bar; + new (): Bar; - c() : void; - b() : void; - a() : void; -} - `, + c(): void; + b(): void; + a(): void; +}; + `, options: [{ interfaces: { order: 'alphabetically' } }], }, @@ -2404,16 +2387,16 @@ type Foo = { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [{ interfaces: { order: 'alphabetically' } }], }, @@ -2422,16 +2405,16 @@ class Foo { code: ` const foo = class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [{ interfaces: { order: 'alphabetically' } }], }, ], @@ -2440,21 +2423,21 @@ const foo = class Foo { { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; + new (): Bar; } - `, + `, options: [ { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], @@ -2478,30 +2461,27 @@ interface Foo { ], }; -const sortedWithGroupingTypeLiteralsOption: TSESLint.RunTests< - MessageIds, - Options -> = { +const sortedWithGroupingTypeLiteralsOption: RunTests = { valid: [ // typeLiterals option + interface + alphabetically --> Default order applies { code: ` interface Foo { - [a: string] : number; + [a: string]: number; - () : Baz; + (): Baz; - c : x; - b : x; - a : x; + c: x; + b: x; + a: x; - new () : Bar; + new (): Bar; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; } - `, + `, options: [{ typeLiterals: { order: 'alphabetically' } }], }, @@ -2509,21 +2489,21 @@ interface Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - new () : Bar; + new (): Bar; - () : Baz; -} - `, + (): Baz; +}; + `, options: [ { typeLiterals: { @@ -2538,20 +2518,20 @@ type Foo = { { code: ` type Foo = { - new () : Bar; + new (): Bar; - a() : void; - b() : void; - c() : void; + a(): void; + b(): void; + c(): void; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - [a: string] : number; - () : Baz; -} - `, + [a: string]: number; + (): Baz; +}; + `, options: [ { typeLiterals: { @@ -2567,16 +2547,16 @@ type Foo = { code: ` class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} } - `, + `, options: [{ typeLiterals: { order: 'alphabetically' } }], }, @@ -2585,16 +2565,16 @@ class Foo { code: ` const foo = class Foo { public static a: string; - protected static b: string = ""; - private static c: string = ""; + protected static b: string = ''; + private static c: string = ''; - public d: string = ""; - protected e: string = ""; - private f: string = ""; + public d: string = ''; + protected e: string = ''; + private f: string = ''; constructor() {} -} - `, +}; + `, options: [{ typeLiterals: { order: 'alphabetically' } }], }, ], @@ -2603,21 +2583,21 @@ const foo = class Foo { { code: ` type Foo = { - [a: string] : number; + [a: string]: number; - a : x; - b : x; - c : x; + a: x; + b: x; + c: x; - c() : void; - b() : void; - a() : void; + c(): void; + b(): void; + a(): void; - () : Baz; + (): Baz; - new () : Bar; -} - `, + new (): Bar; +}; + `, options: [ { default: { memberTypes: defaultOrder, order: 'alphabetically' } }, ], @@ -2667,7 +2647,7 @@ class Foo { ], }; -const sortedWithoutGrouping = { +const sortedWithoutGrouping: RunTests = { valid: [ ...sortedWithoutGroupingDefaultOption.valid, ...sortedWithoutGroupingClassesOption.valid, @@ -2684,7 +2664,7 @@ const sortedWithoutGrouping = { ], }; -const sortedWithGrouping = { +const sortedWithGrouping: RunTests = { valid: [ ...sortedWithGroupingDefaultOption.valid, ...sortedWithGroupingClassesOption.valid, diff --git a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts index d2a88e9c02b..d9db8f5d6eb 100644 --- a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts +++ b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts @@ -32,22 +32,42 @@ interface Test { 'f!': (/* b */ x: any /* c */) => void; } `, - ` + { + code: ` interface Test { get f(): number; } - `, - ` + `, + dependencyConstraints: { + typescript: '4.3', + }, + }, + { + code: ` interface Test { set f(value: number): void; } - `, + `, + dependencyConstraints: { + typescript: '4.3', + }, + }, 'type Test = { readonly f: (a: string) => number };', "type Test = { ['f']?: (a: boolean) => void };", 'type Test = { readonly f?: (a?: T) => T };', "type Test = { readonly ['f']?: (a: T, b: T) => T };", - 'type Test = { get f(): number };', - 'type Test = { set f(value: number): void };', + { + code: 'type Test = { get f(): number };', + dependencyConstraints: { + typescript: '4.3', + }, + }, + { + code: 'type Test = { set f(value: number): void };', + dependencyConstraints: { + typescript: '4.3', + }, + }, ...batchedSingleLineTests({ options: ['method'], code: noFormat` @@ -56,15 +76,23 @@ interface Test { interface Test { f(a: T): T } interface Test { ['f'](a: T, b: T): T } interface Test { 'f!'(/* b */ x: any /* c */): void } - interface Test { get f(): number } - interface Test { set f(value: number): void } type Test = { readonly f(a: string): number } type Test = { ['f']?(a: boolean): void } type Test = { readonly f?(a?: T): T } type Test = { readonly ['f']?(a: T, b: T): T } + `, + }), + ...batchedSingleLineTests({ + options: ['method'], + code: noFormat` + interface Test { get f(): number } + interface Test { set f(value: number): void } type Test = { get f(): number } type Test = { set f(value: number): void } `, + dependencyConstraints: { + typescript: '4.3', + }, }), ], invalid: [ diff --git a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts index 4c496b6c127..9917aec3cb7 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts @@ -768,6 +768,105 @@ ruleTester.run('naming-convention', rule, { }, ], }, + { + code: ` + const obj = { + Bar() { + return 42; + }, + async async_bar() { + return 42; + }, + }; + class foo { + public Bar() { + return 42; + } + public async async_bar() { + return 42; + } + } + abstract class foo { + public abstract Bar() { + return 42; + } + public abstract async async_bar() { + return 42; + } + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['method', 'objectLiteralMethod'], + format: ['snake_case'], + modifiers: ['async'], + }, + { + selector: 'method', + format: ['PascalCase'], + }, + ], + }, + { + code: ` + const async_bar1 = async () => {}; + async function async_bar2() {} + const async_bar3 = async function async_bar4() {}; + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: 'method', + format: ['PascalCase'], + }, + { + selector: ['variable'], + format: ['snake_case'], + modifiers: ['async'], + }, + ], + }, + { + code: ` + class foo extends bar { + public someAttribute = 1; + public override some_attribute_override = 1; + public someMethod() { + return 42; + } + public override some_method_override2() { + return 42; + } + } + abstract class foo extends bar { + public abstract someAttribute: string; + public abstract override some_attribute_override: string; + public abstract someMethod(): string; + public abstract override some_method_override2(): string; + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['memberLike'], + modifiers: ['override'], + format: ['snake_case'], + }, + ], + }, ], invalid: [ { @@ -1526,5 +1625,352 @@ ruleTester.run('naming-convention', rule, { // 6, not 7 because 'foo' is valid errors: Array(6).fill({ messageId: 'doesNotMatchFormat' }), }, + { + code: ` + class foo { + public Bar() { + return 42; + } + public async async_bar() { + return 42; + } + // โŒ error + public async asyncBar() { + return 42; + } + // โŒ error + public AsyncBar2 = async () => { + return 42; + }; + // โŒ error + public AsyncBar3 = async function () { + return 42; + }; + } + abstract class foo { + public abstract Bar(): number; + public abstract async async_bar(): number; + // โŒ error + public abstract async ASYNC_BAR(): number; + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: 'method', + format: ['PascalCase'], + }, + { + selector: ['method', 'objectLiteralMethod'], + format: ['snake_case'], + modifiers: ['async'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'asyncBar', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'AsyncBar2', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'AsyncBar3', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'ASYNC_BAR', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + const obj = { + Bar() { + return 42; + }, + async async_bar() { + return 42; + }, + // โŒ error + async AsyncBar() { + return 42; + }, + // โŒ error + AsyncBar2: async () => { + return 42; + }, + // โŒ error + AsyncBar3: async function () { + return 42; + }, + }; + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: 'method', + format: ['PascalCase'], + }, + { + selector: ['method', 'objectLiteralMethod'], + format: ['snake_case'], + modifiers: ['async'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Object Literal Method', + name: 'AsyncBar', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Object Literal Method', + name: 'AsyncBar2', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Object Literal Method', + name: 'AsyncBar3', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + const syncbar1 = () => {}; + function syncBar2() {} + const syncBar3 = function syncBar4() {}; + + // โŒ error + const AsyncBar1 = async () => {}; + const async_bar1 = async () => {}; + const async_bar3 = async function async_bar4() {}; + async function async_bar2() {} + // โŒ error + const asyncBar5 = async function async_bar6() {}; + `, + parserOptions, + options: [ + { + selector: 'variableLike', + format: ['camelCase'], + }, + { + selector: ['variableLike'], + modifiers: ['async'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Variable', + name: 'AsyncBar1', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Variable', + name: 'asyncBar5', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + const syncbar1 = () => {}; + function syncBar2() {} + const syncBar3 = function syncBar4() {}; + + const async_bar1 = async () => {}; + // โŒ error + async function asyncBar2() {} + const async_bar3 = async function async_bar4() {}; + async function async_bar2() {} + // โŒ error + const async_bar3 = async function ASYNC_BAR4() {}; + `, + parserOptions, + options: [ + { + selector: 'variableLike', + format: ['camelCase'], + }, + { + selector: ['variableLike'], + modifiers: ['async'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Function', + name: 'asyncBar2', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Function', + name: 'ASYNC_BAR4', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + class foo extends bar { + public someAttribute = 1; + public override some_attribute_override = 1; + // โŒ error + public override someAttributeOverride = 1; + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['memberLike'], + modifiers: ['override'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Property', + name: 'someAttributeOverride', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + class foo extends bar { + public override some_method_override() { + return 42; + } + // โŒ error + public override someMethodOverride() { + return 42; + } + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['memberLike'], + modifiers: ['override'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Class Method', + name: 'someMethodOverride', + formats: 'snake_case', + }, + }, + ], + }, + { + code: ` + class foo extends bar { + public get someGetter(): string; + public override get some_getter_override(): string; + // โŒ error + public override get someGetterOverride(): string; + public set someSetter(val: string); + public override set some_setter_override(val: string); + // โŒ error + public override set someSetterOverride(val: string); + } + `, + parserOptions, + options: [ + { + selector: 'memberLike', + format: ['camelCase'], + }, + { + selector: ['memberLike'], + modifiers: ['override'], + format: ['snake_case'], + }, + ], + errors: [ + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Accessor', + name: 'someGetterOverride', + formats: 'snake_case', + }, + }, + { + messageId: 'doesNotMatchFormat', + data: { + type: 'Accessor', + name: 'someSetterOverride', + formats: 'snake_case', + }, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-empty-function.test.ts b/packages/eslint-plugin/tests/rules/no-empty-function.test.ts index 7d29b0fa5a2..7f35c79852c 100644 --- a/packages/eslint-plugin/tests/rules/no-empty-function.test.ts +++ b/packages/eslint-plugin/tests/rules/no-empty-function.test.ts @@ -78,6 +78,9 @@ class Foo extends Base { override foo() {} } `, + dependencyConstraints: { + typescript: '4.3', + }, options: [{ allow: ['overrideMethods'] }], }, ], @@ -206,6 +209,9 @@ class Foo extends Base { override foo() {} } `, + dependencyConstraints: { + typescript: '4.3', + }, errors: [ { messageId: 'unexpected', diff --git a/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts b/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts index 0d7f73342b5..893deaf01d6 100644 --- a/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts +++ b/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts @@ -34,6 +34,18 @@ interface Bar extends Foo {} `, options: [{ allowSingleExtends: true }], }, + { + code: ` +interface Foo { + props: string; +} + +interface Bar extends Foo {} + +class Bar {} + `, + options: [{ allowSingleExtends: true }], + }, ], invalid: [ { @@ -58,6 +70,82 @@ interface Bar extends Foo {} }, { code: ` +interface Foo { + props: string; +} + +interface Bar extends Foo {} + +class Baz {} + `, + output: ` +interface Foo { + props: string; +} + +type Bar = Foo + +class Baz {} + `, + options: [{ allowSingleExtends: false }], + errors: [ + { + messageId: 'noEmptyWithSuper', + line: 6, + column: 11, + }, + ], + }, + { + code: ` +interface Foo { + props: string; +} + +interface Bar extends Foo {} + +class Bar {} + `, + options: [{ allowSingleExtends: false }], + errors: [ + { + messageId: 'noEmptyWithSuper', + line: 6, + column: 11, + }, + ], + output: null, + }, + { + code: ` +interface Foo { + props: string; +} + +interface Bar extends Foo {} + +const bar = class Bar {}; + `, + output: ` +interface Foo { + props: string; +} + +type Bar = Foo + +const bar = class Bar {}; + `, + options: [{ allowSingleExtends: false }], + errors: [ + { + messageId: 'noEmptyWithSuper', + line: 6, + column: 11, + }, + ], + }, + { + code: ` interface Foo { name: string; } diff --git a/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts b/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts index 6a9e87111aa..369f55101f2 100644 --- a/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts @@ -141,6 +141,10 @@ t.true((me.get as SinonStub).calledWithExactly('/foo', other)); t.true((me.get).calledWithExactly('/foo', other)); (requestInit.headers as Headers).get('Cookie'); ( requestInit.headers).get('Cookie'); +class Foo {} +class Foo extends (Bar as any) {} +const foo = class {}; +const foo = class extends (Bar as any) {} `, parserOptions: { ecmaFeatures: { @@ -254,6 +258,10 @@ new a((1)); a<(A)>((1)); async function f(arg: Promise) { await (arg); } async function f(arg: any) { await ((arg as Promise)); } +class Foo extends ((Bar as any)) {} +class Foo extends (Bar) {} +const foo = class extends ((Bar as any)) {} +const foo = class extends (Bar) {} `, output: ` a = b * c; @@ -267,6 +275,10 @@ new a(1); a<(A)>(1); async function f(arg: Promise) { await arg; } async function f(arg: any) { await (arg as Promise); } +class Foo extends (Bar as any) {} +class Foo extends Bar {} +const foo = class extends (Bar as any) {} +const foo = class extends Bar {} `, errors: [ { @@ -324,6 +336,26 @@ async function f(arg: any) { await (arg as Promise); } line: 12, column: 37, }, + { + messageId: 'unexpected', + line: 13, + column: 20, + }, + { + messageId: 'unexpected', + line: 14, + column: 19, + }, + { + messageId: 'unexpected', + line: 15, + column: 28, + }, + { + messageId: 'unexpected', + line: 16, + column: 27, + }, ], }), ...batchedSingleLineTests({ diff --git a/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts b/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts index 8164e85b2bd..1a972b665be 100644 --- a/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts +++ b/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts @@ -316,7 +316,7 @@ ruleTester.run('allowInGenericTypeArguments: true', rule, { code: 'type UnionType2 = string | number | void;', errors: [ { - messageId: 'invalidVoidNotReturnOrGeneric', + messageId: 'invalidVoidUnionConstituent', line: 1, column: 37, }, @@ -326,12 +326,32 @@ ruleTester.run('allowInGenericTypeArguments: true', rule, { code: 'type UnionType3 = string | ((number & any) | (string | void));', errors: [ { - messageId: 'invalidVoidNotReturnOrGeneric', + messageId: 'invalidVoidUnionConstituent', line: 1, column: 56, }, ], }, + { + code: 'declare function test(): number | void;', + errors: [ + { + messageId: 'invalidVoidUnionConstituent', + line: 1, + column: 35, + }, + ], + }, + { + code: 'declare function test(): T;', + errors: [ + { + messageId: 'invalidVoidUnionConstituent', + line: 1, + column: 42, + }, + ], + }, { code: 'type IntersectionType = string & number & void;', errors: [ @@ -394,7 +414,7 @@ ruleTester.run('allowInGenericTypeArguments: true', rule, { code: 'type invalidVoidUnion = void | Map;', errors: [ { - messageId: 'invalidVoidNotReturnOrGeneric', + messageId: 'invalidVoidUnionConstituent', line: 1, column: 25, }, diff --git a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts index 3be7590742a..d6aa21a799e 100644 --- a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts +++ b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts @@ -536,6 +536,9 @@ type Foo = { [K in keyof Other]: \`\${K & number}\`; }; `, + dependencyConstraints: { + typescript: '4.1', + }, options: [{ ignoreTypeIndexes: true }], errors: [ { diff --git a/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts b/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts index 454fb255f0e..29259f4b3f0 100644 --- a/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts +++ b/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts @@ -154,11 +154,21 @@ ruleTester.run('no-redundant-type-constituents', rule, { type B = string; type T = B & null; `, - 'type T = `${string}` & null;', - ` - type B = \`\${string}\`; - type T = B & null; - `, + { + code: 'type T = `${string}` & null;', + dependencyConstraints: { + typescript: '4.1', + }, + }, + { + code: ` + type B = \`\${string}\`; + type T = B & null; + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, ], invalid: [ @@ -442,6 +452,9 @@ ruleTester.run('no-redundant-type-constituents', rule, { }, { code: 'type T = `a${number}c` | string;', + dependencyConstraints: { + typescript: '4.1', + }, errors: [ { column: 10, @@ -458,6 +471,9 @@ ruleTester.run('no-redundant-type-constituents', rule, { type B = \`a\${number}c\`; type T = B | string; `, + dependencyConstraints: { + typescript: '4.1', + }, errors: [ { column: 18, @@ -471,6 +487,9 @@ ruleTester.run('no-redundant-type-constituents', rule, { }, { code: 'type T = `${number}` | string;', + dependencyConstraints: { + typescript: '4.1', + }, errors: [ { column: 10, diff --git a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts index 1097f466a18..d55e85b3d8f 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts @@ -12,6 +12,25 @@ const ruleTester = new RuleTester({ ruleTester.run('no-shadow TS tests', rule, { valid: [ + 'function foo any>(arg: T) {}', + 'function foo any>(arg: T) {}', + 'function foo any>(arg: T) {}', + 'function foo any>(fn: T, args: any[]) {}', + 'function foo any>(fn: T, args: any[]) {}', + 'function foo any>(fn: T, ...args: any[]) {}', + 'function foo any>(fn: T, args: any[]) {}', + 'function foo any>(fn: T, args: any[]) {}', + 'function foo any>(fn: T, args: any) {}', + ` +function foo any>( + fn: T, + ...args: any[] +) {} + `, + ` +type Args = 1; +function foo void>(arg: T) {} + `, // nested conditional types ` export type ArrayInput = Func extends (arg0: Array) => any @@ -201,6 +220,9 @@ import { type foo } from './foo'; // 'foo' is already declared in the upper scope function doThing(foo: number) {} `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ ignoreTypeValueShadow: true }], }, { @@ -375,6 +397,22 @@ type T = 1; }, { code: ` +type T = 1; +function foo(arg: T) {} + `, + errors: [ + { + messageId: 'noShadow', + data: { + name: 'T', + shadowedLine: 2, + shadowedColumn: 6, + }, + }, + ], + }, + { + code: ` function foo() { return function () {}; } @@ -392,6 +430,22 @@ function foo() { }, { code: ` +type T = string; +function foo void>(arg: T) {} + `, + errors: [ + { + messageId: 'noShadow', + data: { + name: 'T', + shadowedLine: 2, + shadowedColumn: 6, + }, + }, + ], + }, + { + code: ` const x = 1; { type x = string; @@ -494,6 +548,9 @@ function doThing(foo: number) {} import { type foo } from './foo'; function doThing(foo: number) {} `, + dependencyConstraints: { + typescript: '4.5', + }, options: [{ ignoreTypeValueShadow: false }], errors: [ { @@ -621,6 +678,9 @@ declare module 'baz' { } } `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'noShadow', @@ -641,6 +701,9 @@ declare module 'bar' { export type Foo = string; } `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'noShadow', @@ -663,6 +726,9 @@ declare module 'bar' { } } `, + dependencyConstraints: { + typescript: '4.5', + }, errors: [ { messageId: 'noShadow', @@ -703,5 +769,29 @@ let y; }, ], }, + { + code: ` +function foo any>(fn: T, args: any[]) {} + `, + options: [ + { + ignoreTypeValueShadow: false, + builtinGlobals: true, + }, + ], + globals: { + args: 'writable', + }, + errors: [ + { + messageId: 'noShadowGlobal', + data: { + name: 'args', + shadowedLine: 2, + shadowedColumn: 5, + }, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts index 6a307454f51..ed2c00c9991 100644 --- a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts @@ -133,62 +133,107 @@ ruleTester.run('no-type-alias', rule, { }, { code: 'type Foo = `a-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` | `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` | `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { code: 'type Foo = `a-${number}` | `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions' }], }, { code: 'type Foo = `a-${number}` | `b-${number}` | `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` | `b-${number}` | `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { code: 'type Foo = `a-${number}` | `b-${number}` | `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions' }], }, { code: 'type Foo = `a-${number}` & `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` & `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { code: 'type Foo = `a-${number}` & `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-intersections' }], }, { code: 'type Foo = `a-${number}` & `b-${number}` & `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` & `b-${number}` & `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { code: 'type Foo = `a-${number}` & `b-${number}` & `c-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-intersections' }], }, { code: 'type Foo = `a-${number}` | (`b-${number}` & `c-${number}`);', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'always' }], }, { code: 'type Foo = `a-${number}` | (`b-${number}` & `c-${number}`);', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'in-unions-and-intersections' }], }, { @@ -3402,6 +3447,9 @@ type Foo = { }, { code: 'type Foo = `foo-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, errors: [ { messageId: 'noTypeAlias', @@ -3415,6 +3463,9 @@ type Foo = { }, { code: 'type Foo = `a-${number}` | `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'never' }], errors: [ { @@ -3439,6 +3490,9 @@ type Foo = { }, { code: 'type Foo = `a-${number}` & `b-${number}`;', + dependencyConstraints: { + typescript: '4.1', + }, options: [{ allowAliases: 'never' }], errors: [ { diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts index f8401399a20..af8b189f899 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -527,6 +527,24 @@ if (x) { tsconfigRootDir: path.join(rootPath, 'unstrict'), }, }, + ` +interface Foo { + [key: string]: [string] | undefined; +} + +type OptionalFoo = Foo | undefined; +declare const foo: OptionalFoo; +foo?.test?.length; + `, + ` +interface Foo { + [key: number]: [string] | undefined; +} + +type OptionalFoo = Foo | undefined; +declare const foo: OptionalFoo; +foo?.[1]?.length; + `, ], invalid: [ // Ensure that it's checking in all the right places @@ -1548,5 +1566,36 @@ if (x) { tsconfigRootDir: path.join(rootPath, 'unstrict'), }, }, + { + code: ` +interface Foo { + test: string; + [key: string]: [string] | undefined; +} + +type OptionalFoo = Foo | undefined; +declare const foo: OptionalFoo; +foo?.test?.length; + `, + output: ` +interface Foo { + test: string; + [key: string]: [string] | undefined; +} + +type OptionalFoo = Foo | undefined; +declare const foo: OptionalFoo; +foo?.test.length; + `, + errors: [ + { + messageId: 'neverOptionalChain', + line: 9, + endLine: 9, + column: 10, + endColumn: 12, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts index 512407474e6..abedc24d274 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts @@ -127,11 +127,17 @@ class Foo extends Bar {} interface Bar {} class Foo implements Bar {} `, - ` + { + code: ` import { F } from './missing'; function bar() {} bar>(); - `, + `, + dependencyConstraints: { + // TS 4.5 improved type resolution for unresolved generics + typescript: '4.5', + }, + }, ` type A = T; type B = A; diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts index 715d2e94385..ee2191a3f4c 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts @@ -402,7 +402,8 @@ export const map: { [name in Foo]: Bar } = { }; `, // 4.1 remapped mapped type - noFormat` + { + code: noFormat` type Foo = 'a' | 'b' | 'c'; type Bar = number; @@ -411,7 +412,11 @@ export const map: { [name in Foo as string]: Bar } = { b: 2, c: 3, }; - `, + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, ` import { Nullable } from 'nullable'; class A { @@ -747,6 +752,9 @@ function foo(value: T): T { } export type Foo = typeof foo; `, + dependencyConstraints: { + typescript: '4.7', + }, }, // https://github.com/typescript-eslint/typescript-eslint/issues/2331 { @@ -922,7 +930,8 @@ export declare namespace Foo { } } `, - noFormat` + { + code: noFormat` class Foo { value: T; } @@ -930,7 +939,11 @@ class Bar { foo = Foo; } new Bar(); - `, + `, + dependencyConstraints: { + typescript: '4.7', + }, + }, { code: ` declare namespace A { @@ -946,21 +959,36 @@ declare function A(A: string): string; filename: 'foo.d.ts', }, // 4.1 template literal types - noFormat` + { + code: noFormat` type Color = 'red' | 'blue'; type Quantity = 'one' | 'two'; export type SeussFish = \`\${Quantity | Color} fish\`; - `, - noFormat` + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, + { + code: noFormat` type VerticalAlignment = "top" | "middle" | "bottom"; type HorizontalAlignment = "left" | "center" | "right"; export declare function setAlignment(value: \`\${VerticalAlignment}-\${HorizontalAlignment}\`): void; - `, - noFormat` + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, + { + code: noFormat` type EnthusiasticGreeting = \`\${Uppercase} - \${Lowercase} - \${Capitalize} - \${Uncapitalize}\`; export type HELLO = EnthusiasticGreeting<"heLLo">; - `, + `, + dependencyConstraints: { + typescript: '4.1', + }, + }, // https://github.com/typescript-eslint/typescript-eslint/issues/2714 { code: ` @@ -1028,7 +1056,8 @@ export class Foo { } } `, - ` + { + code: ` function foo() {} export class Foo { @@ -1038,7 +1067,11 @@ export class Foo { foo(); } } - `, + `, + dependencyConstraints: { + typescript: '4.4', + }, + }, ], invalid: [ diff --git a/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts b/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts index 4b0750c8c84..6826230b4fd 100644 --- a/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts +++ b/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts @@ -1,14 +1,11 @@ -import path from 'path'; - import rule from '../../src/rules/non-nullable-type-assertion-style'; -import { RuleTester } from '../RuleTester'; +import { getFixturesRootDir, RuleTester } from '../RuleTester'; -const rootDir = path.resolve(__dirname, '../fixtures/'); const ruleTester = new RuleTester({ parserOptions: { sourceType: 'module', - tsconfigRootDir: rootDir, - project: './tsconfig.noUncheckedIndexedAccess.json', + tsconfigRootDir: getFixturesRootDir(), + project: './tsconfig.json', }, parser: '@typescript-eslint/parser', }); @@ -62,35 +59,6 @@ const x = 1 as 1; declare function foo(): T; const bar = foo() as number; `, - ` -function first(array: ArrayLike): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, - ` -function first(array: ArrayLike): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, - ` -function first(array: ArrayLike): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, - ` -function first( - array: ArrayLike, -): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, - ` -type A = 'a' | 'A'; -type B = 'b' | 'B'; -function first(array: ArrayLike): T | null { - return array.length > 0 ? (array[0] as T) : null; -} - `, ], invalid: [ @@ -229,24 +197,76 @@ declare const x: T; const y = x!; `, }, - { - code: ` -function first(array: ArrayLike): T | null { + ], +}); + +const ruleTesterWithNoUncheckedIndexAccess = new RuleTester({ + parserOptions: { + sourceType: 'module', + tsconfigRootDir: getFixturesRootDir(), + project: './tsconfig.noUncheckedIndexedAccess.json', + }, + parser: '@typescript-eslint/parser', + dependencyConstraints: { + typescript: '4.1', + }, +}); + +ruleTesterWithNoUncheckedIndexAccess.run( + 'non-nullable-type-assertion-style - noUncheckedIndexedAccess', + rule, + { + valid: [ + ` +function first(array: ArrayLike): T | null { return array.length > 0 ? (array[0] as T) : null; } `, - errors: [ - { - column: 30, - line: 3, - messageId: 'preferNonNullAssertion', - }, - ], - output: ` + ` +function first(array: ArrayLike): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + ` +function first(array: ArrayLike): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + ` +function first( + array: ArrayLike, +): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + ` +type A = 'a' | 'A'; +type B = 'b' | 'B'; +function first(array: ArrayLike): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + ], + invalid: [ + { + code: ` +function first(array: ArrayLike): T | null { + return array.length > 0 ? (array[0] as T) : null; +} + `, + errors: [ + { + column: 30, + line: 3, + messageId: 'preferNonNullAssertion', + }, + ], + output: ` function first(array: ArrayLike): T | null { return array.length > 0 ? (array[0]!) : null; } - `, - }, - ], -}); + `, + }, + ], + }, +); diff --git a/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts b/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts index 0358c065870..e1a1467d80f 100644 --- a/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts @@ -65,6 +65,16 @@ const baseCases = [ code: 'foo && foo[bar].baz && foo[bar].baz.buzz', output: 'foo?.[bar].baz?.buzz', }, + // case with a property access in computed property + { + code: 'foo && foo[bar.baz] && foo[bar.baz].buzz', + output: 'foo?.[bar.baz]?.buzz', + }, + // case with this keyword + { + code: 'foo[this.bar] && foo[this.bar].baz', + output: 'foo[this.bar]?.baz', + }, // chained calls { code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz()', @@ -147,6 +157,14 @@ const baseCases = [ ruleTester.run('prefer-optional-chain', rule, { valid: [ + '!a || !b;', + '!a || a.b;', + '!a && a.b;', + '!a && !a.b;', + '!a.b || a.b?.();', + '!a.b || a.b();', + '!foo() || !foo().bar;', + 'foo || {};', 'foo || ({} as any);', '(foo || {})?.bar;', @@ -180,6 +198,19 @@ ruleTester.run('prefer-optional-chain', rule, { 'foo && foo[bar as string] && foo[bar as string].baz;', 'foo && foo[1 + 2] && foo[1 + 2].baz;', 'foo && foo[typeof bar] && foo[typeof bar].baz;', + '!foo[1 + 1] || !foo[1 + 2];', + '!foo[1 + 1] || !foo[1 + 1].foo;', + '!foo || !foo[bar as string] || !foo[bar as string].baz;', + '!foo || !foo[1 + 2] || !foo[1 + 2].baz;', + '!foo || !foo[typeof bar] || !foo[typeof bar].baz;', + // currently do not handle 'this' as the first part of a chain + 'this && this.foo;', + '!this || !this.foo;', + // intentionally do not handle mixed TSNonNullExpression in properties + '!entity.__helper!.__initialized || options.refresh;', + '!foo!.bar || !foo!.bar.baz;', + '!foo!.bar!.baz || !foo!.bar!.baz!.paz;', + '!foo.bar!.baz || !foo.bar!.baz!.paz;', ], invalid: [ ...baseCases, @@ -447,6 +478,22 @@ foo?.bar(/* comment */a, }, ], }, + // case with this keyword at the start of expression + { + code: 'this.bar && this.bar.baz;', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'this.bar?.baz;', + }, + ], + }, + ], + }, // other weird cases { code: 'foo && foo?.();', @@ -1144,5 +1191,135 @@ foo?.bar(/* comment */a, }, ], }, + { + code: '(this || {}).foo;', + errors: [ + { + messageId: 'optionalChainSuggest', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'this?.foo;', + }, + ], + }, + ], + }, + ...baseCases.map(c => ({ + ...c, + code: c.code.replace(/foo/g, '!foo').replace(/&&/g, '||'), + errors: [ + { + ...c.errors[0], + suggestions: [ + { + ...c.errors[0].suggestions![0], + output: `!${c.errors[0].suggestions![0].output}`, + }, + ], + }, + ], + })), + // case with this keyword at the start of expression + { + code: '!this.bar || !this.bar.baz;', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!this.bar?.baz;', + }, + ], + }, + ], + }, + { + code: '!a.b || !a.b();', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!a.b?.();', + }, + ], + }, + ], + }, + { + code: '!foo.bar || !foo.bar.baz;', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!foo.bar?.baz;', + }, + ], + }, + ], + }, + { + code: '!foo[bar] || !foo[bar]?.[baz];', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!foo[bar]?.[baz];', + }, + ], + }, + ], + }, + { + code: '!foo || !foo?.bar.baz;', + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '!foo?.bar.baz;', + }, + ], + }, + ], + }, + // two errors + { + code: noFormat`(!foo || !foo.bar || !foo.bar.baz) && (!baz || !baz.bar || !baz.bar.foo);`, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`(!foo?.bar?.baz) && (!baz || !baz.bar || !baz.bar.foo);`, + }, + ], + }, + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: noFormat`(!foo || !foo.bar || !foo.bar.baz) && (!baz?.bar?.foo);`, + }, + ], + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts index b6b499b0efd..7cd0527b2cf 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts @@ -380,6 +380,27 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { }, ], }, + { + name: 'circular readonly types (Bug: #5875)', + code: ` + interface Obj1 { + readonly [K: string]: Obj2; + } + + interface Obj2 { + readonly [K: string]: Obj1; + } + + function foo(event: Obj1): void {} + `, + options: [ + { + checkParameterProperties: true, + ignoreInferredTypes: false, + ...readonlynessOptionsDefaults, + }, + ], + }, ], invalid: [ // arrays diff --git a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts index 69b604c811c..ccf99b6afcb 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -102,6 +102,13 @@ const invalidAsyncModifiers = { constructor() {} } `, + ` +class Foo { + async catch(arg: Promise) { + return arg; + } +} + `, { code: ` function returnsAny(): any { @@ -670,5 +677,80 @@ class Test { } `, }, + // https://github.com/typescript-eslint/typescript-eslint/issues/5729 + { + code: ` +class Foo { + catch() { + return Promise.resolve(1); + } + + public default() { + return Promise.resolve(2); + } + + @decorator + private case() { + return Promise.resolve(3); + } +} + `, + output: ` +class Foo { + async catch() { + return Promise.resolve(1); + } + + public async default() { + return Promise.resolve(2); + } + + @decorator + private async case() { + return Promise.resolve(3); + } +} + `, + errors: [ + { + line: 3, + column: 3, + messageId, + }, + { + line: 7, + column: 3, + messageId, + }, + { + line: 12, + column: 3, + messageId, + }, + ], + }, + { + code: ` +const foo = { + catch() { + return Promise.resolve(1); + }, +}; + `, + output: ` +const foo = { + async catch() { + return Promise.resolve(1); + }, +}; + `, + errors: [ + { + line: 3, + column: 3, + messageId, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts index b0322b290ab..7e80bdbdf5d 100644 --- a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts @@ -358,6 +358,11 @@ ruleTester.run('restrict-template-expressions', rule, { return \`arg = \${arg}\`; } `, + dependencyConstraints: { + // TS 4.5 improved type printing to print the type T as `T` + // before that it was printed as `any` + typescript: '4.5', + }, errors: [ { messageId: 'invalidType', diff --git a/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts b/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts new file mode 100644 index 00000000000..2587375060e --- /dev/null +++ b/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts @@ -0,0 +1,338 @@ +import type { TSESLint } from '@typescript-eslint/utils'; + +import type { + MessageIds, + Options, +} from '../../src/rules/sort-type-constituents'; +import rule from '../../src/rules/sort-type-constituents'; +import { noFormat, RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +const valid = (operator: '|' | '&'): TSESLint.ValidTestCase[] => [ + { + code: `type T = A ${operator} B;`, + }, + { + code: `type T = A ${operator} /* comment */ B;`, + }, + { + code: `type T = 'A' ${operator} 'B';`, + }, + { + code: `type T = 1 ${operator} 2;`, + }, + { + code: noFormat`type T = (A) ${operator} (B);`, + }, + { + code: `type T = { a: string } ${operator} { b: string };`, + }, + { + code: `type T = [1, 2, 3] ${operator} [1, 2, 4];`, + }, + { + code: `type T = (() => string) ${operator} (() => void);`, + }, + { + code: `type T = () => string ${operator} void;`, + }, + { + // testing the default ordering + code: noFormat` +type T = + ${operator} A + ${operator} B + ${operator} C.D + ${operator} D.E + ${operator} intrinsic + ${operator} number[] + ${operator} string[] + ${operator} any + ${operator} string + ${operator} symbol + ${operator} this + ${operator} readonly number[] + ${operator} readonly string[] + ${operator} 'a' + ${operator} 'b' + ${operator} "a" + ${operator} "b" + ${operator} (() => string) + ${operator} (() => void) + ${operator} (new () => string) + ${operator} (new () => void) + ${operator} import('bar') + ${operator} import('foo') + ${operator} (number extends string ? unknown : never) + ${operator} (string extends string ? unknown : never) + ${operator} { [a in string]: string } + ${operator} { [a: string]: string } + ${operator} { [b in string]: string } + ${operator} { [b: string]: string } + ${operator} { a: string } + ${operator} { b: string } + ${operator} [1, 2, 3] + ${operator} [1, 2, 4] + ${operator} (A & B) + ${operator} (B & C) + ${operator} (A | B) + ${operator} (B | C) + ${operator} null + ${operator} undefined + `, + }, +]; +const invalid = ( + operator: '|' | '&', +): TSESLint.InvalidTestCase[] => { + const type = operator === '|' ? 'Union' : 'Intersection'; + return [ + { + code: `type T = B ${operator} A;`, + output: `type T = A ${operator} B;`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = 'B' ${operator} 'A';`, + output: `type T = 'A' ${operator} 'B';`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = 2 ${operator} 1;`, + output: `type T = 1 ${operator} 2;`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: noFormat`type T = (B) ${operator} (A);`, + output: `type T = A ${operator} B;`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = { b: string } ${operator} { a: string };`, + output: `type T = { a: string } ${operator} { b: string };`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = [1, 2, 4] ${operator} [1, 2, 3];`, + output: `type T = [1, 2, 3] ${operator} [1, 2, 4];`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = (() => void) ${operator} (() => string);`, + output: `type T = (() => string) ${operator} (() => void);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = () => void ${operator} string;`, + output: `type T = () => string ${operator} void;`, + errors: [ + { + messageId: 'notSorted', + data: { + type, + }, + }, + ], + }, + { + code: `type T = () => undefined ${operator} null;`, + output: `type T = () => null ${operator} undefined;`, + errors: [ + { + messageId: 'notSorted', + data: { + type, + }, + }, + ], + }, + { + code: noFormat` +type T = + ${operator} [1, 2, 4] + ${operator} [1, 2, 3] + ${operator} { b: string } + ${operator} { a: string } + ${operator} (() => void) + ${operator} (() => string) + ${operator} "b" + ${operator} "a" + ${operator} 'b' + ${operator} 'a' + ${operator} readonly string[] + ${operator} readonly number[] + ${operator} string[] + ${operator} number[] + ${operator} D.E + ${operator} C.D + ${operator} B + ${operator} A + ${operator} undefined + ${operator} null + ${operator} string + ${operator} any; + `, + output: ` +type T = + A ${operator} B ${operator} C.D ${operator} D.E ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined; + `, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + }, + ], + }, + { + code: `type T = B ${operator} /* comment */ A;`, + output: null, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + suggestions: [ + { + messageId: 'suggestFix', + output: `type T = A ${operator} B;`, + }, + ], + }, + ], + }, + { + code: `type T = (() => /* comment */ A) ${operator} B;`, + output: `type T = B ${operator} (() => /* comment */ A);`, + errors: [ + { + messageId: 'notSortedNamed', + data: { + type, + name: 'T', + }, + suggestions: null, + }, + ], + }, + { + code: `type Expected = (new (x: number) => boolean) ${operator} string;`, + output: `type Expected = string ${operator} (new (x: number) => boolean);`, + errors: [ + { + messageId: 'notSortedNamed', + }, + ], + }, + ]; +}; + +ruleTester.run('sort-type-constituents', rule, { + valid: [ + ...valid('|'), + { + code: 'type T = B | A;', + options: [ + { + checkUnions: false, + }, + ], + }, + + ...valid('&'), + { + code: 'type T = B & A;', + options: [ + { + checkIntersections: false, + }, + ], + }, + + { + code: noFormat` +type T = [1] | 'a' | 'b' | "b" | 1 | 2 | {}; + `, + options: [ + { + groupOrder: ['tuple', 'literal', 'object'], + }, + ], + }, + { + // if not specified - groups should be placed last + code: ` +type T = 1 | string | {} | A; + `, + options: [ + { + groupOrder: ['literal', 'keyword'], + }, + ], + }, + ], + invalid: [...invalid('|'), ...invalid('&')], +}); diff --git a/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts b/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts index 38ae67f1804..a24959d8b6a 100644 --- a/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts +++ b/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts @@ -45,6 +45,8 @@ const valid = (operator: '|' | '&'): TSESLint.ValidTestCase[] => [ type T = ${operator} A ${operator} B + ${operator} C.D + ${operator} D.E ${operator} intrinsic ${operator} number[] ${operator} string[] @@ -220,6 +222,8 @@ type T = ${operator} readonly number[] ${operator} string[] ${operator} number[] + ${operator} D.E + ${operator} C.D ${operator} B ${operator} A ${operator} undefined @@ -229,7 +233,7 @@ type T = `, output: ` type T = - A ${operator} B ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined; + A ${operator} B ${operator} C.D ${operator} D.E ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined; `, errors: [ { diff --git a/packages/eslint-plugin/tools/generate-breaking-changes.ts b/packages/eslint-plugin/tools/generate-breaking-changes.ts new file mode 100644 index 00000000000..9b1ecafff4c --- /dev/null +++ b/packages/eslint-plugin/tools/generate-breaking-changes.ts @@ -0,0 +1,156 @@ +// eslint-disable-next-line @typescript-eslint/consistent-type-imports +type RulesFile = typeof import('../src/rules'); + +interface RulesObject { + default: RulesFile; +} + +async function main(): Promise { + const { + default: { default: rules }, + } = + // @ts-expect-error -- We don't support ESM imports of local code yet. + (await import('../dist/rules/index.js')) as RulesObject; + const { markdownTable } = await import('markdown-table'); + const { fetch } = await import('cross-fetch'); + + const newRuleNames = await getNewRulesAsOfMajorVersion('5.0.0'); + + console.log(`## Table Key + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ColumnDescriptionEmojis
StatusBeing added, deprecated, or removed +
    +
  • ๐Ÿ†• = newly added to TypeScript-ESLint
  • +
  • ๐Ÿ™… = deprecated in the next major
  • +
  • โž–๏ธ = to be removed from the plugin in the next version
  • +
+
ExtExtension rule? +
    +
  • โ˜‘๏ธ = yes
  • +
+
RRecommended +
    +
  • โž• = add to recommended this version
  • +
  • โš ๏ธ = recommended as warning
  • +
  • ๐Ÿ›‘ = recommended as an error
  • +
  • โž–๏ธ = remove from recommended this version
  • +
+
RWTRecommended-requiring-type-checking +
    +
  • โž• = add to recommended-with-typechecking this version
  • +
  • โš ๏ธ = recommended as warning
  • +
  • ๐Ÿ›‘ = recommended as an error
  • +
  • โž–๏ธ = remove from recommended this version
  • +
+
StrictStrict +
    +
  • โž• = add to strict this version
  • +
  • โš ๏ธ = recommended as warning
  • +
  • โž–๏ธ = remove from strict this version
  • +
+
+ +## Recommendations Table + +> Hint: search for ๐Ÿ†• to find newly added rules, and โž• or โž– to see config changes. +`); + + console.log( + markdownTable([ + ['Rule', 'Status', 'Ext', 'R', 'RWT', 'Strict', 'Comment'], + ...Object.entries(rules).map(([ruleName, { meta }]) => { + const { deprecated } = meta; + const { extendsBaseRule, recommended, requiresTypeChecking } = + meta.docs!; + + return [ + `[\`${ruleName}\`](https://typescript-eslint.io/rules/${ruleName})`, + newRuleNames.has(ruleName) ? '๐Ÿ†•' : deprecated ? '๐Ÿ™…' : '', + extendsBaseRule ? 'โ˜‘๏ธ' : '', + recommended && + ['error', 'warn'].includes(recommended) && + !requiresTypeChecking + ? '๐Ÿ›‘' + : '', + recommended && + ['error', 'warn'].includes(recommended) && + requiresTypeChecking + ? '๐Ÿ›‘' + : '', + recommended === 'strict' ? 'โš ๏ธ' : '', + meta.type === 'layout' ? 'layout ๐Ÿ’ฉ' : '(todo)', + ]; + }), + ]), + ); + + // Annotate which rules are new since version 5.0.0 + async function getNewRulesAsOfMajorVersion( + oldVersion: string, + ): Promise> { + // 1. Get the current list of rules (already done) + const newRuleNames = Object.keys(rules); + + // 2. Use some CDN thing for the 5.X version of typescript-eslint + const oldUrl = `https://unpkg.com/@typescript-eslint/eslint-plugin@${oldVersion}/dist/configs/all.js`; + const oldFileText = await (await fetch(oldUrl)).text(); + const oldObjectText = oldFileText.substring( + oldFileText.indexOf('{'), + oldFileText.lastIndexOf('}') + 1, + ); + // Normally we wouldn't condone using the 'eval' API... + // But this is an internal-only script and it's the easiest way to convert + // the JS raw text into a runtime object. ๐Ÿคท + let oldRulesObject!: { rules: RulesFile }; + eval('oldRulesObject = ' + oldObjectText); + const oldRuleNames = new Set(Object.keys(oldRulesObject.rules)); + + // 3. Get the keys that exist in (1) (new version) and not (2) (old version) + return new Set( + newRuleNames.filter( + newRuleName => !oldRuleNames.has(`@typescript-eslint/${newRuleName}`), + ), + ); + } + + await getNewRulesAsOfMajorVersion('5.0.0'); +} + +main().catch(error => { + console.error(error); +}); diff --git a/packages/eslint-plugin/tools/generate-rules-lists.ts b/packages/eslint-plugin/tools/generate-rules-lists.ts deleted file mode 100644 index ce806cc2e8d..00000000000 --- a/packages/eslint-plugin/tools/generate-rules-lists.ts +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env ts-node - -import type { TSESLint } from '@typescript-eslint/utils'; -import fs from 'fs'; -import path from 'path'; -import prettier from 'prettier'; - -import rules from '../src/rules'; - -interface RuleDetails { - name: string; - description: string; - recommended: TSESLint.RuleRecommendation; - fixable: boolean; - requiresTypeChecking: boolean; - extendsBaseRule: boolean; -} - -type RuleColumn = [ - string, - string, - ':lock:' | ':white_check_mark:' | '', - ':wrench:' | '', - ':thought_balloon:' | '', -]; - -const emojiKey = { - recommended: ':white_check_mark:', - strict: ':lock:', - fixable: ':wrench:', - requiresTypeChecking: ':thought_balloon:', -} as const; - -const staticElements = { - rulesListKey: [ - `**Key**: ${emojiKey.recommended} = recommended`, - `${emojiKey.strict} = strict`, - `${emojiKey.fixable} = fixable`, - `${emojiKey.requiresTypeChecking} = requires type information`, - ].join(', '), - listHeaderRow: [ - 'Name', - 'Description', - `${emojiKey.recommended}${emojiKey.strict}`, - emojiKey.fixable, - emojiKey.requiresTypeChecking, - ], - listSpacerRow: Array(5).fill('-'), -}; - -const returnEmojiIfTrue = ( - key: TKey, - obj: { [K in TKey]?: unknown }, -): typeof emojiKey[TKey] | '' => (obj[key] ? emojiKey[key] : ''); - -const createRuleLink = (ruleName: string, basePath: string): string => - `[\`@typescript-eslint/${ruleName}\`](${basePath}${ruleName}.md)`; - -const buildRuleRow = (rule: RuleDetails, basePath: string): RuleColumn => [ - createRuleLink(rule.name, basePath), - rule.description, - rule.recommended === 'strict' - ? emojiKey.strict - : returnEmojiIfTrue('recommended', rule), - returnEmojiIfTrue('fixable', rule), - returnEmojiIfTrue('requiresTypeChecking', rule), -]; - -const buildRulesTable = ( - rules: RuleDetails[], - basePath: string, -): string[][] => [ - staticElements.listHeaderRow, - staticElements.listSpacerRow, - ...rules - .sort(({ name: ruleNameA }, { name: ruleNameB }) => - ruleNameA.localeCompare(ruleNameB), - ) - .map(item => buildRuleRow(item, basePath)), -]; - -const generateRulesListMarkdown = ( - rules: RuleDetails[], - basePath: string, -): string => - [ - '', - staticElements.rulesListKey, - '', - ...buildRulesTable(rules, basePath).map(column => - [...column, ' '].join('|'), - ), - '', - ].join('\n'); - -const updateRulesList = ( - listName: 'base' | 'extension', - rules: RuleDetails[], - markdown: string, - basePath: string, -): string => { - const listBeginMarker = ``; - const listEndMarker = ``; - - const listStartIndex = markdown.indexOf(listBeginMarker); - const listEndIndex = markdown.indexOf(listEndMarker); - - if (listStartIndex === -1 || listEndIndex === -1) { - throw new Error(`cannot find start or end of ${listName} list`); - } - - return [ - markdown.substring(0, listStartIndex - 1), - listBeginMarker, - '', - generateRulesListMarkdown(rules, basePath), // - markdown.substring(listEndIndex), - ].join('\n'); -}; - -const rulesDetails: RuleDetails[] = Object.entries(rules) - .filter(([, rule]) => rule.meta.deprecated !== true) - .map(([name, rule]) => ({ - name, - description: rule.meta.docs?.description ?? '', - recommended: rule.meta.docs?.recommended ?? false, - fixable: !!rule.meta.fixable, - requiresTypeChecking: rule.meta.docs?.requiresTypeChecking ?? false, - extendsBaseRule: !!rule.meta.docs?.extendsBaseRule ?? false, - })); - -const baseRules = rulesDetails.filter(rule => !rule.extendsBaseRule); -const extensionRules = rulesDetails.filter(rule => rule.extendsBaseRule); - -function updateFile(file: string, basePath: string): void { - let readme = fs.readFileSync(file, 'utf8'); - - readme = updateRulesList('base', baseRules, readme, basePath); - readme = updateRulesList('extension', extensionRules, readme, basePath); - - readme = prettier.format(readme, { parser: 'markdown' }); - - fs.writeFileSync(file, readme, 'utf8'); -} - -updateFile(path.resolve(__dirname, '../README.md'), './docs/rules/'); -updateFile(path.resolve(__dirname, '../docs/rules/README.md'), './'); diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index 7801773b539..53deb3aa1bb 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -10,5 +10,12 @@ { "path": "../parser/tsconfig.build.json" }, { "path": "../scope-manager/tsconfig.build.json" }, { "path": "../type-utils/tsconfig.build.json" } - ] + ], + "ts-node": { + "compilerOptions": { + "module": "ESNext" + }, + "files": true, + "transpileOnly": true + } } diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 5b2bc9b5d9b..4d40a307fdf 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/experimental-utils diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 2534035f5df..0a55b72ffb4 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "5.41.0", + "version": "5.44.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -34,11 +34,11 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.41.0" + "@typescript-eslint/utils": "5.44.0" }, "peerDependencies": { "eslint": "^7.0.0 || ^8.0.0" diff --git a/packages/experimental-utils/project.json b/packages/experimental-utils/project.json index 24256b3e4d0..415df390d35 100644 --- a/packages/experimental-utils/project.json +++ b/packages/experimental-utils/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/experimental-utils/**/*.ts"] + } + } + } } diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index b8064f16b73..52366c06677 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +**Note:** Version bump only for package @typescript-eslint/parser + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/parser + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/parser + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +### Features + +- **scope-manager:** ignore ECMA version ([#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881)) ([3b8d449](https://github.com/typescript-eslint/typescript-eslint/commit/3b8d449696c319690536a18a48ef32749dc2f559)) + +### Reverts + +- Revert "feat(scope-manager): ignore ECMA version" (#5888) ([2ee81df](https://github.com/typescript-eslint/typescript-eslint/commit/2ee81df5a365d82ef4b3dfc124d4ec39c7bcb725)), closes [#5888](https://github.com/typescript-eslint/typescript-eslint/issues/5888) [#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881) + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index e48702464dd..0fde80b14c9 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "5.41.0", + "version": "5.44.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -37,7 +37,7 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, @@ -45,9 +45,9 @@ "eslint": "^7.0.0 || ^8.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.41.0", - "@typescript-eslint/types": "5.41.0", - "@typescript-eslint/typescript-estree": "5.41.0", + "@typescript-eslint/scope-manager": "5.44.0", + "@typescript-eslint/types": "5.44.0", + "@typescript-eslint/typescript-estree": "5.44.0", "debug": "^4.3.4" }, "devDependencies": { diff --git a/packages/parser/project.json b/packages/parser/project.json index 24256b3e4d0..10eb8732ea1 100644 --- a/packages/parser/project.json +++ b/packages/parser/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/parser/**/*.ts"] + } + } + } } diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 66b6e6b4f53..6c427dbabce 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +### Features + +- update to TypeScript 4.9 ([#5716](https://github.com/typescript-eslint/typescript-eslint/issues/5716)) ([4d744ea](https://github.com/typescript-eslint/typescript-eslint/commit/4d744ea10ba03c66eebcb63e8722e9f0165fbeed)) + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +### Features + +- **scope-manager:** ignore ECMA version ([#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881)) ([3b8d449](https://github.com/typescript-eslint/typescript-eslint/commit/3b8d449696c319690536a18a48ef32749dc2f559)) + +### Reverts + +- Revert "feat(scope-manager): ignore ECMA version" (#5888) ([2ee81df](https://github.com/typescript-eslint/typescript-eslint/commit/2ee81df5a365d82ef4b3dfc124d4ec39c7bcb725)), closes [#5888](https://github.com/typescript-eslint/typescript-eslint/issues/5888) [#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881) + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/scope-manager diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 8e4b9da6e4a..7ded3d81a3e 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "5.41.0", + "version": "5.44.0", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -28,22 +28,22 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "cd ../../ && nx build @typescript-eslint/scope-manager", - "clean": "cd ../../ && nx clean @typescript-eslint/scope-manager", - "clean-fixtures": "cd ../../ && nx clean-fixtures @typescript-eslint/scope-manager", + "build": "nx build", + "clean": "nx clean", + "clean-fixtures": "nx clean-fixtures", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate:lib": "cd ../../ && nx generate-lib @typescript-eslint/scope-manager", - "lint": "cd ../../ && nx lint @typescript-eslint/scope-manager", - "test": "cd ../../ && nx test @typescript-eslint/scope-manager --code-coverage", - "typecheck": "cd ../../ && nx typecheck @typescript-eslint/scope-manager" + "generate:lib": "nx generate-lib", + "lint": "nx lint", + "test": "nx test --code-coverage", + "typecheck": "nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "5.41.0", - "@typescript-eslint/visitor-keys": "5.41.0" + "@typescript-eslint/types": "5.44.0", + "@typescript-eslint/visitor-keys": "5.44.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "5.41.0", + "@typescript-eslint/typescript-estree": "5.44.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/scope-manager/project.json b/packages/scope-manager/project.json index 1868938a6ac..efaf69f925c 100644 --- a/packages/scope-manager/project.json +++ b/packages/scope-manager/project.json @@ -55,8 +55,7 @@ "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/scope-manager/**/*.{ts,js}"], - "ignorePath": ".eslintignore" + "lintFilePatterns": ["packages/scope-manager/**/*.ts"] } }, "test": { diff --git a/packages/scope-manager/src/lib/dom.iterable.ts b/packages/scope-manager/src/lib/dom.iterable.ts index d294d684ddc..1d43661478b 100644 --- a/packages/scope-manager/src/lib/dom.iterable.ts +++ b/packages/scope-manager/src/lib/dom.iterable.ts @@ -13,6 +13,7 @@ export const dom_iterable = { CSSRuleList: TYPE, CSSStyleDeclaration: TYPE, Cache: TYPE, + CanvasPath: TYPE, CanvasPathDrawingStyles: TYPE, DOMRectList: TYPE, DOMStringList: TYPE, diff --git a/packages/scope-manager/src/lib/dom.ts b/packages/scope-manager/src/lib/dom.ts index dd8523bc66e..1087a238dfc 100644 --- a/packages/scope-manager/src/lib/dom.ts +++ b/packages/scope-manager/src/lib/dom.ts @@ -66,7 +66,7 @@ export const dom = { DeviceMotionEventInit: TYPE, DeviceMotionEventRotationRateInit: TYPE, DeviceOrientationEventInit: TYPE, - DisplayMediaStreamConstraints: TYPE, + DisplayMediaStreamOptions: TYPE, DocumentTimelineOptions: TYPE, DoubleRange: TYPE, DragEventInit: TYPE, @@ -143,7 +143,6 @@ export const dom = { MediaMetadataInit: TYPE, MediaPositionState: TYPE, MediaQueryListEventInit: TYPE, - MediaRecorderErrorEventInit: TYPE, MediaRecorderOptions: TYPE, MediaSessionActionDetails: TYPE, MediaStreamAudioSourceOptions: TYPE, @@ -184,6 +183,7 @@ export const dom = { PeriodicWaveConstraints: TYPE, PeriodicWaveOptions: TYPE, PermissionDescriptor: TYPE, + PictureInPictureEventInit: TYPE, PointerEventInit: TYPE, PopStateEventInit: TYPE, PositionOptions: TYPE, @@ -243,6 +243,7 @@ export const dom = { RTCStats: TYPE, RTCTrackEventInit: TYPE, RTCTransportStats: TYPE, + ReadableStreamGetReaderOptions: TYPE, ReadableStreamReadDoneResult: TYPE, ReadableStreamReadValueResult: TYPE, ReadableWritablePair: TYPE, @@ -284,12 +285,14 @@ export const dom = { TransitionEventInit: TYPE, UIEventInit: TYPE, ULongRange: TYPE, + UnderlyingByteSource: TYPE, + UnderlyingDefaultSource: TYPE, UnderlyingSink: TYPE, UnderlyingSource: TYPE, ValidityStateFlags: TYPE, VideoColorSpaceInit: TYPE, VideoConfiguration: TYPE, - VideoFrameMetadata: TYPE, + VideoFrameCallbackMetadata: TYPE, WaveShaperOptions: TYPE, WebGLContextAttributes: TYPE, WebGLContextEventInit: TYPE, @@ -348,12 +351,16 @@ export const dom = { CDATASection: TYPE_VALUE, CSSAnimation: TYPE_VALUE, CSSConditionRule: TYPE_VALUE, + CSSContainerRule: TYPE_VALUE, CSSCounterStyleRule: TYPE_VALUE, CSSFontFaceRule: TYPE_VALUE, + CSSFontPaletteValuesRule: TYPE_VALUE, CSSGroupingRule: TYPE_VALUE, CSSImportRule: TYPE_VALUE, CSSKeyframeRule: TYPE_VALUE, CSSKeyframesRule: TYPE_VALUE, + CSSLayerBlockRule: TYPE_VALUE, + CSSLayerStatementRule: TYPE_VALUE, CSSMediaRule: TYPE_VALUE, CSSNamespaceRule: TYPE_VALUE, CSSPageRule: TYPE_VALUE, @@ -449,8 +456,10 @@ export const dom = { EXT_frag_depth: TYPE, EXT_sRGB: TYPE, EXT_shader_texture_lod: TYPE, + EXT_texture_compression_bptc: TYPE, EXT_texture_compression_rgtc: TYPE, EXT_texture_filter_anisotropic: TYPE, + EXT_texture_norm16: TYPE, ElementEventMap: TYPE, Element: TYPE_VALUE, ElementCSSInlineStyle: TYPE, @@ -641,7 +650,6 @@ export const dom = { MediaQueryListEvent: TYPE_VALUE, MediaRecorderEventMap: TYPE, MediaRecorder: TYPE_VALUE, - MediaRecorderErrorEvent: TYPE_VALUE, MediaSession: TYPE_VALUE, MediaSourceEventMap: TYPE, MediaSource: TYPE_VALUE, @@ -683,6 +691,7 @@ export const dom = { NonElementParentNode: TYPE, NotificationEventMap: TYPE, Notification: TYPE_VALUE, + OES_draw_buffers_indexed: TYPE, OES_element_index_uint: TYPE, OES_fbo_render_mipmap: TYPE, OES_standard_derivatives: TYPE, @@ -695,6 +704,9 @@ export const dom = { OfflineAudioCompletionEvent: TYPE_VALUE, OfflineAudioContextEventMap: TYPE, OfflineAudioContext: TYPE_VALUE, + OffscreenCanvasEventMap: TYPE, + OffscreenCanvas: TYPE_VALUE, + OffscreenCanvasRenderingContext2D: TYPE_VALUE, OscillatorNode: TYPE_VALUE, OverconstrainedError: TYPE_VALUE, PageTransitionEvent: TYPE_VALUE, @@ -724,6 +736,7 @@ export const dom = { PermissionStatusEventMap: TYPE, PermissionStatus: TYPE_VALUE, Permissions: TYPE_VALUE, + PictureInPictureEvent: TYPE_VALUE, PictureInPictureWindowEventMap: TYPE, PictureInPictureWindow: TYPE_VALUE, Plugin: TYPE_VALUE, @@ -1111,6 +1124,7 @@ export const dom = { MessageEventSource: TYPE, MutationRecordType: TYPE, NamedCurve: TYPE, + OffscreenRenderingContext: TYPE, OnBeforeUnloadEventHandler: TYPE, OnErrorEventHandler: TYPE, PerformanceEntryList: TYPE, @@ -1123,8 +1137,6 @@ export const dom = { TimerHandler: TYPE, Transferable: TYPE, Uint32List: TYPE, - UvmEntries: TYPE, - UvmEntry: TYPE, VibratePattern: TYPE, WindowProxy: TYPE, XMLHttpRequestBodyInit: TYPE, @@ -1203,6 +1215,7 @@ export const dom = { NavigationTimingType: TYPE, NotificationDirection: TYPE, NotificationPermission: TYPE, + OffscreenRenderingContextId: TYPE, OrientationLockType: TYPE, OrientationType: TYPE, OscillatorType: TYPE, @@ -1227,7 +1240,6 @@ export const dom = { RTCIceCandidateType: TYPE, RTCIceComponent: TYPE, RTCIceConnectionState: TYPE, - RTCIceCredentialType: TYPE, RTCIceGathererState: TYPE, RTCIceGatheringState: TYPE, RTCIceProtocol: TYPE, @@ -1243,6 +1255,8 @@ export const dom = { RTCSignalingState: TYPE, RTCStatsIceCandidatePairState: TYPE, RTCStatsType: TYPE, + ReadableStreamReaderMode: TYPE, + ReadableStreamType: TYPE, ReadyState: TYPE, RecordingState: TYPE, ReferrerPolicy: TYPE, diff --git a/packages/scope-manager/src/lib/es2019.intl.ts b/packages/scope-manager/src/lib/es2019.intl.ts new file mode 100644 index 00000000000..64b46f40ebb --- /dev/null +++ b/packages/scope-manager/src/lib/es2019.intl.ts @@ -0,0 +1,11 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE: +// npx nx generate-lib @typescript-eslint/scope-manager + +import type { ImplicitLibVariableOptions } from '../variable'; +import { TYPE_VALUE } from './base-config'; + +export const es2019_intl = { + Intl: TYPE_VALUE, +} as Record; diff --git a/packages/scope-manager/src/lib/es2019.ts b/packages/scope-manager/src/lib/es2019.ts index 43e55a27a3a..cd6d33c1f5d 100644 --- a/packages/scope-manager/src/lib/es2019.ts +++ b/packages/scope-manager/src/lib/es2019.ts @@ -6,6 +6,7 @@ import type { ImplicitLibVariableOptions } from '../variable'; import { es2018 } from './es2018'; import { es2019_array } from './es2019.array'; +import { es2019_intl } from './es2019.intl'; import { es2019_object } from './es2019.object'; import { es2019_string } from './es2019.string'; import { es2019_symbol } from './es2019.symbol'; @@ -16,4 +17,5 @@ export const es2019 = { ...es2019_object, ...es2019_string, ...es2019_symbol, + ...es2019_intl, } as Record; diff --git a/packages/scope-manager/src/lib/index.ts b/packages/scope-manager/src/lib/index.ts index 989857ba152..dfee880fa16 100644 --- a/packages/scope-manager/src/lib/index.ts +++ b/packages/scope-manager/src/lib/index.ts @@ -38,6 +38,7 @@ import { es2018_regexp } from './es2018.regexp'; import { es2019 } from './es2019'; import { es2019_array } from './es2019.array'; import { es2019_full } from './es2019.full'; +import { es2019_intl } from './es2019.intl'; import { es2019_object } from './es2019.object'; import { es2019_string } from './es2019.string'; import { es2019_symbol } from './es2019.symbol'; @@ -124,6 +125,7 @@ const lib = { 'es2019.object': es2019_object, 'es2019.string': es2019_string, 'es2019.symbol': es2019_symbol, + 'es2019.intl': es2019_intl, 'es2020.bigint': es2020_bigint, 'es2020.date': es2020_date, 'es2020.promise': es2020_promise, diff --git a/packages/scope-manager/src/lib/webworker.iterable.ts b/packages/scope-manager/src/lib/webworker.iterable.ts index e4b0fb8b940..5ff03255ece 100644 --- a/packages/scope-manager/src/lib/webworker.iterable.ts +++ b/packages/scope-manager/src/lib/webworker.iterable.ts @@ -8,6 +8,8 @@ import { TYPE } from './base-config'; export const webworker_iterable = { Cache: TYPE, + CanvasPath: TYPE, + CanvasPathDrawingStyles: TYPE, DOMStringList: TYPE, FileList: TYPE, FontFaceSet: TYPE, diff --git a/packages/scope-manager/src/lib/webworker.ts b/packages/scope-manager/src/lib/webworker.ts index e44ce52113c..bddb6bf9aa4 100644 --- a/packages/scope-manager/src/lib/webworker.ts +++ b/packages/scope-manager/src/lib/webworker.ts @@ -88,6 +88,7 @@ export const webworker = { QueuingStrategyInit: TYPE, RTCEncodedAudioFrameMetadata: TYPE, RTCEncodedVideoFrameMetadata: TYPE, + ReadableStreamGetReaderOptions: TYPE, ReadableStreamReadDoneResult: TYPE, ReadableStreamReadValueResult: TYPE, ReadableWritablePair: TYPE, @@ -108,6 +109,8 @@ export const webworker = { TextDecoderOptions: TYPE, TextEncoderEncodeIntoResult: TYPE, Transformer: TYPE, + UnderlyingByteSource: TYPE, + UnderlyingDefaultSource: TYPE, UnderlyingSink: TYPE, UnderlyingSource: TYPE, VideoColorSpaceInit: TYPE, @@ -129,9 +132,23 @@ export const webworker = { ByteLengthQueuingStrategy: TYPE_VALUE, Cache: TYPE_VALUE, CacheStorage: TYPE_VALUE, + CanvasCompositing: TYPE, + CanvasDrawImage: TYPE, + CanvasDrawPath: TYPE, + CanvasFillStrokeStyles: TYPE, + CanvasFilters: TYPE, CanvasGradient: TYPE_VALUE, + CanvasImageData: TYPE, + CanvasImageSmoothing: TYPE, CanvasPath: TYPE, + CanvasPathDrawingStyles: TYPE, CanvasPattern: TYPE_VALUE, + CanvasRect: TYPE, + CanvasShadowStyles: TYPE, + CanvasState: TYPE, + CanvasText: TYPE, + CanvasTextDrawingStyles: TYPE, + CanvasTransform: TYPE, Client: TYPE_VALUE, Clients: TYPE_VALUE, CloseEvent: TYPE_VALUE, @@ -157,8 +174,10 @@ export const webworker = { EXT_frag_depth: TYPE, EXT_sRGB: TYPE, EXT_shader_texture_lod: TYPE, + EXT_texture_compression_bptc: TYPE, EXT_texture_compression_rgtc: TYPE, EXT_texture_filter_anisotropic: TYPE, + EXT_texture_norm16: TYPE, ErrorEvent: TYPE_VALUE, Event: TYPE_VALUE, EventListener: TYPE, @@ -221,6 +240,7 @@ export const webworker = { NotificationEventMap: TYPE, Notification: TYPE_VALUE, NotificationEvent: TYPE_VALUE, + OES_draw_buffers_indexed: TYPE, OES_element_index_uint: TYPE, OES_fbo_render_mipmap: TYPE, OES_standard_derivatives: TYPE, @@ -230,7 +250,9 @@ export const webworker = { OES_texture_half_float_linear: TYPE, OES_vertex_array_object: TYPE, OVR_multiview2: TYPE, - OffscreenCanvas: TYPE, + OffscreenCanvasEventMap: TYPE, + OffscreenCanvas: TYPE_VALUE, + OffscreenCanvasRenderingContext2D: TYPE_VALUE, Path2D: TYPE_VALUE, PerformanceEventMap: TYPE, Performance: TYPE_VALUE, @@ -388,6 +410,7 @@ export const webworker = { Int32List: TYPE, MessageEventSource: TYPE, NamedCurve: TYPE, + OffscreenRenderingContext: TYPE, OnErrorEventHandler: TYPE, PerformanceEntryList: TYPE, PushMessageDataInit: TYPE, @@ -402,6 +425,16 @@ export const webworker = { VibratePattern: TYPE, XMLHttpRequestBodyInit: TYPE, BinaryType: TYPE, + CanvasDirection: TYPE, + CanvasFillRule: TYPE, + CanvasFontKerning: TYPE, + CanvasFontStretch: TYPE, + CanvasFontVariantCaps: TYPE, + CanvasLineCap: TYPE, + CanvasLineJoin: TYPE, + CanvasTextAlign: TYPE, + CanvasTextBaseline: TYPE, + CanvasTextRendering: TYPE, ClientTypes: TYPE, ColorGamut: TYPE, ColorSpaceConversion: TYPE, @@ -411,12 +444,14 @@ export const webworker = { FontFaceLoadStatus: TYPE, FontFaceSetLoadStatus: TYPE, FrameType: TYPE, + GlobalCompositeOperation: TYPE, HdrMetadataType: TYPE, IDBCursorDirection: TYPE, IDBRequestReadyState: TYPE, IDBTransactionDurability: TYPE, IDBTransactionMode: TYPE, ImageOrientation: TYPE, + ImageSmoothingQuality: TYPE, KeyFormat: TYPE, KeyType: TYPE, KeyUsage: TYPE, @@ -425,12 +460,15 @@ export const webworker = { MediaEncodingType: TYPE, NotificationDirection: TYPE, NotificationPermission: TYPE, + OffscreenRenderingContextId: TYPE, PermissionName: TYPE, PermissionState: TYPE, PredefinedColorSpace: TYPE, PremultiplyAlpha: TYPE, PushEncryptionKeyName: TYPE, RTCEncodedVideoFrameType: TYPE, + ReadableStreamReaderMode: TYPE, + ReadableStreamType: TYPE, ReferrerPolicy: TYPE, RequestCache: TYPE, RequestCredentials: TYPE, diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index ecadb7e9fd6..420d4d4aa89 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -301,7 +301,10 @@ class Referencer extends Visitor { } protected visitTypeAssertion( - node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion, + node: + | TSESTree.TSAsExpression + | TSESTree.TSTypeAssertion + | TSESTree.TSSatisfiesExpression, ): void { this.visit(node.expression); this.visitType(node.typeAnnotation); @@ -668,7 +671,7 @@ class Referencer extends Visitor { member.id.type === AST_NODE_TYPES.Literal && typeof member.id.value === 'string' ) { - const name = member.id as TSESTree.StringLiteral; + const name = member.id; this.currentScope().defineLiteralIdentifier( name, new TSEnumMemberDefinition(name, member), @@ -717,6 +720,10 @@ class Referencer extends Visitor { this.close(node); } + protected TSSatisfiesExpression(node: TSESTree.TSSatisfiesExpression): void { + this.visitTypeAssertion(node); + } + protected TSTypeAliasDeclaration( node: TSESTree.TSTypeAliasDeclaration, ): void { diff --git a/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts b/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts new file mode 100644 index 00000000000..69dae24ecf2 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts @@ -0,0 +1,4 @@ +const x = 1; +type T = 1; + +x satisfies T; diff --git a/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts.shot b/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts.shot new file mode 100644 index 00000000000..9d6dcc03ce1 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/type-assertion/satisfies.ts.shot @@ -0,0 +1,84 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`type-assertion satisfies 1`] = ` +ScopeManager { + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: Array [ + VariableDefinition$1 { + name: Identifier<"x">, + node: VariableDeclarator$1, + }, + ], + name: "x", + references: Array [ + Reference$1 { + identifier: Identifier<"x">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$2, + writeExpr: Literal$2, + }, + Reference$2 { + identifier: Identifier<"x">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$3 { + defs: Array [ + TypeDefinition$2 { + name: Identifier<"T">, + node: TSTypeAliasDeclaration$3, + }, + ], + name: "T", + references: Array [ + Reference$3 { + identifier: Identifier<"T">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$3, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + ], + scopes: Array [ + GlobalScope$1 { + block: Program$4, + isStrict: false, + references: Array [ + Reference$1, + Reference$2, + Reference$3, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "x" => Variable$2, + "T" => Variable$3, + }, + type: "global", + upper: null, + variables: Array [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + ], + }, + ], +} +`; diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index ba001fbfa5d..b50beb1e1a7 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +**Note:** Version bump only for package @typescript-eslint/shared-fixtures + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 864ddbf70bb..539146e0b43 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "5.41.0", + "version": "5.44.0", "private": true } diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index 09b3607c201..974d40d5d77 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-utils/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +**Note:** Version bump only for package @typescript-eslint/type-utils + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/type-utils + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +### Bug Fixes + +- **eslint-plugin:** isTypeReadonly stack overflow ([#5875](https://github.com/typescript-eslint/typescript-eslint/issues/5875)) ([#5876](https://github.com/typescript-eslint/typescript-eslint/issues/5876)) ([2d9a33c](https://github.com/typescript-eslint/typescript-eslint/commit/2d9a33cfb2db53d76246a59253daaf2abb19ee57)) + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +**Note:** Version bump only for package @typescript-eslint/type-utils + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) ### Bug Fixes diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index aa29529b6cf..01e8306775d 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/type-utils", - "version": "5.41.0", + "version": "5.44.0", "description": "Type utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -34,18 +34,18 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/typescript-estree": "5.41.0", - "@typescript-eslint/utils": "5.41.0", + "@typescript-eslint/typescript-estree": "5.44.0", + "@typescript-eslint/utils": "5.44.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "devDependencies": { - "@typescript-eslint/parser": "5.41.0", + "@typescript-eslint/parser": "5.44.0", "typescript": "*" }, "peerDependencies": { diff --git a/packages/type-utils/project.json b/packages/type-utils/project.json index 24256b3e4d0..efc70d52332 100644 --- a/packages/type-utils/project.json +++ b/packages/type-utils/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/type-utils/**/*.ts"] + } + } + } } diff --git a/packages/type-utils/src/isTypeReadonly.ts b/packages/type-utils/src/isTypeReadonly.ts index cac7690ea3a..7ba2b300089 100644 --- a/packages/type-utils/src/isTypeReadonly.ts +++ b/packages/type-utils/src/isTypeReadonly.ts @@ -113,7 +113,7 @@ function isTypeReadonlyObject( return Readonlyness.Mutable; } - if (indexInfo.type === type) { + if (indexInfo.type === type || seenTypes.has(indexInfo.type)) { return Readonlyness.Readonly; } diff --git a/packages/type-utils/tests/isTypeReadonly.test.ts b/packages/type-utils/tests/isTypeReadonly.test.ts index a66a5426ad8..f200af13204 100644 --- a/packages/type-utils/tests/isTypeReadonly.test.ts +++ b/packages/type-utils/tests/isTypeReadonly.test.ts @@ -141,6 +141,11 @@ describe('isTypeReadonly', () => { it('handles circular readonly PropertySignature inside a readonly IndexSignature', () => runTests('interface Test { readonly [key: string]: Test };')); + + it('handles circular readonly PropertySignature inside interdependent objects', () => + runTests( + 'interface Test1 { readonly [key: string]: Test } interface Test { readonly [key: string]: Test1 }', + )); }); describe('is not readonly', () => { @@ -158,8 +163,23 @@ describe('isTypeReadonly', () => { describe('is not readonly circular', () => { const runTests = runTestIsNotReadonly; - it('handles circular mutable PropertySignature inside a readonly IndexSignature', () => + it('handles circular mutable PropertySignature', () => runTests('interface Test { [key: string]: Test };')); + + it.each([ + [ + 'interface Test1 { [key: string]: Test } interface Test { readonly [key: string]: Test1 }', + ], + [ + 'interface Test1 { readonly [key: string]: Test } interface Test { [key: string]: Test1 }', + ], + [ + 'interface Test1 { [key: string]: Test } interface Test { [key: string]: Test1 }', + ], + ])( + 'handles circular mutable PropertySignature inside interdependent objects', + runTests, + ); }); }); diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index e7cfbe3fb88..e721c00a5ce 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +### Features + +- update to TypeScript 4.9 ([#5716](https://github.com/typescript-eslint/typescript-eslint/issues/5716)) ([4d744ea](https://github.com/typescript-eslint/typescript-eslint/commit/4d744ea10ba03c66eebcb63e8722e9f0165fbeed)) + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/types + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/types + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +**Note:** Version bump only for package @typescript-eslint/types + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/types diff --git a/packages/types/package.json b/packages/types/package.json index fed514c8652..638b4ec633b 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "5.41.0", + "version": "5.44.0", "description": "Types for the TypeScript-ESTree AST spec", "keywords": [ "eslint", @@ -36,7 +36,7 @@ "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "generate:lib": "../../node_modules/.bin/ts-node --files --transpile-only ../scope-manager/tools/generate-lib.ts", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "typecheck": "tsc -p tsconfig.json --noEmit" }, "nx": { diff --git a/packages/types/project.json b/packages/types/project.json index 3719aa0608b..968c1ed0e23 100644 --- a/packages/types/project.json +++ b/packages/types/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": ["@typescript-eslint/ast-spec"] + "implicitDependencies": ["@typescript-eslint/ast-spec"], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/types/**/*.ts"] + } + } + } } diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index 0d92717fcb5..880bafe5b5e 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -46,6 +46,7 @@ type Lib = | 'es2019.object' | 'es2019.string' | 'es2019.symbol' + | 'es2019.intl' | 'es2020.bigint' | 'es2020.date' | 'es2020.promise' diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index cb369c72bf4..f6309d7faef 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,35 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +### Bug Fixes + +- **typescript-estree:** don't consider a cached program unless it's specified in the current `parserOptions.project` config ([#5999](https://github.com/typescript-eslint/typescript-eslint/issues/5999)) ([530e0e6](https://github.com/typescript-eslint/typescript-eslint/commit/530e0e618cdf4bb956149bf8a8484848e1b9a1f5)) + +### Features + +- support parsing `satisfies` operators ([#5717](https://github.com/typescript-eslint/typescript-eslint/issues/5717)) ([20d7cae](https://github.com/typescript-eslint/typescript-eslint/commit/20d7caee35ab84ae6381fdf04338c9e2b9e2bc48)) +- update to TypeScript 4.9 ([#5716](https://github.com/typescript-eslint/typescript-eslint/issues/5716)) ([4d744ea](https://github.com/typescript-eslint/typescript-eslint/commit/4d744ea10ba03c66eebcb63e8722e9f0165fbeed)) + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +### Bug Fixes + +- **typescript-estree:** don't allow single-run unless we're in type-aware linting mode ([#5893](https://github.com/typescript-eslint/typescript-eslint/issues/5893)) ([891b087](https://github.com/typescript-eslint/typescript-eslint/commit/891b0879ba9c64a4722b8c0bf9e599a725b6d6df)) + +### Features + +- **typescript-estree:** clarify docs and error for program project without matching TSConfig ([#5762](https://github.com/typescript-eslint/typescript-eslint/issues/5762)) ([67744db](https://github.com/typescript-eslint/typescript-eslint/commit/67744db31f61acab14b5fe027fbc2844ba198c97)) + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/typescript-estree diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 3832801ef44..b9c668ca851 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "5.41.0", + "version": "5.44.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -37,13 +37,13 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.41.0", - "@typescript-eslint/visitor-keys": "5.41.0", + "@typescript-eslint/types": "5.44.0", + "@typescript-eslint/visitor-keys": "5.44.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -59,7 +59,7 @@ "@types/is-glob": "*", "@types/semver": "*", "@types/tmp": "*", - "@typescript-eslint/shared-fixtures": "5.41.0", + "@typescript-eslint/shared-fixtures": "5.44.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/typescript-estree/project.json b/packages/typescript-estree/project.json index edfec5ab524..61848afaa64 100644 --- a/packages/typescript-estree/project.json +++ b/packages/typescript-estree/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": ["@typescript-eslint/types"] + "implicitDependencies": ["@typescript-eslint/types"], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/typescript-estree/**/*.ts"] + } + } + } } diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 03513031042..2bcf03e6193 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -2895,6 +2895,14 @@ export class Converter { }); } + case SyntaxKind.SatisfiesExpression: { + return this.createNode(node, { + type: AST_NODE_TYPES.TSSatisfiesExpression, + expression: this.convertChild(node.expression), + typeAnnotation: this.convertChild(node.type), + }); + } + default: return this.deeplyCopy(node); } diff --git a/packages/typescript-estree/src/create-program/createWatchProgram.ts b/packages/typescript-estree/src/create-program/createWatchProgram.ts index 24f221c9665..d2d63676fca 100644 --- a/packages/typescript-estree/src/create-program/createWatchProgram.ts +++ b/packages/typescript-estree/src/create-program/createWatchProgram.ts @@ -162,11 +162,21 @@ function getProgramsForProjects(parseSettings: ParseSettings): ts.Program[] { ); } + const currentProjectsFromSettings = new Set(parseSettings.projects); + /* * before we go into the process of attempting to find and update every program * see if we know of a program that contains this file */ for (const [tsconfigPath, existingWatch] of knownWatchProgramMap.entries()) { + if (!currentProjectsFromSettings.has(tsconfigPath)) { + // the current parser run doesn't specify this tsconfig in parserOptions.project + // so we don't want to consider it for caching purposes. + // + // if we did consider it we might return a program for a project + // that wasn't specified in the current parser run (which is obv bad!). + continue; + } let fileList = programFileListCache.get(tsconfigPath); let updatedProgram: ts.Program | null = null; if (!fileList) { diff --git a/packages/typescript-estree/src/parseSettings/inferSingleRun.ts b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts index 723f857ece9..5d765a22ce9 100644 --- a/packages/typescript-estree/src/parseSettings/inferSingleRun.ts +++ b/packages/typescript-estree/src/parseSettings/inferSingleRun.ts @@ -15,6 +15,16 @@ import type { TSESTreeOptions } from '../parser-options'; * @returns Whether this is part of a single run, rather than a long-running process. */ export function inferSingleRun(options: TSESTreeOptions | undefined): boolean { + if ( + // single-run implies type-aware linting - no projects means we can't be in single-run mode + options?.project == null || + // programs passed via options means the user should be managing the programs, so we shouldn't + // be creating our own single-run programs accidentally + options?.programs != null + ) { + return false; + } + // Allow users to explicitly inform us of their intent to perform a single run (or not) with TSESTREE_SINGLE_RUN if (process.env.TSESTREE_SINGLE_RUN === 'false') { return false; diff --git a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts index dc224ebbfe7..75c88ed0c97 100644 --- a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts +++ b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts @@ -6,7 +6,7 @@ import type { ParseSettings } from './index'; * This needs to be kept in sync with the top-level README.md in the * typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=4.2.4 <4.9.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=4.2.4 <5.0.0'; /* * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one diff --git a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts index 575a1e9a244..7561d6e9142 100644 --- a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts @@ -185,6 +185,7 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.TSInterfaceHeritage]: ts.ExpressionWithTypeArguments; [AST_NODE_TYPES.TSIntersectionType]: ts.IntersectionTypeNode; [AST_NODE_TYPES.TSInstantiationExpression]: ts.ExpressionWithTypeArguments; + [AST_NODE_TYPES.TSSatisfiesExpression]: ts.SatisfiesExpression; [AST_NODE_TYPES.TSLiteralType]: ts.LiteralTypeNode; [AST_NODE_TYPES.TSMappedType]: ts.MappedTypeNode; [AST_NODE_TYPES.TSMethodSignature]: diff --git a/packages/typescript-estree/src/ts-estree/ts-nodes.ts b/packages/typescript-estree/src/ts-estree/ts-nodes.ts index 28c30ea8bc3..873f98e5a15 100644 --- a/packages/typescript-estree/src/ts-estree/ts-nodes.ts +++ b/packages/typescript-estree/src/ts-estree/ts-nodes.ts @@ -180,6 +180,7 @@ export type TSNode = | ts.UnparsedSource | ts.JsonMinusNumericLiteral | ts.TemplateLiteralTypeNode + | ts.SatisfiesExpression // JSDoc: Unsupported | ts.JSDoc diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index ab3e9118268..ac87ee62178 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -472,6 +472,11 @@ tester.addFixturePatternConfig('typescript/expressions', { * @see https://github.com/babel/babel/issues/14613 */ 'instantiation-expression', + /** + * TS 4.9 `satisfies` operator has not been implemented in Babel yet. + * @see https://github.com/babel/babel/pull/14211 + */ + 'satisfies-expression', ], }); diff --git a/packages/typescript-estree/tests/ast-alignment/parse.ts b/packages/typescript-estree/tests/ast-alignment/parse.ts index 0479da4b5d0..5837090f47a 100644 --- a/packages/typescript-estree/tests/ast-alignment/parse.ts +++ b/packages/typescript-estree/tests/ast-alignment/parse.ts @@ -30,7 +30,6 @@ function parseWithBabelParser(text: string, jsx = true): File { [ 'estree', { - // @ts-expect-error -- this isn't exposed in the types yet classFeatures: true, }, ], diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index ea1b24da025..0fbb0378b1b 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +**Note:** Version bump only for package @typescript-eslint/utils + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/utils + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/utils + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +### Features + +- **utils:** add `RuleTester` API for top-level dependency constraints ([#5896](https://github.com/typescript-eslint/typescript-eslint/issues/5896)) ([0520d53](https://github.com/typescript-eslint/typescript-eslint/commit/0520d53536af411d66ce2ce0dd478365e67adbac)) + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/utils diff --git a/packages/utils/package.json b/packages/utils/package.json index 03742982697..683dddfe683 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/utils", - "version": "5.41.0", + "version": "5.44.0", "description": "Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -34,16 +34,17 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.41.0", - "@typescript-eslint/types": "5.41.0", - "@typescript-eslint/typescript-estree": "5.41.0", + "@typescript-eslint/scope-manager": "5.44.0", + "@typescript-eslint/types": "5.44.0", + "@typescript-eslint/typescript-estree": "5.44.0", + "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0", "semver": "^7.3.7" }, @@ -51,7 +52,7 @@ "eslint": "^7.0.0 || ^8.0.0" }, "devDependencies": { - "@typescript-eslint/parser": "5.41.0", + "@typescript-eslint/parser": "5.44.0", "typescript": "*" }, "funding": { diff --git a/packages/utils/project.json b/packages/utils/project.json index 24256b3e4d0..7ef570436b4 100644 --- a/packages/utils/project.json +++ b/packages/utils/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/utils/**/*.ts"] + } + } + } } diff --git a/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts b/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts index e81d23d0206..7350de3a975 100644 --- a/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts +++ b/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts @@ -1,9 +1,13 @@ import type * as TSESLintParserType from '@typescript-eslint/parser'; +import assert from 'assert'; import { version as eslintVersion } from 'eslint/package.json'; import * as path from 'path'; import * as semver from 'semver'; -import * as TSESLint from '../../ts-eslint'; +import type { ParserOptions } from '../../ts-eslint/ParserOptions'; +import type { RuleModule } from '../../ts-eslint/Rule'; +import type { RuleTesterTestFrameworkFunction } from '../../ts-eslint/RuleTester'; +import * as BaseRuleTester from '../../ts-eslint/RuleTester'; import { deepMerge } from '../deepMerge'; import type { DependencyConstraint } from './dependencyConstraints'; import { satisfiesAllDependencyConstraints } from './dependencyConstraints'; @@ -11,18 +15,28 @@ import { satisfiesAllDependencyConstraints } from './dependencyConstraints'; const TS_ESLINT_PARSER = '@typescript-eslint/parser'; const ERROR_MESSAGE = `Do not set the parser at the test level unless you want to use a parser other than ${TS_ESLINT_PARSER}`; -type RuleTesterConfig = Omit & { +type RuleTesterConfig = Omit & { parser: typeof TS_ESLINT_PARSER; + /** + * Constraints that must pass in the current environment for any tests to run + */ + dependencyConstraints?: DependencyConstraint; }; interface InvalidTestCase< TMessageIds extends string, TOptions extends Readonly, -> extends TSESLint.InvalidTestCase { +> extends BaseRuleTester.InvalidTestCase { + /** + * Constraints that must pass in the current environment for the test to run + */ dependencyConstraints?: DependencyConstraint; } interface ValidTestCase> - extends TSESLint.ValidTestCase { + extends BaseRuleTester.ValidTestCase { + /** + * Constraints that must pass in the current environment for the test to run + */ dependencyConstraints?: DependencyConstraint; } interface RunTests< @@ -36,27 +50,48 @@ interface RunTests< type AfterAll = (fn: () => void) => void; -class RuleTester extends TSESLint.RuleTester { +function isDescribeWithSkip( + value: unknown, +): value is RuleTesterTestFrameworkFunction & { + skip: RuleTesterTestFrameworkFunction; +} { + return ( + typeof value === 'object' && + value != null && + 'skip' in value && + typeof (value as Record).skip === 'function' + ); +} + +class RuleTester extends BaseRuleTester.RuleTester { readonly #baseOptions: RuleTesterConfig; - static #afterAll: AfterAll; + static #afterAll: AfterAll | undefined; /** * If you supply a value to this property, the rule tester will call this instead of using the version defined on * the global namespace. */ static get afterAll(): AfterAll { return ( - this.#afterAll || + this.#afterAll ?? (typeof afterAll === 'function' ? afterAll : (): void => {}) ); } - static set afterAll(value) { + static set afterAll(value: AfterAll | undefined) { this.#afterAll = value; } + private get staticThis(): typeof RuleTester { + // the cast here is due to https://github.com/microsoft/TypeScript/issues/3841 + return this.constructor as typeof RuleTester; + } + constructor(baseOptions: RuleTesterConfig) { + // eslint will hard-error if you include non-standard top-level properties + const { dependencyConstraints: _, ...baseOptionsSafeForESLint } = + baseOptions; super({ - ...baseOptions, + ...baseOptionsSafeForESLint, parserOptions: { ...baseOptions.parserOptions, warnOnUnsupportedTypeScriptVersion: @@ -73,8 +108,7 @@ class RuleTester extends TSESLint.RuleTester { // make sure that the parser doesn't hold onto file handles between tests // on linux (i.e. our CI env), there can be very a limited number of watch handles available - // the cast here is due to https://github.com/microsoft/TypeScript/issues/3841 - (this.constructor as typeof RuleTester).afterAll(() => { + this.staticThis.afterAll(() => { try { // instead of creating a hard dependency, just use a soft require // a bit weird, but if they're using this tooling, it'll be installed @@ -85,11 +119,11 @@ class RuleTester extends TSESLint.RuleTester { } }); } - private getFilename(testOptions?: TSESLint.ParserOptions): string { + private getFilename(testOptions?: ParserOptions): string { const resolvedOptions = deepMerge( this.#baseOptions.parserOptions, testOptions, - ) as TSESLint.ParserOptions; + ) as ParserOptions; const filename = `file.ts${resolvedOptions.ecmaFeatures?.jsx ? 'x' : ''}`; if (resolvedOptions.project) { return path.join( @@ -107,9 +141,41 @@ class RuleTester extends TSESLint.RuleTester { // This is a lot more explicit run>( name: string, - rule: TSESLint.RuleModule, + rule: RuleModule, testsReadonly: RunTests, ): void { + if ( + this.#baseOptions.dependencyConstraints && + !satisfiesAllDependencyConstraints( + this.#baseOptions.dependencyConstraints, + ) + ) { + if (isDescribeWithSkip(this.staticThis.describe)) { + // for frameworks like mocha or jest that have a "skip" version of their function + // we can provide a nice skipped test! + this.staticThis.describe.skip(name, () => { + this.staticThis.it( + 'All tests skipped due to unsatisfied constructor dependency constraints', + () => {}, + ); + }); + } else { + // otherwise just declare an empty test + this.staticThis.describe(name, () => { + this.staticThis.it( + 'All tests skipped due to unsatisfied constructor dependency constraints', + () => { + // some frameworks error if there are no assertions + assert.equal(true, true); + }, + ); + }); + } + + // don't run any tests because we don't match the base constraint + return; + } + const tests = { // standardize the valid tests as objects valid: testsReadonly.valid.map(test => { @@ -141,14 +207,16 @@ class RuleTester extends TSESLint.RuleTester { single test case. Hugely helps with the string-based valid test cases as it means they don't need to be made objects! + Also removes dependencyConstraints, which we support but ESLint core doesn't. */ - const addFilename = < + const normalizeTest = < T extends | ValidTestCase | InvalidTestCase, - >( - test: T, - ): T => { + >({ + dependencyConstraints: _, + ...test + }: T): Omit => { if (test.parser === TS_ESLINT_PARSER) { throw new Error(ERROR_MESSAGE); } @@ -160,8 +228,8 @@ class RuleTester extends TSESLint.RuleTester { } return test; }; - tests.valid = tests.valid.map(addFilename); - tests.invalid = tests.invalid.map(addFilename); + tests.valid = tests.valid.map(normalizeTest); + tests.invalid = tests.invalid.map(normalizeTest); const hasOnly = ((): boolean => { for (const test of allTestsIterator) { diff --git a/packages/utils/src/ts-eslint/RuleTester.ts b/packages/utils/src/ts-eslint/RuleTester.ts index 7002fc538cd..6c0b98b795f 100644 --- a/packages/utils/src/ts-eslint/RuleTester.ts +++ b/packages/utils/src/ts-eslint/RuleTester.ts @@ -125,6 +125,10 @@ interface TestCaseError { // readonly message?: string | RegExp; } +/** + * @param text a string describing the rule + * @param callback the test callback + */ type RuleTesterTestFrameworkFunction = ( text: string, callback: () => void, @@ -166,31 +170,26 @@ declare class RuleTesterBase { /** * If you supply a value to this property, the rule tester will call this instead of using the version defined on * the global namespace. - * @param text a string describing the rule - * @param callback the test callback */ - static describe?: RuleTesterTestFrameworkFunction; + static get describe(): RuleTesterTestFrameworkFunction; + static set describe(value: RuleTesterTestFrameworkFunction | undefined); /** * If you supply a value to this property, the rule tester will call this instead of using the version defined on * the global namespace. - * @param text a string describing the test case - * @param callback the test callback */ - static it?: RuleTesterTestFrameworkFunction; + static get it(): RuleTesterTestFrameworkFunction; + static set it(value: RuleTesterTestFrameworkFunction | undefined); /** * If you supply a value to this property, the rule tester will call this instead of using the version defined on * the global namespace. - * @param text a string describing the test case - * @param callback the test callback */ - static itOnly?: RuleTesterTestFrameworkFunction; + static get itOnly(): RuleTesterTestFrameworkFunction; + static set itOnly(value: RuleTesterTestFrameworkFunction | undefined); /** * Define a rule for one particular run of tests. - * @param name The name of the rule to define. - * @param rule The rule definition. */ defineRule>( name: string, diff --git a/packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts b/packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts index cab7666196a..57ac48b38c1 100644 --- a/packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts +++ b/packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts @@ -73,8 +73,8 @@ RuleTester.itOnly = jest.fn(); /* eslint-enable jest/prefer-spy-on */ const mockedAfterAll = jest.mocked(RuleTester.afterAll); -const _mockedDescribe = jest.mocked(RuleTester.describe); -const _mockedIt = jest.mocked(RuleTester.it); +const mockedDescribe = jest.mocked(RuleTester.describe); +const mockedIt = jest.mocked(RuleTester.it); const _mockedItOnly = jest.mocked(RuleTester.itOnly); const runSpy = jest.spyOn(BaseRuleTester.prototype, 'run'); const mockedParserClearCaches = jest.mocked(parser.clearCaches); @@ -365,56 +365,32 @@ describe('RuleTester', () => { "invalid": [ { "code": "failing - major", - "dependencyConstraints": { - "totally-real-dependency": "999", - }, "errors": [], "filename": "file.ts", - "only": false, }, { "code": "failing - major.minor", - "dependencyConstraints": { - "totally-real-dependency": "999.0", - }, "errors": [], "filename": "file.ts", - "only": false, }, { "code": "failing - major.minor.patch", - "dependencyConstraints": { - "totally-real-dependency": "999.0.0", - }, "errors": [], "filename": "file.ts", - "only": false, }, ], "valid": [ { "code": "passing - major", - "dependencyConstraints": { - "totally-real-dependency": "10", - }, "filename": "file.ts", - "only": true, }, { "code": "passing - major.minor", - "dependencyConstraints": { - "totally-real-dependency": "10.0", - }, "filename": "file.ts", - "only": true, }, { "code": "passing - major.minor.patch", - "dependencyConstraints": { - "totally-real-dependency": "10.0.0", - }, "filename": "file.ts", - "only": true, }, ], } @@ -485,61 +461,28 @@ describe('RuleTester', () => { "invalid": [ { "code": "failing - major", - "dependencyConstraints": { - "totally-real-dependency": { - "range": "^999", - }, - }, "errors": [], "filename": "file.ts", - "only": false, }, { "code": "failing - major.minor", - "dependencyConstraints": { - "totally-real-dependency": { - "range": ">=999.0", - }, - }, "errors": [], "filename": "file.ts", - "only": false, }, { "code": "failing with options", - "dependencyConstraints": { - "totally-real-dependency-prerelease": { - "options": { - "includePrerelease": false, - }, - "range": "^10", - }, - }, "errors": [], "filename": "file.ts", - "only": false, }, ], "valid": [ { "code": "passing - major", - "dependencyConstraints": { - "totally-real-dependency": { - "range": "^10", - }, - }, "filename": "file.ts", - "only": true, }, { "code": "passing - major.minor", - "dependencyConstraints": { - "totally-real-dependency": { - "range": "<999", - }, - }, "filename": "file.ts", - "only": true, }, ], } @@ -595,49 +538,34 @@ describe('RuleTester', () => { "code": "no constraints is always run", "errors": [], "filename": "file.ts", - "only": true, }, { "code": "empty object is always run", - "dependencyConstraints": {}, "errors": [], "filename": "file.ts", - "only": true, }, { "code": "failing constraint", - "dependencyConstraints": { - "totally-real-dependency": "99999", - }, "errors": [], "filename": "file.ts", - "only": false, }, ], "valid": [ { "code": "string based is always run", "filename": "file.ts", - "only": true, }, { "code": "no constraints is always run", "filename": "file.ts", - "only": true, }, { "code": "empty object is always run", - "dependencyConstraints": {}, "filename": "file.ts", - "only": true, }, { "code": "passing constraint", - "dependencyConstraints": { - "totally-real-dependency": "10", - }, "filename": "file.ts", - "only": true, }, ], } @@ -690,11 +618,13 @@ describe('RuleTester', () => { expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` { "invalid": [ + { + "code": "failing", + "errors": [], + "filename": "file.ts", + }, { "code": "passing", - "dependencyConstraints": { - "totally-real-dependency": "10", - }, "errors": [], "filename": "file.ts", }, @@ -704,16 +634,104 @@ describe('RuleTester', () => { "code": "always passing string test", "filename": "file.ts", }, + { + "code": "failing", + "filename": "file.ts", + }, { "code": "passing", - "dependencyConstraints": { - "totally-real-dependency": "10", - }, "filename": "file.ts", }, ], } `); }); + + describe('constructor constraints', () => { + it('skips all tests if a constructor constraint is not satisifed', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + dependencyConstraints: { + 'totally-real-dependency': '999', + }, + }); + + ruleTester.run('my-rule', NOOP_RULE, { + invalid: [ + { + code: 'failing - major', + errors: [], + }, + ], + valid: [ + { + code: 'passing - major', + }, + ], + }); + + // trigger the describe block + expect(mockedDescribe.mock.calls.length).toBeGreaterThanOrEqual(1); + mockedDescribe.mock.lastCall?.[1](); + expect(mockedDescribe.mock.calls).toMatchInlineSnapshot(` + [ + [ + "my-rule", + [Function], + ], + ] + `); + expect(mockedIt.mock.lastCall).toMatchInlineSnapshot(` + [ + "All tests skipped due to unsatisfied constructor dependency constraints", + [Function], + ] + `); + }); + + it('does not skip all tests if a constructor constraint is satisifed', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + dependencyConstraints: { + 'totally-real-dependency': '10', + }, + }); + + ruleTester.run('my-rule', NOOP_RULE, { + invalid: [ + { + code: 'valid', + errors: [], + }, + ], + valid: [ + { + code: 'valid', + }, + ], + }); + + // trigger the describe block + expect(mockedDescribe.mock.calls.length).toBeGreaterThanOrEqual(1); + mockedDescribe.mock.lastCall?.[1](); + expect(mockedDescribe.mock.calls).toMatchInlineSnapshot(` + [ + [ + "my-rule", + [Function], + ], + [ + "valid", + [Function], + ], + [ + "invalid", + [Function], + ], + ] + `); + // expect(mockedIt.mock.lastCall).toMatchInlineSnapshot(`undefined`); + }); + }); }); }); diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 65df1dacb42..65c9d29a574 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +### Features + +- support parsing `satisfies` operators ([#5717](https://github.com/typescript-eslint/typescript-eslint/issues/5717)) ([20d7cae](https://github.com/typescript-eslint/typescript-eslint/commit/20d7caee35ab84ae6381fdf04338c9e2b9e2bc48)) + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/visitor-keys diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index f0045c158f0..9f117bd178e 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "5.41.0", + "version": "5.44.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "keywords": [ "eslint", @@ -34,12 +34,12 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path='../../.eslintignore'", + "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.41.0", + "@typescript-eslint/types": "5.44.0", "eslint-visitor-keys": "^3.3.0" }, "devDependencies": { diff --git a/packages/visitor-keys/project.json b/packages/visitor-keys/project.json index 24256b3e4d0..c7e3401148e 100644 --- a/packages/visitor-keys/project.json +++ b/packages/visitor-keys/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/visitor-keys/**/*.ts"] + } + } + } } diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index 21648193b38..888246f09d5 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -127,6 +127,7 @@ const additionalKeys: AdditionalKeys = { TSQualifiedName: ['left', 'right'], TSReadonlyKeyword: [], TSRestType: ['typeAnnotation'], + TSSatisfiesExpression: ['typeAnnotation', 'expression'], TSStaticKeyword: [], TSStringKeyword: [], TSSymbolKeyword: [], diff --git a/packages/website-eslint/CHANGELOG.md b/packages/website-eslint/CHANGELOG.md index 2129728bf18..f5490b2af6a 100644 --- a/packages/website-eslint/CHANGELOG.md +++ b/packages/website-eslint/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package @typescript-eslint/website-eslint diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index 8f9670c54fc..e523b6d74dd 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/website-eslint", - "version": "5.41.0", + "version": "5.44.0", "private": true, "description": "ESLint which works in browsers.", "engines": { @@ -16,19 +16,19 @@ "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore" }, "dependencies": { - "@typescript-eslint/types": "5.41.0", - "@typescript-eslint/utils": "5.41.0" + "@typescript-eslint/types": "5.44.0", + "@typescript-eslint/utils": "5.44.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^23.0.0", "@rollup/plugin-json": "^5.0.0", "@rollup/plugin-node-resolve": "^15.0.0", "@rollup/pluginutils": "^5.0.0", - "@typescript-eslint/eslint-plugin": "5.41.0", - "@typescript-eslint/parser": "5.41.0", - "@typescript-eslint/scope-manager": "5.41.0", - "@typescript-eslint/typescript-estree": "5.41.0", - "@typescript-eslint/visitor-keys": "5.41.0", + "@typescript-eslint/eslint-plugin": "5.44.0", + "@typescript-eslint/parser": "5.44.0", + "@typescript-eslint/scope-manager": "5.44.0", + "@typescript-eslint/typescript-estree": "5.44.0", + "@typescript-eslint/visitor-keys": "5.44.0", "eslint": "*", "rollup": "^2.75.4", "rollup-plugin-terser": "^7.0.2", diff --git a/packages/website/.eslintrc.js b/packages/website/.eslintrc.js index 2359a5a4cd5..323ce34a38d 100644 --- a/packages/website/.eslintrc.js +++ b/packages/website/.eslintrc.js @@ -23,6 +23,7 @@ module.exports = { 'react/jsx-no-target-blank': 'off', 'react/no-unescaped-entities': 'off', '@typescript-eslint/internal/prefer-ast-types-enum': 'off', + 'react/jsx-curly-brace-presence': 'error', }, settings: { react: { diff --git a/packages/website/CHANGELOG.md b/packages/website/CHANGELOG.md index 38d0670bfbc..76a67a30561 100644 --- a/packages/website/CHANGELOG.md +++ b/packages/website/CHANGELOG.md @@ -3,6 +3,33 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) + +**Note:** Version bump only for package website + +# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) + +**Note:** Version bump only for package website + +## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) + +**Note:** Version bump only for package website + +# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) + +### Bug Fixes + +- **eslint-plugin:** enable react/jsx-curly-brace-presence lint rule in website package ([#5894](https://github.com/typescript-eslint/typescript-eslint/issues/5894)) ([344322a](https://github.com/typescript-eslint/typescript-eslint/commit/344322add846d03c6c9981e486b09e6ba1196555)) + +### Features + +- **scope-manager:** ignore ECMA version ([#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881)) ([3b8d449](https://github.com/typescript-eslint/typescript-eslint/commit/3b8d449696c319690536a18a48ef32749dc2f559)) +- **website:** Add a happy message to playground output pane when no errors or AST ([#5868](https://github.com/typescript-eslint/typescript-eslint/issues/5868)) ([#5873](https://github.com/typescript-eslint/typescript-eslint/issues/5873)) ([c4e0d86](https://github.com/typescript-eslint/typescript-eslint/commit/c4e0d8678e0398f3ab85510f40ad6f97832b9e6d)) + +### Reverts + +- Revert "feat(scope-manager): ignore ECMA version" (#5888) ([2ee81df](https://github.com/typescript-eslint/typescript-eslint/commit/2ee81df5a365d82ef4b3dfc124d4ec39c7bcb725)), closes [#5888](https://github.com/typescript-eslint/typescript-eslint/issues/5888) [#5881](https://github.com/typescript-eslint/typescript-eslint/issues/5881) + # [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) **Note:** Version bump only for package website diff --git a/packages/website/README.md b/packages/website/README.md index fd7bb57cb42..7f4c12e2372 100644 --- a/packages/website/README.md +++ b/packages/website/README.md @@ -1,5 +1,7 @@ # Website +[![Netlify Status](https://api.netlify.com/api/v1/badges/128d21c7-b2fe-45ad-b141-9878fcf5de3a/deploy-status)](https://app.netlify.com/sites/typescript-eslint/deploys) + This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. ## Installation @@ -26,4 +28,11 @@ This command generates static content into the `build` directory and can be serv ## Deployment -The website is deployed automatically using Netlify. Each pull request into the `main` branch will have a unique preview deployment generated for it. +### Production + +The website is deployed from the `website` branch automatically using Netlify. +That branch gets updated from the `main` branch whenever a new stable version is released (generally weekly). + +### Pull Requests + +Each pull request into the `main` branch will have a unique preview deployment generated for it. diff --git a/packages/website/data/sponsors.json b/packages/website/data/sponsors.json index faef97d207f..49d7576bf77 100644 --- a/packages/website/data/sponsors.json +++ b/packages/website/data/sponsors.json @@ -3,7 +3,6 @@ "id": "Indeed", "image": "https://images.opencollective.com/indeed/4b8725e/logo.png", "name": "Indeed", - "tier": "sponsor", "totalDonations": 1005000, "website": "https://Indeed.com" }, @@ -11,31 +10,27 @@ "id": "Nx (by Nrwl)", "image": "https://images.opencollective.com/nx/0efbe42/logo.png", "name": "Nx (by Nrwl)", - "tier": "sponsor", - "totalDonations": 525000, + "totalDonations": 550000, "website": "https://nx.dev" }, { "id": "ESLint", "image": "https://images.opencollective.com/eslint/96b09dc/logo.png", "name": "ESLint", - "tier": "sponsor", - "totalDonations": 200000, + "totalDonations": 215000, "website": "https://eslint.org/" }, { "id": "Airbnb", "image": "https://images.opencollective.com/airbnb/d327d66/logo.png", "name": "Airbnb", - "tier": "sponsor", - "totalDonations": 135800, + "totalDonations": 140800, "website": "https://www.airbnb.com/" }, { "id": "Coinbase", "image": "https://images.opencollective.com/coinbase/a202856/logo.png", "name": "Coinbase", - "tier": "sponsor", "totalDonations": 120000, "website": "https://blog.coinbase.com/engineering-and-security/home" }, @@ -43,31 +38,34 @@ "id": "n8n.io - n8n GmbH", "image": "https://images.opencollective.com/n8n/dca2f0c/logo.png", "name": "n8n.io - n8n GmbH", - "tier": "sponsor", - "totalDonations": 110000, + "totalDonations": 115000, "website": "https://n8n.io" }, + { + "id": "Sentry", + "image": "https://images.opencollective.com/sentry/9620d33/logo.png", + "name": "Sentry", + "totalDonations": 114800, + "website": "https://sentry.io/welcome/" + }, { "id": "GitBook", "image": "https://images.opencollective.com/gitbook/d35a8e7/logo.png", "name": "GitBook", - "tier": "sponsor", - "totalDonations": 100000, + "totalDonations": 110000, "website": "https://www.gitbook.com" }, { "id": "Codecademy", "image": "https://images.opencollective.com/codecademy/d56a48d/logo.png", "name": "Codecademy", - "tier": "supporter", - "totalDonations": 90000, + "totalDonations": 100000, "website": "https://codecademy.com" }, { "id": "EY Doberman", "image": "https://images.opencollective.com/ey-doberman/b269462/logo.png", "name": "EY Doberman", - "tier": "supporter", "totalDonations": 80400, "website": "https://doberman.co" }, @@ -75,55 +73,48 @@ "id": "Future Processing", "image": "https://images.opencollective.com/future-processing/1410d26/logo.png", "name": "Future Processing", - "tier": "supporter", "totalDonations": 54000, "website": "https://www.future-processing.com/" }, { - "id": "Sentry", - "image": "https://images.opencollective.com/sentry/9620d33/logo.png", - "name": "Sentry", - "tier": "supporter", + "id": "Sourcegraph", + "image": "https://images.opencollective.com/sourcegraph/67e40ff/logo.png", + "name": "Sourcegraph", "totalDonations": 50000, - "website": "https://sentry.io/welcome/" + "website": "https://about.sourcegraph.com" }, { "id": "Whitebox", "image": "https://images.opencollective.com/whiteboxinc/ef0d11d/logo.png", "name": "Whitebox", - "tier": "contributor", "totalDonations": 40000, "website": "https://whitebox.com" }, - { - "id": "Sourcegraph", - "image": "https://images.opencollective.com/sourcegraph/67e40ff/logo.png", - "name": "Sourcegraph", - "tier": "contributor", - "totalDonations": 40000, - "website": "https://about.sourcegraph.com" - }, { "id": "Monito", "image": "https://images.opencollective.com/monito/50fc878/logo.png", "name": "Monito", - "tier": "contributor", "totalDonations": 30000, "website": "https://www.monito.com" }, + { + "id": "Codiga", + "image": "https://images.opencollective.com/codiga/1065f9f/logo.png", + "name": "Codiga", + "totalDonations": 30000, + "website": "https://www.codiga.io" + }, { "id": "STORIS", "image": "https://images.opencollective.com/storis/dfb0e13/logo.png", "name": "STORIS", - "tier": "contributor", - "totalDonations": 25500, + "totalDonations": 27000, "website": "https://www.storis.com/" }, { "id": "revo.js", "image": "https://images.opencollective.com/revojsro/82623a7/logo.png", "name": "revo.js", - "tier": "contributor", "totalDonations": 23000, "website": "https://revojs.ro" }, @@ -131,31 +122,20 @@ "id": "Ian MacLeod", "image": "https://images.opencollective.com/nevir/35c52ef/avatar.png", "name": "Ian MacLeod", - "tier": "contributor", "totalDonations": 22000, "website": "https://twitter.com/nevir" }, - { - "id": "Codiga", - "image": "https://images.opencollective.com/codiga/1065f9f/logo.png", - "name": "Codiga", - "tier": "contributor", - "totalDonations": 20000, - "website": "https://www.codiga.io" - }, { "id": "David Johnston", "image": "https://images.opencollective.com/blacksheepcode/976d69a/avatar.png", "name": "David Johnston", - "tier": "contributor", - "totalDonations": 14500, + "totalDonations": 15000, "website": "https://blacksheepcode.com" }, { "id": "Joe Alden", "image": "https://images.opencollective.com/joealden/44a6738/avatar.png", "name": "Joe Alden", - "tier": "contributor", "totalDonations": 14000, "website": "https://joealden.com" }, @@ -163,23 +143,34 @@ "id": "Gianfranco Palumbo", "image": "https://images.opencollective.com/gianpaj/5d62d25/avatar.png", "name": "Gianfranco Palumbo", - "tier": "contributor", "totalDonations": 10000, "website": "http://gian.xyz" }, + { + "id": "Evil Martians", + "image": "https://images.opencollective.com/evilmartians/707ab4d/logo.png", + "name": "Evil Martians", + "totalDonations": 10000, + "website": "https://evilmartians.com/" + }, { "id": "The Guardian", "image": "https://images.opencollective.com/gdndevelopers/0b72bf0/logo.png", "name": "The Guardian", - "tier": "contributor", "totalDonations": 10000, "website": "https://www.theguardian.com/" }, + { + "id": "Balsa", + "image": "https://images.opencollective.com/balsa/77de498/logo.png", + "name": "Balsa", + "totalDonations": 10000, + "website": "https://balsa.com" + }, { "id": "Laserhub", "image": "https://images.opencollective.com/laserhub/bae6275/logo.png", "name": "Laserhub", - "tier": "contributor", "totalDonations": 10000, "website": "https://laserhub.com/" } diff --git a/packages/website/docusaurusConfig.ts b/packages/website/docusaurusConfig.ts index 0ef589b005a..7ac111820f2 100644 --- a/packages/website/docusaurusConfig.ts +++ b/packages/website/docusaurusConfig.ts @@ -8,6 +8,7 @@ import type { UserThemeConfig as AlgoliaThemeConfig } from '@docusaurus/theme-se import type { Config } from '@docusaurus/types'; import tabsPlugin from 'remark-docusaurus-tabs'; +import { version } from './package.json'; import { generatedRuleDocs } from './plugins/generated-rule-docs'; import { rulesMeta } from './rulesMeta'; @@ -91,6 +92,11 @@ const themeConfig: ThemeCommonConfig & AlgoliaThemeConfig = { label: 'Blog', position: 'left', }, + { + position: 'right', + value: `v${version}`, + type: 'html', + }, { to: 'play', activeBasePath: 'play', diff --git a/packages/website/package.json b/packages/website/package.json index 9469e3450a7..fb681231463 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,12 +1,12 @@ { "name": "website", - "version": "5.41.0", + "version": "5.44.0", "private": true, "scripts": { "build": "docusaurus build", "clear": "docusaurus clear", "format": "prettier --write \"./**/*.{md,mdx,ts,js,tsx,jsx}\" --ignore-path ../../.prettierignore", - "lint": "eslint . --ignore-path ../../.eslintignore", + "lint": "nx lint", "serve": "docusaurus serve", "start": "docusaurus start", "swizzle": "docusaurus swizzle", @@ -15,14 +15,14 @@ }, "dependencies": { "@babel/runtime": "^7.18.3", - "@docusaurus/core": "~2.1.0", - "@docusaurus/plugin-pwa": "~2.1.0", - "@docusaurus/preset-classic": "~2.1.0", - "@docusaurus/remark-plugin-npm2yarn": "~2.1.0", - "@docusaurus/theme-common": "~2.1.0", + "@docusaurus/core": "~2.2.0", + "@docusaurus/plugin-pwa": "~2.2.0", + "@docusaurus/preset-classic": "~2.2.0", + "@docusaurus/remark-plugin-npm2yarn": "~2.2.0", + "@docusaurus/theme-common": "~2.2.0", "@mdx-js/react": "1.6.22", - "@typescript-eslint/parser": "5.41.0", - "@typescript-eslint/website-eslint": "5.41.0", + "@typescript-eslint/parser": "5.44.0", + "@typescript-eslint/website-eslint": "5.44.0", "clsx": "^1.1.1", "eslint": "*", "json-schema": "^0.4.0", @@ -43,12 +43,12 @@ }, "devDependencies": { "@axe-core/playwright": "^4.4.5", - "@docusaurus/module-type-aliases": "~2.1.0", + "@docusaurus/module-type-aliases": "~2.2.0", "@playwright/test": "^1.27.1", "@types/react": "^18.0.9", "@types/react-helmet": "^6.1.5", "@types/react-router-dom": "^5.3.3", - "@typescript-eslint/eslint-plugin": "5.41.0", + "@typescript-eslint/eslint-plugin": "5.44.0", "copy-webpack-plugin": "^11.0.0", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-react": "^7.29.4", diff --git a/packages/website/project.json b/packages/website/project.json index 24256b3e4d0..a9f414356b1 100644 --- a/packages/website/project.json +++ b/packages/website/project.json @@ -1,5 +1,14 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/website/**/*.ts"] + } + } + } } diff --git a/packages/website/sidebars/sidebar.base.js b/packages/website/sidebars/sidebar.base.js index 339ea39e95c..81b219c541c 100644 --- a/packages/website/sidebars/sidebar.base.js +++ b/packages/website/sidebars/sidebar.base.js @@ -52,5 +52,20 @@ module.exports = { 'development/custom-rules', ], }, + { + collapsible: false, + items: [ + 'maintenance/issues', + 'maintenance/pull-requests', + 'maintenance/releases', + 'maintenance/versioning', + ], + label: 'Maintenance', + link: { + id: 'maintenance', + type: 'doc', + }, + type: 'category', + }, ], }; diff --git a/packages/website/src/components/FinancialContributors/Sponsors/index.tsx b/packages/website/src/components/FinancialContributors/Sponsors/index.tsx index c175cdc2615..dfcdad8c7b9 100644 --- a/packages/website/src/components/FinancialContributors/Sponsors/index.tsx +++ b/packages/website/src/components/FinancialContributors/Sponsors/index.tsx @@ -1,36 +1,35 @@ -import sponsors from '@site/data/sponsors.json'; import clsx from 'clsx'; import React from 'react'; import { Sponsor } from '../Sponsor'; -import type { SponsorIncludeOptions } from '../types'; +import type { SponsorData, SponsorIncludeOptions } from '../types'; import styles from './styles.module.css'; interface SponsorsProps { className: string; include?: SponsorIncludeOptions; expanded?: boolean; - tier?: string; + sponsors: SponsorData[]; title: string; + tier: string; } export function Sponsors({ className, include, - tier, title, + tier, + sponsors, }: SponsorsProps): JSX.Element { return (

{title}

    - {sponsors - .filter(sponsor => sponsor.tier === tier) - .map(sponsor => ( -
  • - -
  • - ))} + {sponsors.map(sponsor => ( +
  • + +
  • + ))}
); diff --git a/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css b/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css index e740c76f8bd..08e99b16488 100644 --- a/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css +++ b/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css @@ -15,7 +15,7 @@ .sponsorsTier li { list-style: none; margin: 5px; - max-width: 120px; + max-width: 130px; } .sponsorsTier img { @@ -29,40 +29,42 @@ border: none; } -.tier-sponsor { +.tier-platinum-sponsor { gap: 32px 16px; } -.tier-sponsor img { +.tier-platinum-sponsor img { display: inline-block; - max-height: 120px; - max-width: 120px; - width: 120px; + max-height: 130px; + max-width: 130px; + width: 130px; } -.tier-supporter, -.tier-contributor { +.tier-gold-supporter, +.tier-silver-supporter { align-items: center; } -.tier-supporter { +.tier-gold-supporter { font-size: 0.95rem; line-height: 1; - gap: 24px; - padding-top: 16px; + gap: 12px; + padding-top: 12px; } -.tier-supporter img { +.tier-gold-supporter img { max-height: 75px; max-width: 75px; width: 75px; } -.tier-contributor { - gap: 4px 24px; +.tier-silver-supporter { + gap: 4px 16px; + margin: auto; + max-width: 75%; } -.tier-contributor img { +.tier-silver-supporter img { max-height: 45px; max-width: 45px; width: 45px; @@ -81,4 +83,8 @@ width: auto; padding: 0 60px; } + + .tier-gold-supporter { + margin-bottom: 0; + } } diff --git a/packages/website/src/components/FinancialContributors/index.tsx b/packages/website/src/components/FinancialContributors/index.tsx index 609de140c9a..f952a5a4235 100644 --- a/packages/website/src/components/FinancialContributors/index.tsx +++ b/packages/website/src/components/FinancialContributors/index.tsx @@ -1,4 +1,5 @@ import Link from '@docusaurus/Link'; +import sponsors from '@site/data/sponsors.json'; import clsx from 'clsx'; import React from 'react'; @@ -16,19 +17,22 @@ export function FinancialContributors(): JSX.Element {
diff --git a/packages/website/src/pages/index.tsx b/packages/website/src/pages/index.tsx index 72939ebfce3..8dc318973cd 100644 --- a/packages/website/src/pages/index.tsx +++ b/packages/website/src/pages/index.tsx @@ -1,6 +1,7 @@ import Link from '@docusaurus/Link'; import useBaseUrl from '@docusaurus/useBaseUrl'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import Heading from '@theme/Heading'; import Layout from '@theme/Layout'; import clsx from 'clsx'; import React from 'react'; @@ -108,8 +109,15 @@ const features: FeatureItem[] = [ function Feature({ title, description }: FeatureItem): JSX.Element { return (
-

{title}

- {description} +
+ + {title} + +
+

{description}

Get Started @@ -161,7 +169,9 @@ function Home(): JSX.Element { ))}
-

Financial Contributors

+ + Financial Contributors +
diff --git a/packages/website/src/theme/MDXComponents/RuleAttributes.tsx b/packages/website/src/theme/MDXComponents/RuleAttributes.tsx index c7632e25a9f..e0351d743c7 100644 --- a/packages/website/src/theme/MDXComponents/RuleAttributes.tsx +++ b/packages/website/src/theme/MDXComponents/RuleAttributes.tsx @@ -62,7 +62,7 @@ export function RuleAttributes({ name }: { name: string }): React.ReactNode { . ), - emoji: '๐Ÿ› ', + emoji: '๐Ÿ”ง', }); } diff --git a/patches/typescript+4.8.3.patch b/patches/typescript+4.9.3.patch similarity index 83% rename from patches/typescript+4.8.3.patch rename to patches/typescript+4.9.3.patch index a33162f7dec..520a9fde936 100644 --- a/patches/typescript+4.8.3.patch +++ b/patches/typescript+4.9.3.patch @@ -1,18 +1,18 @@ diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts -index 0fd60ae..02f4fe7 100644 +index 54e4c65..aa00912 100644 --- a/node_modules/typescript/lib/typescript.d.ts +++ b/node_modules/typescript/lib/typescript.d.ts -@@ -425,8 +425,8 @@ declare namespace ts { - JSDocFunctionType = 317, - JSDocVariadicType = 318, - JSDocNamepathType = 319, +@@ -428,8 +428,8 @@ declare namespace ts { + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + /** @deprecated This was only added in 4.7 */ - JSDoc = 320, + JSDoc = 323, - /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 320, - JSDocText = 321, - JSDocTypeLiteral = 322, -@@ -4374,7 +4374,13 @@ declare namespace ts { + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, +@@ -4395,7 +4395,13 @@ declare namespace ts { function symbolName(symbol: Symbol): string; function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined; function getNameOfDeclaration(declaration: Declaration | Expression | undefined): DeclarationName | undefined; @@ -26,7 +26,7 @@ index 0fd60ae..02f4fe7 100644 function getModifiers(node: HasModifiers): readonly Modifier[] | undefined; /** * Gets the JSDoc parameter tags for the node if present. -@@ -4834,7 +4840,13 @@ declare namespace ts { +@@ -4857,7 +4863,13 @@ declare namespace ts { } declare namespace ts { function setTextRange(range: T, location: TextRange | undefined): T; @@ -40,7 +40,7 @@ index 0fd60ae..02f4fe7 100644 function canHaveDecorators(node: Node): node is HasDecorators; } declare namespace ts { -@@ -7924,7 +7936,7 @@ declare namespace ts { +@@ -7958,7 +7970,7 @@ declare namespace ts { * const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) : undefined; * ``` */ diff --git a/tools/generate-sponsors.ts b/tools/generate-sponsors.ts index eadeb1bb450..cbec8141ddc 100644 --- a/tools/generate-sponsors.ts +++ b/tools/generate-sponsors.ts @@ -92,10 +92,6 @@ interface MemberAccount { website: string; } -interface MemberAccountAndTier extends MemberAccount { - tier?: Tier; -} - const excludedNames = new Set([ 'Guest', // Apparent anonymous donor equivalent without an avatar 'Josh Goldberg', // Team member ๐Ÿ’– @@ -121,13 +117,12 @@ async function main(): Promise { ]); const accountsById = account.orders.nodes.reduce< - Record + Record >((accumulator, account) => { const name = account.fromAccount.name || account.fromAccount.id; accumulator[name] = { ...accumulator[name], ...account.fromAccount, - tier: account.tier, }; return accumulator; }, {}); @@ -145,7 +140,7 @@ async function main(): Promise { const allSponsorsConfig = collective.members.nodes .map(member => { const name = member.account.name || member.account.id; - const fromAccount: MemberAccountAndTier = { + const fromAccount = { ...member.account, ...accountsById[name], }; @@ -156,14 +151,13 @@ async function main(): Promise { id: name, image: fromAccount.imageUrl, name: fromAccount.name, - tier: getReportedTierSlug(totalDonations, website), totalDonations, twitterHandle: fromAccount.twitterHandle, website, }; }) - .filter(({ id, tier }) => { - if (uniqueNames.has(id) || !tier) { + .filter(({ id, totalDonations, website }) => { + if (uniqueNames.has(id) || totalDonations < 10000 || !website) { return false; } @@ -196,28 +190,6 @@ async function stringifyObject( }); } -function getReportedTierSlug( - totalDonations: number, - website: string, -): string | undefined { - if (!website) { - return undefined; - } - - if (totalDonations >= 1_000_00) { - return 'sponsor'; - } - if (totalDonations >= 500_00) { - return 'supporter'; - } - - if (totalDonations >= 100_00) { - return 'contributor'; - } - - return undefined; -} - main().catch(error => { console.error(error); process.exitCode = 1; diff --git a/yarn.lock b/yarn.lock index 695d3e06e67..7754c213a4c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -153,33 +153,33 @@ dependencies: axe-core "^4.4.3" -"@babel/code-frame@*", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.8.3": +"@babel/code-frame@*", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.8.3": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== dependencies: "@babel/highlight" "^7.18.6" -"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8", "@babel/compat-data@^7.19.3": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.3.tgz#707b939793f867f5a73b2666e6d9a3396eb03151" - integrity sha512-prBHMK4JYYK+wDjJF1q99KK4JLL+egWS4nmNqdlMUgCExMZ+iZW0hGhyC3VEbsPjvaN0TBhW//VIFwBrk8sEiw== +"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8", "@babel/compat-data@^7.19.3", "@babel/compat-data@^7.20.0": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.1.tgz#f2e6ef7790d8c8dbf03d379502dcc246dcce0b30" + integrity sha512-EWZ4mE2diW3QALKvDMiXnbZpRvlj+nayZ112nK93SnhqOtpdsbVD4W+2tEoT3YNBAG9RBR0ISY758ZkOgsn6pQ== -"@babel/core@*", "@babel/core@^7.11.1", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.15.5", "@babel/core@^7.18.6": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.19.3.tgz#2519f62a51458f43b682d61583c3810e7dcee64c" - integrity sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ== +"@babel/core@*", "@babel/core@^7.11.1", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.15.5", "@babel/core@^7.18.6", "@babel/core@^7.20.2": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.2.tgz#8dc9b1620a673f92d3624bd926dc49a52cf25b92" + integrity sha512-w7DbG8DtMrJcFOi4VrLm+8QM4az8Mo+PuLBKLp2zrYRCow8W/f9xiXm5sN53C8HksCyDQwCKha9JiDoIyPjT2g== dependencies: "@ampproject/remapping" "^2.1.0" "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.19.3" - "@babel/helper-compilation-targets" "^7.19.3" - "@babel/helper-module-transforms" "^7.19.0" - "@babel/helpers" "^7.19.0" - "@babel/parser" "^7.19.3" + "@babel/generator" "^7.20.2" + "@babel/helper-compilation-targets" "^7.20.0" + "@babel/helper-module-transforms" "^7.20.2" + "@babel/helpers" "^7.20.1" + "@babel/parser" "^7.20.2" "@babel/template" "^7.18.10" - "@babel/traverse" "^7.19.3" - "@babel/types" "^7.19.3" + "@babel/traverse" "^7.20.1" + "@babel/types" "^7.20.2" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" @@ -208,7 +208,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/eslint-parser@*", "@babel/eslint-parser@^7.18.2": +"@babel/eslint-parser@*", "@babel/eslint-parser@^7.19.1": version "7.19.1" resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.19.1.tgz#4f68f6b0825489e00a24b41b6a1ae35414ecd2f4" integrity sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ== @@ -217,12 +217,12 @@ eslint-visitor-keys "^2.1.0" semver "^6.3.0" -"@babel/generator@^7.12.5", "@babel/generator@^7.18.7", "@babel/generator@^7.19.3", "@babel/generator@^7.7.2": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.19.3.tgz#d7f4d1300485b4547cb6f94b27d10d237b42bf59" - integrity sha512-fqVZnmp1ncvZU757UzDheKZpfPgatqY59XtW2/j/18H7u76akb8xqvjw82f+i2UKd/ksYsSick/BCLQUUtJ/qQ== +"@babel/generator@^7.12.5", "@babel/generator@^7.18.7", "@babel/generator@^7.20.1", "@babel/generator@^7.20.2", "@babel/generator@^7.7.2": + version "7.20.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.20.4.tgz#4d9f8f0c30be75fd90a0562099a26e5839602ab8" + integrity sha512-luCf7yk/cm7yab6CAW1aiFnmEfBJplb/JojV56MYEK7ziWfGmFlTfmL9Ehwfy4gFhbjBfWO1wj7/TuSbVNEEtA== dependencies: - "@babel/types" "^7.19.3" + "@babel/types" "^7.20.2" "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" @@ -241,12 +241,12 @@ "@babel/helper-explode-assignable-expression" "^7.18.6" "@babel/types" "^7.18.9" -"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.19.0", "@babel/helper-compilation-targets@^7.19.3": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz#a10a04588125675d7c7ae299af86fa1b2ee038ca" - integrity sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg== +"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.19.0", "@babel/helper-compilation-targets@^7.19.3", "@babel/helper-compilation-targets@^7.20.0": + version "7.20.0" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz#6bf5374d424e1b3922822f1d9bdaa43b1a139d0a" + integrity sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ== dependencies: - "@babel/compat-data" "^7.19.3" + "@babel/compat-data" "^7.20.0" "@babel/helper-validator-option" "^7.18.6" browserslist "^4.21.3" semver "^6.3.0" @@ -325,19 +325,19 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz#309b230f04e22c58c6a2c0c0c7e50b216d350c30" - integrity sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ== +"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.19.0", "@babel/helper-module-transforms@^7.20.2": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.20.2.tgz#ac53da669501edd37e658602a21ba14c08748712" + integrity sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA== dependencies: "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-simple-access" "^7.18.6" + "@babel/helper-simple-access" "^7.20.2" "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/helper-validator-identifier" "^7.18.6" + "@babel/helper-validator-identifier" "^7.19.1" "@babel/template" "^7.18.10" - "@babel/traverse" "^7.19.0" - "@babel/types" "^7.19.0" + "@babel/traverse" "^7.20.1" + "@babel/types" "^7.20.2" "@babel/helper-optimise-call-expression@^7.18.6": version "7.18.6" @@ -377,12 +377,12 @@ "@babel/traverse" "^7.18.9" "@babel/types" "^7.18.9" -"@babel/helper-simple-access@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz#d6d8f51f4ac2978068df934b569f08f29788c7ea" - integrity sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g== +"@babel/helper-simple-access@^7.18.6", "@babel/helper-simple-access@^7.20.2": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz#0ab452687fe0c2cfb1e2b9e0015de07fc2d62dd9" + integrity sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA== dependencies: - "@babel/types" "^7.18.6" + "@babel/types" "^7.20.2" "@babel/helper-skip-transparent-expression-wrappers@^7.18.9": version "7.18.9" @@ -398,10 +398,10 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-string-parser@^7.18.10": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz#181f22d28ebe1b3857fa575f5c290b1aaf659b56" - integrity sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw== +"@babel/helper-string-parser@^7.19.4": + version "7.19.4" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" + integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== "@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": version "7.19.1" @@ -423,14 +423,14 @@ "@babel/traverse" "^7.18.9" "@babel/types" "^7.18.9" -"@babel/helpers@^7.12.5", "@babel/helpers@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.19.0.tgz#f30534657faf246ae96551d88dd31e9d1fa1fc18" - integrity sha512-DRBCKGwIEdqY3+rPJgG/dKfQy9+08rHIAJx8q2p+HSWP87s2HCrQmaAMMyMll2kIXKCW0cO1RdQskx15Xakftg== +"@babel/helpers@^7.12.5", "@babel/helpers@^7.20.1": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.1.tgz#2ab7a0fcb0a03b5bf76629196ed63c2d7311f4c9" + integrity sha512-J77mUVaDTUJFZ5BpP6mMn6OIl3rEWymk2ZxDBQJUG3P+PbmyMcF3bYWvz0ma69Af1oobDqT/iAsvzhB58xhQUg== dependencies: "@babel/template" "^7.18.10" - "@babel/traverse" "^7.19.0" - "@babel/types" "^7.19.0" + "@babel/traverse" "^7.20.1" + "@babel/types" "^7.20.0" "@babel/highlight@^7.18.6": version "7.18.6" @@ -441,10 +441,10 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@*", "@babel/parser@^7.1.0", "@babel/parser@^7.12.7", "@babel/parser@^7.14.7", "@babel/parser@^7.18.0", "@babel/parser@^7.18.10", "@babel/parser@^7.18.8", "@babel/parser@^7.19.3": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.3.tgz#8dd36d17c53ff347f9e55c328710321b49479a9a" - integrity sha512-pJ9xOlNWHiy9+FuFP09DEAFbAn4JskgRsVcc169w2xRBC3FRGuQEwjeIMMND9L2zc0iEhO/tGv4Zq+km+hxNpQ== +"@babel/parser@*", "@babel/parser@^7.1.0", "@babel/parser@^7.12.7", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.18.8", "@babel/parser@^7.20.1", "@babel/parser@^7.20.2", "@babel/parser@^7.20.3": + version "7.20.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.3.tgz#5358cf62e380cf69efcb87a7bb922ff88bfac6e2" + integrity sha512-OP/s5a94frIPXwjzEcv5S/tpQfc6XhxYUnmWpgdqMWGgYCuErA3SzozaRAMQgSZWKeTJxht9aWAkUY+0UzvOFg== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" @@ -1191,28 +1191,28 @@ "@babel/parser" "^7.18.10" "@babel/types" "^7.18.10" -"@babel/traverse@^7.12.9", "@babel/traverse@^7.18.8", "@babel/traverse@^7.18.9", "@babel/traverse@^7.19.0", "@babel/traverse@^7.19.3", "@babel/traverse@^7.7.2": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.19.3.tgz#3a3c5348d4988ba60884e8494b0592b2f15a04b4" - integrity sha512-qh5yf6149zhq2sgIXmwjnsvmnNQC2iw70UFjp4olxucKrWd/dvlUsBI88VSLUsnMNF7/vnOiA+nk1+yLoCqROQ== +"@babel/traverse@^7.12.9", "@babel/traverse@^7.18.8", "@babel/traverse@^7.18.9", "@babel/traverse@^7.20.1", "@babel/traverse@^7.7.2": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.1.tgz#9b15ccbf882f6d107eeeecf263fbcdd208777ec8" + integrity sha512-d3tN8fkVJwFLkHkBN479SOsw4DMZnz8cdbL/gvuDuzy3TS6Nfw80HuQqhw1pITbIruHyh7d1fMA47kWzmcUEGA== dependencies: "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.19.3" + "@babel/generator" "^7.20.1" "@babel/helper-environment-visitor" "^7.18.9" "@babel/helper-function-name" "^7.19.0" "@babel/helper-hoist-variables" "^7.18.6" "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.19.3" - "@babel/types" "^7.19.3" + "@babel/parser" "^7.20.1" + "@babel/types" "^7.20.0" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.12.7", "@babel/types@^7.15.6", "@babel/types@^7.18.10", "@babel/types@^7.18.2", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.19.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.3.tgz#fc420e6bbe54880bce6779ffaf315f5e43ec9624" - integrity sha512-hGCaQzIY22DJlDh9CH7NOxgKkFjBk0Cw9xDO1Xmh2151ti7wiGfQ3LauXzL4HP1fmFlTX6XjpRETTpUcv7wQLw== +"@babel/types@^7.0.0", "@babel/types@^7.12.7", "@babel/types@^7.15.6", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.19.3", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.2.tgz#67ac09266606190f496322dbaff360fdaa5e7842" + integrity sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog== dependencies: - "@babel/helper-string-parser" "^7.18.10" + "@babel/helper-string-parser" "^7.19.4" "@babel/helper-validator-identifier" "^7.19.1" to-fast-properties "^2.0.0" @@ -1536,10 +1536,10 @@ "@docsearch/css" "3.1.1" algoliasearch "^4.0.0" -"@docusaurus/core@2.1.0", "@docusaurus/core@~2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/core/-/core-2.1.0.tgz#4aedc306f4c4cd2e0491b641bf78941d4b480ab6" - integrity sha512-/ZJ6xmm+VB9Izbn0/s6h6289cbPy2k4iYFwWDhjiLsVqwa/Y0YBBcXvStfaHccudUC3OfP+26hMk7UCjc50J6Q== +"@docusaurus/core@2.2.0", "@docusaurus/core@~2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/core/-/core-2.2.0.tgz#64c9ee31502c23b93c869f8188f73afaf5fd4867" + integrity sha512-Vd6XOluKQqzG12fEs9prJgDtyn6DPok9vmUWDR2E6/nV5Fl9SVkhEQOBxwObjk3kQh7OY7vguFaLh0jqdApWsA== dependencies: "@babel/core" "^7.18.6" "@babel/generator" "^7.18.7" @@ -1551,13 +1551,13 @@ "@babel/runtime" "^7.18.6" "@babel/runtime-corejs3" "^7.18.6" "@babel/traverse" "^7.18.8" - "@docusaurus/cssnano-preset" "2.1.0" - "@docusaurus/logger" "2.1.0" - "@docusaurus/mdx-loader" "2.1.0" + "@docusaurus/cssnano-preset" "2.2.0" + "@docusaurus/logger" "2.2.0" + "@docusaurus/mdx-loader" "2.2.0" "@docusaurus/react-loadable" "5.5.2" - "@docusaurus/utils" "2.1.0" - "@docusaurus/utils-common" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" + "@docusaurus/utils" "2.2.0" + "@docusaurus/utils-common" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" "@slorber/static-site-generator-webpack-plugin" "^4.0.7" "@svgr/webpack" "^6.2.1" autoprefixer "^10.4.7" @@ -1613,33 +1613,33 @@ webpack-merge "^5.8.0" webpackbar "^5.0.2" -"@docusaurus/cssnano-preset@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/cssnano-preset/-/cssnano-preset-2.1.0.tgz#5b42107769b7cbc61655496090bc262d7788d6ab" - integrity sha512-pRLewcgGhOies6pzsUROfmPStDRdFw+FgV5sMtLr5+4Luv2rty5+b/eSIMMetqUsmg3A9r9bcxHk9bKAKvx3zQ== +"@docusaurus/cssnano-preset@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/cssnano-preset/-/cssnano-preset-2.2.0.tgz#fc05044659051ae74ab4482afcf4a9936e81d523" + integrity sha512-mAAwCo4n66TMWBH1kXnHVZsakW9VAXJzTO4yZukuL3ro4F+JtkMwKfh42EG75K/J/YIFQG5I/Bzy0UH/hFxaTg== dependencies: cssnano-preset-advanced "^5.3.8" postcss "^8.4.14" postcss-sort-media-queries "^4.2.1" tslib "^2.4.0" -"@docusaurus/logger@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/logger/-/logger-2.1.0.tgz#86c97e948f578814d3e61fc2b2ad283043cbe87a" - integrity sha512-uuJx2T6hDBg82joFeyobywPjSOIfeq05GfyKGHThVoXuXsu1KAzMDYcjoDxarb9CoHCI/Dor8R2MoL6zII8x1Q== +"@docusaurus/logger@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/logger/-/logger-2.2.0.tgz#ea2f7feda7b8675485933b87f06d9c976d17423f" + integrity sha512-DF3j1cA5y2nNsu/vk8AG7xwpZu6f5MKkPPMaaIbgXLnWGfm6+wkOeW7kNrxnM95YOhKUkJUophX69nGUnLsm0A== dependencies: chalk "^4.1.2" tslib "^2.4.0" -"@docusaurus/mdx-loader@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/mdx-loader/-/mdx-loader-2.1.0.tgz#3fca9576cc73a22f8e7d9941985590b9e47a8526" - integrity sha512-i97hi7hbQjsD3/8OSFhLy7dbKGH8ryjEzOfyhQIn2CFBYOY3ko0vMVEf3IY9nD3Ld7amYzsZ8153RPkcnXA+Lg== +"@docusaurus/mdx-loader@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/mdx-loader/-/mdx-loader-2.2.0.tgz#fd558f429e5d9403d284bd4214e54d9768b041a0" + integrity sha512-X2bzo3T0jW0VhUU+XdQofcEeozXOTmKQMvc8tUnWRdTnCvj4XEcBVdC3g+/jftceluiwSTNRAX4VBOJdNt18jA== dependencies: "@babel/parser" "^7.18.8" "@babel/traverse" "^7.18.8" - "@docusaurus/logger" "2.1.0" - "@docusaurus/utils" "2.1.0" + "@docusaurus/logger" "2.2.0" + "@docusaurus/utils" "2.2.0" "@mdx-js/mdx" "^1.6.22" escape-html "^1.0.3" file-loader "^6.2.0" @@ -1654,13 +1654,13 @@ url-loader "^4.1.1" webpack "^5.73.0" -"@docusaurus/module-type-aliases@2.1.0", "@docusaurus/module-type-aliases@~2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/module-type-aliases/-/module-type-aliases-2.1.0.tgz#322f8fd5b436af2154c0dddfa173435730e66261" - integrity sha512-Z8WZaK5cis3xEtyfOT817u9xgGUauT0PuuVo85ysnFRX8n7qLN1lTPCkC+aCmFm/UcV8h/W5T4NtIsst94UntQ== +"@docusaurus/module-type-aliases@2.2.0", "@docusaurus/module-type-aliases@~2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/module-type-aliases/-/module-type-aliases-2.2.0.tgz#1e23e54a1bbb6fde1961e4fa395b1b69f4803ba5" + integrity sha512-wDGW4IHKoOr9YuJgy7uYuKWrDrSpsUSDHLZnWQYM9fN7D5EpSmYHjFruUpKWVyxLpD/Wh0rW8hYZwdjJIQUQCQ== dependencies: "@docusaurus/react-loadable" "5.5.2" - "@docusaurus/types" "2.1.0" + "@docusaurus/types" "2.2.0" "@types/history" "^4.7.11" "@types/react" "*" "@types/react-router-config" "*" @@ -1668,18 +1668,18 @@ react-helmet-async "*" react-loadable "npm:@docusaurus/react-loadable@5.5.2" -"@docusaurus/plugin-content-blog@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.1.0.tgz#32b1a7cd4b0026f4a76fce4edc5cfdd0edb1ec42" - integrity sha512-xEp6jlu92HMNUmyRBEeJ4mCW1s77aAEQO4Keez94cUY/Ap7G/r0Awa6xSLff7HL0Fjg8KK1bEbDy7q9voIavdg== - dependencies: - "@docusaurus/core" "2.1.0" - "@docusaurus/logger" "2.1.0" - "@docusaurus/mdx-loader" "2.1.0" - "@docusaurus/types" "2.1.0" - "@docusaurus/utils" "2.1.0" - "@docusaurus/utils-common" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" +"@docusaurus/plugin-content-blog@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.2.0.tgz#dc55982e76771f4e678ac10e26d10e1da2011dc1" + integrity sha512-0mWBinEh0a5J2+8ZJXJXbrCk1tSTNf7Nm4tYAl5h2/xx+PvH/Bnu0V+7mMljYm/1QlDYALNIIaT/JcoZQFUN3w== + dependencies: + "@docusaurus/core" "2.2.0" + "@docusaurus/logger" "2.2.0" + "@docusaurus/mdx-loader" "2.2.0" + "@docusaurus/types" "2.2.0" + "@docusaurus/utils" "2.2.0" + "@docusaurus/utils-common" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" cheerio "^1.0.0-rc.12" feed "^4.2.2" fs-extra "^10.1.0" @@ -1690,18 +1690,18 @@ utility-types "^3.10.0" webpack "^5.73.0" -"@docusaurus/plugin-content-docs@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-docs/-/plugin-content-docs-2.1.0.tgz#3fcdf258c13dde27268ce7108a102b74ca4c279b" - integrity sha512-Rup5pqXrXlKGIC4VgwvioIhGWF7E/NNSlxv+JAxRYpik8VKlWsk9ysrdHIlpX+KJUCO9irnY21kQh2814mlp/Q== - dependencies: - "@docusaurus/core" "2.1.0" - "@docusaurus/logger" "2.1.0" - "@docusaurus/mdx-loader" "2.1.0" - "@docusaurus/module-type-aliases" "2.1.0" - "@docusaurus/types" "2.1.0" - "@docusaurus/utils" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" +"@docusaurus/plugin-content-docs@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-docs/-/plugin-content-docs-2.2.0.tgz#0fcb85226fcdb80dc1e2d4a36ef442a650dcc84d" + integrity sha512-BOazBR0XjzsHE+2K1wpNxz5QZmrJgmm3+0Re0EVPYFGW8qndCWGNtXW/0lGKhecVPML8yyFeAmnUCIs7xM2wPw== + dependencies: + "@docusaurus/core" "2.2.0" + "@docusaurus/logger" "2.2.0" + "@docusaurus/mdx-loader" "2.2.0" + "@docusaurus/module-type-aliases" "2.2.0" + "@docusaurus/types" "2.2.0" + "@docusaurus/utils" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" "@types/react-router-config" "^5.0.6" combine-promises "^1.1.0" fs-extra "^10.1.0" @@ -1712,65 +1712,65 @@ utility-types "^3.10.0" webpack "^5.73.0" -"@docusaurus/plugin-content-pages@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-pages/-/plugin-content-pages-2.1.0.tgz#714d24f71d49dbfed888f50c15e975c2154c3ce8" - integrity sha512-SwZdDZRlObHNKXTnFo7W2aF6U5ZqNVI55Nw2GCBryL7oKQSLeI0lsrMlMXdzn+fS7OuBTd3MJBO1T4Zpz0i/+g== - dependencies: - "@docusaurus/core" "2.1.0" - "@docusaurus/mdx-loader" "2.1.0" - "@docusaurus/types" "2.1.0" - "@docusaurus/utils" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" +"@docusaurus/plugin-content-pages@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-pages/-/plugin-content-pages-2.2.0.tgz#e3f40408787bbe229545dd50595f87e1393bc3ae" + integrity sha512-+OTK3FQHk5WMvdelz8v19PbEbx+CNT6VSpx7nVOvMNs5yJCKvmqBJBQ2ZSxROxhVDYn+CZOlmyrC56NSXzHf6g== + dependencies: + "@docusaurus/core" "2.2.0" + "@docusaurus/mdx-loader" "2.2.0" + "@docusaurus/types" "2.2.0" + "@docusaurus/utils" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" fs-extra "^10.1.0" tslib "^2.4.0" webpack "^5.73.0" -"@docusaurus/plugin-debug@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-debug/-/plugin-debug-2.1.0.tgz#b3145affb40e25cf342174638952a5928ddaf7dc" - integrity sha512-8wsDq3OIfiy6440KLlp/qT5uk+WRHQXIXklNHEeZcar+Of0TZxCNe2FBpv+bzb/0qcdP45ia5i5WmR5OjN6DPw== +"@docusaurus/plugin-debug@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-debug/-/plugin-debug-2.2.0.tgz#b38741d2c492f405fee01ee0ef2e0029cedb689a" + integrity sha512-p9vOep8+7OVl6r/NREEYxf4HMAjV8JMYJ7Bos5fCFO0Wyi9AZEo0sCTliRd7R8+dlJXZEgcngSdxAUo/Q+CJow== dependencies: - "@docusaurus/core" "2.1.0" - "@docusaurus/types" "2.1.0" - "@docusaurus/utils" "2.1.0" + "@docusaurus/core" "2.2.0" + "@docusaurus/types" "2.2.0" + "@docusaurus/utils" "2.2.0" fs-extra "^10.1.0" react-json-view "^1.21.3" tslib "^2.4.0" -"@docusaurus/plugin-google-analytics@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-2.1.0.tgz#c9a7269817b38e43484d38fad9996e39aac4196c" - integrity sha512-4cgeqIly/wcFVbbWP03y1QJJBgH8W+Bv6AVbWnsXNOZa1yB3AO6hf3ZdeQH9x20v9T2pREogVgAH0rSoVnNsgg== +"@docusaurus/plugin-google-analytics@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-2.2.0.tgz#63c7137eff5a1208d2059fea04b5207c037d7954" + integrity sha512-+eZVVxVeEnV5nVQJdey9ZsfyEVMls6VyWTIj8SmX0k5EbqGvnIfET+J2pYEuKQnDIHxy+syRMoRM6AHXdHYGIg== dependencies: - "@docusaurus/core" "2.1.0" - "@docusaurus/types" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" + "@docusaurus/core" "2.2.0" + "@docusaurus/types" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" tslib "^2.4.0" -"@docusaurus/plugin-google-gtag@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-2.1.0.tgz#e4f351dcd98b933538d55bb742650a2a36ca9a32" - integrity sha512-/3aDlv2dMoCeiX2e+DTGvvrdTA+v3cKQV3DbmfsF4ENhvc5nKV23nth04Z3Vq0Ci1ui6Sn80TkhGk/tiCMW2AA== +"@docusaurus/plugin-google-gtag@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-2.2.0.tgz#7b086d169ac5fe9a88aca10ab0fd2bf00c6c6b12" + integrity sha512-6SOgczP/dYdkqUMGTRqgxAS1eTp6MnJDAQMy8VCF1QKbWZmlkx4agHDexihqmYyCujTYHqDAhm1hV26EET54NQ== dependencies: - "@docusaurus/core" "2.1.0" - "@docusaurus/types" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" + "@docusaurus/core" "2.2.0" + "@docusaurus/types" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" tslib "^2.4.0" -"@docusaurus/plugin-pwa@~2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-pwa/-/plugin-pwa-2.1.0.tgz#e6deb53a4c4b10de85c73886a75497a48bedd258" - integrity sha512-SOhEbv9sECaD/c9Ym2Bq6ruK56PAxV9Ftj6Hk2rKFdrASBv3ruri2iCT5YPKMpXqmzWd84GnE2pusMW2s1w2Sw== +"@docusaurus/plugin-pwa@~2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-pwa/-/plugin-pwa-2.2.0.tgz#2aca00d268efbca8f3cf1c3e260b801e6f7f8af5" + integrity sha512-j1ldskYXkKYmWB6V1I0Lv2o9EUhSdGI6pCo0RFGaLijJKLlA9R+F5j+0kWvoyirXM7LRGknkXYYkc50i25R5Sw== dependencies: "@babel/core" "^7.18.6" "@babel/preset-env" "^7.18.6" - "@docusaurus/core" "2.1.0" - "@docusaurus/theme-common" "2.1.0" - "@docusaurus/theme-translations" "2.1.0" - "@docusaurus/types" "2.1.0" - "@docusaurus/utils" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" + "@docusaurus/core" "2.2.0" + "@docusaurus/theme-common" "2.2.0" + "@docusaurus/theme-translations" "2.2.0" + "@docusaurus/types" "2.2.0" + "@docusaurus/utils" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" babel-loader "^8.2.5" clsx "^1.2.1" core-js "^3.23.3" @@ -1782,38 +1782,38 @@ workbox-precaching "^6.5.3" workbox-window "^6.5.3" -"@docusaurus/plugin-sitemap@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-sitemap/-/plugin-sitemap-2.1.0.tgz#b316bb9a42a1717845e26bd4e2d3071748a54b47" - integrity sha512-2Y6Br8drlrZ/jN9MwMBl0aoi9GAjpfyfMBYpaQZXimbK+e9VjYnujXlvQ4SxtM60ASDgtHIAzfVFBkSR/MwRUw== - dependencies: - "@docusaurus/core" "2.1.0" - "@docusaurus/logger" "2.1.0" - "@docusaurus/types" "2.1.0" - "@docusaurus/utils" "2.1.0" - "@docusaurus/utils-common" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" +"@docusaurus/plugin-sitemap@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-sitemap/-/plugin-sitemap-2.2.0.tgz#876da60937886032d63143253d420db6a4b34773" + integrity sha512-0jAmyRDN/aI265CbWZNZuQpFqiZuo+5otk2MylU9iVrz/4J7gSc+ZJ9cy4EHrEsW7PV8s1w18hIEsmcA1YgkKg== + dependencies: + "@docusaurus/core" "2.2.0" + "@docusaurus/logger" "2.2.0" + "@docusaurus/types" "2.2.0" + "@docusaurus/utils" "2.2.0" + "@docusaurus/utils-common" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" fs-extra "^10.1.0" sitemap "^7.1.1" tslib "^2.4.0" -"@docusaurus/preset-classic@~2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/preset-classic/-/preset-classic-2.1.0.tgz#45b23c8ec10c96ded9ece128fac3a39b10bcbc56" - integrity sha512-NQMnaq974K4BcSMXFSJBQ5itniw6RSyW+VT+6i90kGZzTwiuKZmsp0r9lC6BYAvvVMQUNJQwrETmlu7y2XKW7w== - dependencies: - "@docusaurus/core" "2.1.0" - "@docusaurus/plugin-content-blog" "2.1.0" - "@docusaurus/plugin-content-docs" "2.1.0" - "@docusaurus/plugin-content-pages" "2.1.0" - "@docusaurus/plugin-debug" "2.1.0" - "@docusaurus/plugin-google-analytics" "2.1.0" - "@docusaurus/plugin-google-gtag" "2.1.0" - "@docusaurus/plugin-sitemap" "2.1.0" - "@docusaurus/theme-classic" "2.1.0" - "@docusaurus/theme-common" "2.1.0" - "@docusaurus/theme-search-algolia" "2.1.0" - "@docusaurus/types" "2.1.0" +"@docusaurus/preset-classic@~2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/preset-classic/-/preset-classic-2.2.0.tgz#bece5a043eeb74430f7c6c7510000b9c43669eb7" + integrity sha512-yKIWPGNx7BT8v2wjFIWvYrS+nvN04W+UameSFf8lEiJk6pss0kL6SG2MRvyULiI3BDxH+tj6qe02ncpSPGwumg== + dependencies: + "@docusaurus/core" "2.2.0" + "@docusaurus/plugin-content-blog" "2.2.0" + "@docusaurus/plugin-content-docs" "2.2.0" + "@docusaurus/plugin-content-pages" "2.2.0" + "@docusaurus/plugin-debug" "2.2.0" + "@docusaurus/plugin-google-analytics" "2.2.0" + "@docusaurus/plugin-google-gtag" "2.2.0" + "@docusaurus/plugin-sitemap" "2.2.0" + "@docusaurus/theme-classic" "2.2.0" + "@docusaurus/theme-common" "2.2.0" + "@docusaurus/theme-search-algolia" "2.2.0" + "@docusaurus/types" "2.2.0" "@docusaurus/react-loadable@5.5.2", "react-loadable@npm:@docusaurus/react-loadable@5.5.2": version "5.5.2" @@ -1823,32 +1823,32 @@ "@types/react" "*" prop-types "^15.6.2" -"@docusaurus/remark-plugin-npm2yarn@~2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/remark-plugin-npm2yarn/-/remark-plugin-npm2yarn-2.1.0.tgz#45d933002880e55ac70ac33a21894243e8af7643" - integrity sha512-crlbE7XN4m6f5PMW+1K0w1/r6YsJPBHPAnxBu+dwcObBYFKeNnmtci8mBOX/Ey1eeV9wO1yFwaSWKEn1EAbcbQ== +"@docusaurus/remark-plugin-npm2yarn@~2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/remark-plugin-npm2yarn/-/remark-plugin-npm2yarn-2.2.0.tgz#12d433eda8986c475277dd7fb8624b10c8a976ea" + integrity sha512-CFiwzk+0QrlBjkcx4cNV8LQZHgo15aQ3piO0Iao0vGXLc7eupGigDLuE7q3Phc10ELweO+P2gRQTjlBqIQTC+Q== dependencies: npm-to-yarn "^1.0.1" tslib "^2.4.0" unist-util-visit "^2.0.3" -"@docusaurus/theme-classic@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-2.1.0.tgz#d957a907ea8dd035c1cf911d0fbe91d8f24aef3f" - integrity sha512-xn8ZfNMsf7gaSy9+ClFnUu71o7oKgMo5noYSS1hy3svNifRTkrBp6+MReLDsmIaj3mLf2e7+JCBYKBFbaGzQng== - dependencies: - "@docusaurus/core" "2.1.0" - "@docusaurus/mdx-loader" "2.1.0" - "@docusaurus/module-type-aliases" "2.1.0" - "@docusaurus/plugin-content-blog" "2.1.0" - "@docusaurus/plugin-content-docs" "2.1.0" - "@docusaurus/plugin-content-pages" "2.1.0" - "@docusaurus/theme-common" "2.1.0" - "@docusaurus/theme-translations" "2.1.0" - "@docusaurus/types" "2.1.0" - "@docusaurus/utils" "2.1.0" - "@docusaurus/utils-common" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" +"@docusaurus/theme-classic@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-2.2.0.tgz#a048bb1bc077dee74b28bec25f4b84b481863742" + integrity sha512-kjbg/qJPwZ6H1CU/i9d4l/LcFgnuzeiGgMQlt6yPqKo0SOJIBMPuz7Rnu3r/WWbZFPi//o8acclacOzmXdUUEg== + dependencies: + "@docusaurus/core" "2.2.0" + "@docusaurus/mdx-loader" "2.2.0" + "@docusaurus/module-type-aliases" "2.2.0" + "@docusaurus/plugin-content-blog" "2.2.0" + "@docusaurus/plugin-content-docs" "2.2.0" + "@docusaurus/plugin-content-pages" "2.2.0" + "@docusaurus/theme-common" "2.2.0" + "@docusaurus/theme-translations" "2.2.0" + "@docusaurus/types" "2.2.0" + "@docusaurus/utils" "2.2.0" + "@docusaurus/utils-common" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" "@mdx-js/react" "^1.6.22" clsx "^1.2.1" copy-text-to-clipboard "^3.0.1" @@ -1863,17 +1863,17 @@ tslib "^2.4.0" utility-types "^3.10.0" -"@docusaurus/theme-common@2.1.0", "@docusaurus/theme-common@~2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-common/-/theme-common-2.1.0.tgz#dff4d5d1e29efc06125dc06f7b259f689bb3f24d" - integrity sha512-vT1otpVPbKux90YpZUnvknsn5zvpLf+AW1W0EDcpE9up4cDrPqfsh0QoxGHFJnobE2/qftsBFC19BneN4BH8Ag== - dependencies: - "@docusaurus/mdx-loader" "2.1.0" - "@docusaurus/module-type-aliases" "2.1.0" - "@docusaurus/plugin-content-blog" "2.1.0" - "@docusaurus/plugin-content-docs" "2.1.0" - "@docusaurus/plugin-content-pages" "2.1.0" - "@docusaurus/utils" "2.1.0" +"@docusaurus/theme-common@2.2.0", "@docusaurus/theme-common@~2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-common/-/theme-common-2.2.0.tgz#2303498d80448aafdd588b597ce9d6f4cfa930e4" + integrity sha512-R8BnDjYoN90DCL75gP7qYQfSjyitXuP9TdzgsKDmSFPNyrdE3twtPNa2dIN+h+p/pr+PagfxwWbd6dn722A1Dw== + dependencies: + "@docusaurus/mdx-loader" "2.2.0" + "@docusaurus/module-type-aliases" "2.2.0" + "@docusaurus/plugin-content-blog" "2.2.0" + "@docusaurus/plugin-content-docs" "2.2.0" + "@docusaurus/plugin-content-pages" "2.2.0" + "@docusaurus/utils" "2.2.0" "@types/history" "^4.7.11" "@types/react" "*" "@types/react-router-config" "*" @@ -1883,19 +1883,19 @@ tslib "^2.4.0" utility-types "^3.10.0" -"@docusaurus/theme-search-algolia@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-search-algolia/-/theme-search-algolia-2.1.0.tgz#e7cdf64b6f7a15b07c6dcf652fd308cfdaabb0ee" - integrity sha512-rNBvi35VvENhucslEeVPOtbAzBdZY/9j55gdsweGV5bYoAXy4mHB6zTGjealcB4pJ6lJY4a5g75fXXMOlUqPfg== +"@docusaurus/theme-search-algolia@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-search-algolia/-/theme-search-algolia-2.2.0.tgz#77fd9f7a600917e6024fe3ac7fb6cfdf2ce84737" + integrity sha512-2h38B0tqlxgR2FZ9LpAkGrpDWVdXZ7vltfmTdX+4RsDs3A7khiNsmZB+x/x6sA4+G2V2CvrsPMlsYBy5X+cY1w== dependencies: "@docsearch/react" "^3.1.1" - "@docusaurus/core" "2.1.0" - "@docusaurus/logger" "2.1.0" - "@docusaurus/plugin-content-docs" "2.1.0" - "@docusaurus/theme-common" "2.1.0" - "@docusaurus/theme-translations" "2.1.0" - "@docusaurus/utils" "2.1.0" - "@docusaurus/utils-validation" "2.1.0" + "@docusaurus/core" "2.2.0" + "@docusaurus/logger" "2.2.0" + "@docusaurus/plugin-content-docs" "2.2.0" + "@docusaurus/theme-common" "2.2.0" + "@docusaurus/theme-translations" "2.2.0" + "@docusaurus/utils" "2.2.0" + "@docusaurus/utils-validation" "2.2.0" algoliasearch "^4.13.1" algoliasearch-helper "^3.10.0" clsx "^1.2.1" @@ -1905,18 +1905,18 @@ tslib "^2.4.0" utility-types "^3.10.0" -"@docusaurus/theme-translations@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-translations/-/theme-translations-2.1.0.tgz#ce9a2955afd49bff364cfdfd4492b226f6dd3b6e" - integrity sha512-07n2akf2nqWvtJeMy3A+7oSGMuu5F673AovXVwY0aGAux1afzGCiqIFlYW3EP0CujvDJAEFSQi/Tetfh+95JNg== +"@docusaurus/theme-translations@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-translations/-/theme-translations-2.2.0.tgz#5fbd4693679806f80c26eeae1381e1f2c23d83e7" + integrity sha512-3T140AG11OjJrtKlY4pMZ5BzbGRDjNs2co5hJ6uYJG1bVWlhcaFGqkaZ5lCgKflaNHD7UHBHU9Ec5f69jTdd6w== dependencies: fs-extra "^10.1.0" tslib "^2.4.0" -"@docusaurus/types@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/types/-/types-2.1.0.tgz#01e13cd9adb268fffe87b49eb90302d5dc3edd6b" - integrity sha512-BS1ebpJZnGG6esKqsjtEC9U9qSaPylPwlO7cQ1GaIE7J/kMZI3FITnNn0otXXu7c7ZTqhb6+8dOrG6fZn6fqzQ== +"@docusaurus/types@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/types/-/types-2.2.0.tgz#02c577a4041ab7d058a3c214ccb13647e21a9857" + integrity sha512-b6xxyoexfbRNRI8gjblzVOnLr4peCJhGbYGPpJ3LFqpi5nsFfoK4mmDLvWdeah0B7gmJeXabN7nQkFoqeSdmOw== dependencies: "@types/history" "^4.7.11" "@types/react" "*" @@ -1927,30 +1927,30 @@ webpack "^5.73.0" webpack-merge "^5.8.0" -"@docusaurus/utils-common@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/utils-common/-/utils-common-2.1.0.tgz#248434751096f8c6c644ed65eed2a5a070a227f8" - integrity sha512-F2vgmt4yRFgRQR2vyEFGTWeyAdmgKbtmu3sjHObF0tjjx/pN0Iw/c6eCopaH34E6tc9nO0nvp01pwW+/86d1fg== +"@docusaurus/utils-common@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/utils-common/-/utils-common-2.2.0.tgz#a401c1b93a8697dd566baf6ac64f0fdff1641a78" + integrity sha512-qebnerHp+cyovdUseDQyYFvMW1n1nv61zGe5JJfoNQUnjKuApch3IVsz+/lZ9a38pId8kqehC1Ao2bW/s0ntDA== dependencies: tslib "^2.4.0" -"@docusaurus/utils-validation@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/utils-validation/-/utils-validation-2.1.0.tgz#c8cf1d8454d924d9a564fefa86436268f43308e3" - integrity sha512-AMJzWYKL3b7FLltKtDXNLO9Y649V2BXvrnRdnW2AA+PpBnYV78zKLSCz135cuWwRj1ajNtP4onbXdlnyvCijGQ== +"@docusaurus/utils-validation@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/utils-validation/-/utils-validation-2.2.0.tgz#04d4d103137ad0145883971d3aa497f4a1315f25" + integrity sha512-I1hcsG3yoCkasOL5qQAYAfnmVoLei7apugT6m4crQjmDGxq+UkiRrq55UqmDDyZlac/6ax/JC0p+usZ6W4nVyg== dependencies: - "@docusaurus/logger" "2.1.0" - "@docusaurus/utils" "2.1.0" + "@docusaurus/logger" "2.2.0" + "@docusaurus/utils" "2.2.0" joi "^17.6.0" js-yaml "^4.1.0" tslib "^2.4.0" -"@docusaurus/utils@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@docusaurus/utils/-/utils-2.1.0.tgz#b77b45b22e61eb6c2dcad8a7e96f6db0409b655f" - integrity sha512-fPvrfmAuC54n8MjZuG4IysaMdmvN5A/qr7iFLbSGSyDrsbP4fnui6KdZZIa/YOLIPLec8vjZ8RIITJqF18mx4A== +"@docusaurus/utils@2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@docusaurus/utils/-/utils-2.2.0.tgz#3d6f9b7a69168d5c92d371bf21c556a4f50d1da6" + integrity sha512-oNk3cjvx7Tt1Lgh/aeZAmFpGV2pDr5nHKrBVx6hTkzGhrnMuQqLt6UPlQjdYQ3QHXwyF/ZtZMO1D5Pfi0lu7SA== dependencies: - "@docusaurus/logger" "2.1.0" + "@docusaurus/logger" "2.2.0" "@svgr/webpack" "^6.2.1" file-loader "^6.2.0" fs-extra "^10.1.0" @@ -2288,39 +2288,39 @@ resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== -"@lerna/add@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-6.0.1.tgz#6d71084fe7918c96c909bebdc5c27ed6006e09d6" - integrity sha512-cCQIlMODhi3KYyTDOp2WWL4Kj2dKK+MmCiaSf+USrbSWPVVXQGn5Eb11XOMUfYYq3Ula75sWL2urtYwuu8IbmA== - dependencies: - "@lerna/bootstrap" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/filter-options" "6.0.1" - "@lerna/npm-conf" "6.0.1" - "@lerna/validation-error" "6.0.1" +"@lerna/add@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-6.0.3.tgz#341927d00b79ad2a2c0e9aec239b203e5a04fa12" + integrity sha512-EM9hJExG6bV4Hg+XpHTg5nGCuZl3pUEdbYLtyXfMUj/7fpCrUkxB0oESIVhFINVbxHm2pdnUfOxPDHwFSyWBig== + dependencies: + "@lerna/bootstrap" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/filter-options" "6.0.3" + "@lerna/npm-conf" "6.0.3" + "@lerna/validation-error" "6.0.3" dedent "^0.7.0" npm-package-arg "8.1.1" p-map "^4.0.0" pacote "^13.6.1" semver "^7.3.4" -"@lerna/bootstrap@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-6.0.1.tgz#2af0b790b9ce426b78f12543159c8506d77afc28" - integrity sha512-a3DWchHFOiRmDN24VTdmTxKvAqw6Msp8pDCWXq4rgOQSFxqyYECd8BYvmy8dTW6LcC4EG0HqTGRguuEaKCasOw== - dependencies: - "@lerna/command" "6.0.1" - "@lerna/filter-options" "6.0.1" - "@lerna/has-npm-version" "6.0.1" - "@lerna/npm-install" "6.0.1" - "@lerna/package-graph" "6.0.1" - "@lerna/pulse-till-done" "6.0.1" - "@lerna/rimraf-dir" "6.0.1" - "@lerna/run-lifecycle" "6.0.1" - "@lerna/run-topologically" "6.0.1" - "@lerna/symlink-binary" "6.0.1" - "@lerna/symlink-dependencies" "6.0.1" - "@lerna/validation-error" "6.0.1" +"@lerna/bootstrap@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-6.0.3.tgz#806fae9955f25ef5468dd7752c5d5469e3253fa7" + integrity sha512-51eT07tAiH1oca9dNrrLXXH6PJZFY4zKEYDqLkx+zMCG/LsIUnzEfy4JBe1GXbFasXfM24pG8wLKoj1sj1CR3A== + dependencies: + "@lerna/command" "6.0.3" + "@lerna/filter-options" "6.0.3" + "@lerna/has-npm-version" "6.0.3" + "@lerna/npm-install" "6.0.3" + "@lerna/package-graph" "6.0.3" + "@lerna/pulse-till-done" "6.0.3" + "@lerna/rimraf-dir" "6.0.3" + "@lerna/run-lifecycle" "6.0.3" + "@lerna/run-topologically" "6.0.3" + "@lerna/symlink-binary" "6.0.3" + "@lerna/symlink-dependencies" "6.0.3" + "@lerna/validation-error" "6.0.3" "@npmcli/arborist" "5.3.0" dedent "^0.7.0" get-port "^5.1.1" @@ -2332,100 +2332,100 @@ p-waterfall "^2.1.1" semver "^7.3.4" -"@lerna/changed@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-6.0.1.tgz#58614a0c65bfab77fefd142d5edc8282e057ea83" - integrity sha512-b0KzqpNv25ZxH9M/7jtDQaXWUBhVzBVJ8DQ4PjjeoulOCQ+mA9tNQr8UVmeU1UZiaNtNz6Hcy55vyvVvNe07VA== +"@lerna/changed@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-6.0.3.tgz#9dfd7ff944b2409c7762a5e376607ea6e5533585" + integrity sha512-VhKl/vVnrY12z2q1it2FkPkRwC3kyZh++kWMNDbMuUqH1kDHuw7KWJjPw6H4LDpoFWj4Q0hPcNRXxJpNiRWD1g== dependencies: - "@lerna/collect-updates" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/listable" "6.0.1" - "@lerna/output" "6.0.1" + "@lerna/collect-updates" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/listable" "6.0.3" + "@lerna/output" "6.0.3" -"@lerna/check-working-tree@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-6.0.1.tgz#ad71d53941b5c85523499b283e5f44b52eca6276" - integrity sha512-9Ti1EuE3IiJUvvAtFk+Xr9Uw6KehT78ghnI4f/hi4uew5q0Mf2+DMaBNexbhOTpRFBeIq4ucDFhiN091pNkUNw== +"@lerna/check-working-tree@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-6.0.3.tgz#32fb77c5832926f7a66fd1a77bb81a5f46f4fbc5" + integrity sha512-ulAilI5AHvSVluH4QdcRPBbGH6lKU6OARfJFIgFYm8KoPyMESygYIBKBKuTUuyzfp5DOsASq2NiumBW4rpC7hg== dependencies: - "@lerna/collect-uncommitted" "6.0.1" - "@lerna/describe-ref" "6.0.1" - "@lerna/validation-error" "6.0.1" + "@lerna/collect-uncommitted" "6.0.3" + "@lerna/describe-ref" "6.0.3" + "@lerna/validation-error" "6.0.3" -"@lerna/child-process@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-6.0.1.tgz#2141f643a4ed7d38fa9270a80403467a353a3b39" - integrity sha512-5smM8Or/RQkHysNFrUYdrCYlhpr3buNpCYU7T2DPYzOWRPm+X5rCvt/dDOcS3UgYT2jEyS86S5Y7pK2X7eXtmg== +"@lerna/child-process@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-6.0.3.tgz#691040e5e3f64dfe7ef4f4b4d5e6d560e1bef8fc" + integrity sha512-WfFwWdtGA0wvbyq7FB78Gvkd5mVjCGhRoLQY0FIGPQrmZBv3uy7kz5KbRKJlEmoIhVUnFbbV1xURxdqLzNrxoA== dependencies: chalk "^4.1.0" execa "^5.0.0" strong-log-transformer "^2.1.0" -"@lerna/clean@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-6.0.1.tgz#e59f94140e577cbb66f76f78794b97778f78a246" - integrity sha512-ZaWPzzYNkJM7Ib2GWPLSELVBf5nRCGOGBtR9DSLKAore0Me876JLgi4h2R+Y2PVyCvT1kmoQKAclnjxdZbCONA== - dependencies: - "@lerna/command" "6.0.1" - "@lerna/filter-options" "6.0.1" - "@lerna/prompt" "6.0.1" - "@lerna/pulse-till-done" "6.0.1" - "@lerna/rimraf-dir" "6.0.1" +"@lerna/clean@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-6.0.3.tgz#f3519ef27a59b04b0f0f3553b53990d3fbe3ea48" + integrity sha512-4H+leVVVhwnc/GBOkFBIrLBia+MRm2ETZyXdCNckCJZ/e5tm6XHJLprGMSP2QwhJ0H20r+ciiQGzo3TGjQAEwQ== + dependencies: + "@lerna/command" "6.0.3" + "@lerna/filter-options" "6.0.3" + "@lerna/prompt" "6.0.3" + "@lerna/pulse-till-done" "6.0.3" + "@lerna/rimraf-dir" "6.0.3" p-map "^4.0.0" p-map-series "^2.1.0" p-waterfall "^2.1.1" -"@lerna/cli@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-6.0.1.tgz#8a92386702cff815f36104792ad5dc14f11a61a8" - integrity sha512-AuAnUXkBGdts/rmHltrkZucYy11OwYPb/4HM3zxLeq4O30w2ocZIytkOtSkuVKOMPWBZR8b37fNuZBzvxe5OmA== +"@lerna/cli@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-6.0.3.tgz#a5115e1af70817a8afc08a646d3a7ae80a179801" + integrity sha512-4J3dOmDGxl32FJJryE65wXR//FOMFRM0osURnr+sylzStpaEwYO24GN1oVl0YIlnGVBuPIBDpr7n0uyjvfn+2A== dependencies: - "@lerna/global-options" "6.0.1" + "@lerna/global-options" "6.0.3" dedent "^0.7.0" npmlog "^6.0.2" yargs "^16.2.0" -"@lerna/collect-uncommitted@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-6.0.1.tgz#b93f5acfa9c63fffe41bfaaac02a0efad9180b00" - integrity sha512-qPqwmIlSlf8XBJnqMc+6pz6qXQ0Pfjil70FB2IPvoWbfrLvMI6K3I/AXeub9X5fj5HYqNs1XtwhWHJcMFpJddw== +"@lerna/collect-uncommitted@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-6.0.3.tgz#645d24f60d2a47edebef7645cf65c6064cecc025" + integrity sha512-kMKL+U6fIMIHMENez6HrZEYZum+YObhmPzRr/5kkuaYqKPw2up/z1dHYQ/+w+tvzavGP15VKAWy/tZ0WsMuTWw== dependencies: - "@lerna/child-process" "6.0.1" + "@lerna/child-process" "6.0.3" chalk "^4.1.0" npmlog "^6.0.2" -"@lerna/collect-updates@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-6.0.1.tgz#7b4be193ee51a72ccedc20acf845fe32fdee9ee2" - integrity sha512-OwRcLqD1N5znlZM/Ctf031RDkodHVO62byiD35AbHGoGM2EI2TSYyIbqnJ8QsQJMB05/KhIBndL8Mpcdle7/rg== +"@lerna/collect-updates@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-6.0.3.tgz#fbfde0ec93b59c7868f49dc985a06d472e4f6dd1" + integrity sha512-qLuCHaHlVHu/tkdnncG6bQZHz9IFfZ6i7lexWfFnQnZ/aLEY7dVnFUde1jbsTFNMhJesKEbXJshXRcTcplDH6Q== dependencies: - "@lerna/child-process" "6.0.1" - "@lerna/describe-ref" "6.0.1" + "@lerna/child-process" "6.0.3" + "@lerna/describe-ref" "6.0.3" minimatch "^3.0.4" npmlog "^6.0.2" slash "^3.0.0" -"@lerna/command@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-6.0.1.tgz#a429e724237bc3c4a735e8eaef9816f2203cb7dc" - integrity sha512-V9w8M7pMU7KztxaL0+fetTSQYTa12bhTl86ll9VjlgYZ5qUAXk9E42Y8hbVThyYtHEhkRnIMinkWsmH/9YKU/A== - dependencies: - "@lerna/child-process" "6.0.1" - "@lerna/package-graph" "6.0.1" - "@lerna/project" "6.0.1" - "@lerna/validation-error" "6.0.1" - "@lerna/write-log-file" "6.0.1" +"@lerna/command@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-6.0.3.tgz#5c82c388cb2e2a401f1b00bf7454a15458a6c91e" + integrity sha512-iFkIQKLy+Ef2Kf20wOKBdkCA5J64Wjgr3XC62ZdrlDkx6wydfcfJMiXx2bhRqNKMe1cHxlBKGoRKzy8J+tBrHw== + dependencies: + "@lerna/child-process" "6.0.3" + "@lerna/package-graph" "6.0.3" + "@lerna/project" "6.0.3" + "@lerna/validation-error" "6.0.3" + "@lerna/write-log-file" "6.0.3" clone-deep "^4.0.1" dedent "^0.7.0" execa "^5.0.0" is-ci "^2.0.0" npmlog "^6.0.2" -"@lerna/conventional-commits@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-6.0.1.tgz#72dd55aadc7c20eca5af3d03cdcfb613964dafc4" - integrity sha512-6oIGEZKy1GpooW28C0aEDkZ/rVkqpX44knP8Jyb5//1054QogqPhGC5q6J0lZxyhun8dQkpF6XTHlIintI8xow== +"@lerna/conventional-commits@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-6.0.3.tgz#34ecf027b41b1d5182886b6b4c7b674d22897dd7" + integrity sha512-TZof9i0u9TK/Q7LEErjMQAMLf++MjO9NYG81sAuUaNKHMchUOmlFKtJmbT4/JjmgnBX5W0pCUF6DBxr/Bdjj9g== dependencies: - "@lerna/validation-error" "6.0.1" + "@lerna/validation-error" "6.0.3" conventional-changelog-angular "^5.0.12" conventional-changelog-core "^4.2.4" conventional-recommended-bump "^6.1.0" @@ -2436,24 +2436,24 @@ pify "^5.0.0" semver "^7.3.4" -"@lerna/create-symlink@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-6.0.1.tgz#5a9f75f8e5c0d83c39d70240f51284cc5d6770ad" - integrity sha512-ZmLx9SP5De6u1xkD7Z6gMMFuyLKCb+2bodreFe7ryOVP3cOLbmNOmgMgj+gtUgIwIv7BDwX3qFWlPY6B3VW3hQ== +"@lerna/create-symlink@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/create-symlink/-/create-symlink-6.0.3.tgz#e651eb4c304e921bb7f83cbeae7a1af6329f284d" + integrity sha512-myCpuQZ4yYJ5sD+xZiyQHfONBIWlQnM3crIlAvObRYs1U+HwniO9YWk0HcW9dyzplwaYo+Vn55mdi67pTdsdDg== dependencies: cmd-shim "^5.0.0" fs-extra "^9.1.0" npmlog "^6.0.2" -"@lerna/create@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-6.0.1.tgz#7905cef9196cb6a1caff5d7cd78a46fc7ea635a9" - integrity sha512-VuTdvBJDzvAaMBYoKTRMBQC+nfwnihxdA/ekUqBD+W8MMsqPLCGCneyl7JK9RaSSib/10LyRDEmfo79UAndcgQ== +"@lerna/create@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-6.0.3.tgz#525b2e5702a61cee7f44928fdf889474dfa6a615" + integrity sha512-mq3D5laUMe6DWhCoWS0mYJw9PZez/8up81860lk5m7Zojk1Ataa08ZWtGhBgP+p77piNRvmjN89hhjkWiXG6ng== dependencies: - "@lerna/child-process" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/npm-conf" "6.0.1" - "@lerna/validation-error" "6.0.1" + "@lerna/child-process" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/npm-conf" "6.0.3" + "@lerna/validation-error" "6.0.3" dedent "^0.7.0" fs-extra "^9.1.0" init-package-json "^3.0.2" @@ -2467,218 +2467,218 @@ validate-npm-package-name "^4.0.0" yargs-parser "20.2.4" -"@lerna/describe-ref@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-6.0.1.tgz#e9277bcc3c1c839fc7305b808f9dd02a5404aaf8" - integrity sha512-PcTVt4qgAXUPBtWHyqixtwE/eXe56+DFRnfTcJlb4x5F7LJ+7VNpdR/81qfP89Xj10U5IjELXbXmriz1KMwhfw== +"@lerna/describe-ref@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-6.0.3.tgz#f7e5603d686b8f58d836ddc0fb8612fceae9fe39" + integrity sha512-3gj6r9PK+c5SfHQr2j8MQ3qb6xQTrX8KvvGhe3YDW8h3jxx9SAGao8zuvzjI3tVpLx7ZSbxmHqMpyUmnLh5kuw== dependencies: - "@lerna/child-process" "6.0.1" + "@lerna/child-process" "6.0.3" npmlog "^6.0.2" -"@lerna/diff@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-6.0.1.tgz#e8c5d541d74a9aa13a4ac6745f2f0d9531207fd1" - integrity sha512-/pGXH9txA8wX1YJ/KOBXzx0Z2opADBW4HKPCxxHAu+6dTGMbKABDljVT5Np3UpfIrAGDE5fTuf0aGL4vkKUWrg== +"@lerna/diff@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-6.0.3.tgz#6d9bbde092a605e7aa2b9ab69ce6104eec5a0935" + integrity sha512-9syquyKF2oxg0fF736RWT2cf3Oyk4eRXRUNzT0hF0DL/8frQ98H+gF3ftIFVzz1bfPbXtubzBbLDi29bGEG3bQ== dependencies: - "@lerna/child-process" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/validation-error" "6.0.1" + "@lerna/child-process" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/validation-error" "6.0.3" npmlog "^6.0.2" -"@lerna/exec@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-6.0.1.tgz#d2d0785c46b7ceb3758fe75bb6d95d177a0a0ec3" - integrity sha512-x9puoI3091Alp45w7XOGRxThOw45p+tWGPR5TBCEQiiH7f8eF9Dc4WX5HXf31ooK6NmD40eKPYhBgy8oQnJY9w== - dependencies: - "@lerna/child-process" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/filter-options" "6.0.1" - "@lerna/profiler" "6.0.1" - "@lerna/run-topologically" "6.0.1" - "@lerna/validation-error" "6.0.1" +"@lerna/exec@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-6.0.3.tgz#01de1eed611879c73b3ec2b2385256a709ef7bd0" + integrity sha512-4xKTXPQe3/0hrwCao7evcQfaacfROhVkR2zfnQEA+rkKRiV6ILWdvu9jCxI7DMkzoh4DgABVuGAv84CeraunMg== + dependencies: + "@lerna/child-process" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/filter-options" "6.0.3" + "@lerna/profiler" "6.0.3" + "@lerna/run-topologically" "6.0.3" + "@lerna/validation-error" "6.0.3" p-map "^4.0.0" -"@lerna/filter-options@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-6.0.1.tgz#4dbd29a31fb2ac228f72c51b223f17623d1f2c71" - integrity sha512-6KxbBI/2skRl/yQdjugQ1PWrSLq19650z8mltF0HT7B686fj7LlDNtESFOtY6iZ8IPqKBkIavOP0DPmJZd7Szw== +"@lerna/filter-options@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-6.0.3.tgz#9362a2b517be5bc9851678bc7a972e3697d02aaf" + integrity sha512-6WjtXo1nNfOIYxjysGgjnCUqAbIqvoIIyQznLQYPsKN/6NN4U7sXr0P3nbaEgBZ2NHeV+seLWA/wraJ1zDaD4Q== dependencies: - "@lerna/collect-updates" "6.0.1" - "@lerna/filter-packages" "6.0.1" + "@lerna/collect-updates" "6.0.3" + "@lerna/filter-packages" "6.0.3" dedent "^0.7.0" npmlog "^6.0.2" -"@lerna/filter-packages@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-6.0.1.tgz#07f10dc78e852bbba44843b785ebc16f386cedaa" - integrity sha512-2bKhexeF07Urs2b0xYX2OgYUN0EzmS2FSgvw0KT6He48PGOkqgJjU7PIiWdPyOvZdukwm07qXTmJZulAHftceA== +"@lerna/filter-packages@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/filter-packages/-/filter-packages-6.0.3.tgz#db19b3d5f430ca2ae5bacb5b7e140798a905c3c9" + integrity sha512-UlLgondhCpy7mzZWpOoUy8OlLux8YIqw07Obba0TvVLzrVIGIPIeXhqleRchUGVRV1vfQJ2d3vCTx31s1e/V4g== dependencies: - "@lerna/validation-error" "6.0.1" + "@lerna/validation-error" "6.0.3" multimatch "^5.0.0" npmlog "^6.0.2" -"@lerna/get-npm-exec-opts@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/get-npm-exec-opts/-/get-npm-exec-opts-6.0.1.tgz#c766588d030c0ec7170650808957998e8ad70831" - integrity sha512-y2T+ODP8HNzHQn1ldrrPW+n823fGsN2sY0r78yURFxYZnxA9ZINyQ6IAejo5LqHrYN8Qhr++0RHo2tUisIHdKg== +"@lerna/get-npm-exec-opts@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/get-npm-exec-opts/-/get-npm-exec-opts-6.0.3.tgz#d92a6461a626b79167fd2bc11bae38ee6154b965" + integrity sha512-zmKmHkXzmFQIBh2k9rCwzSkearKD+Pz1GypdJ0hAehemnabtW5QQKoGFsGh+7i5mOP0JBUl5kXTYTnwRGOWmYQ== dependencies: npmlog "^6.0.2" -"@lerna/get-packed@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-6.0.1.tgz#d31c10ec10658eeee4306886c100cd9600d6dd78" - integrity sha512-Z/5J5vbjdeGqZcPvUSiszvyizHdsTRiFlpPORWK3YfIsHllUB7QZnVHLg92UnSJrpPE0O1gH+k6ByhhR+3qEdA== +"@lerna/get-packed@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/get-packed/-/get-packed-6.0.3.tgz#c5b016a5cbd9a9472b76a3d879b229982248dacf" + integrity sha512-NX/Ifi/A7iTXasfBioyv/nQ8+IC4gE1SEAuE39/ExGviOM3Jkk5EmeCqwAbhZyhYkxoDBQDJJvagQ5DobpfS7g== dependencies: fs-extra "^9.1.0" ssri "^9.0.1" tar "^6.1.0" -"@lerna/github-client@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-6.0.1.tgz#081d13c2debf312d0e5a2bb2fad6e0c69e1501d6" - integrity sha512-UA7V3XUunJnrfCL2eyW9QsCjBWShv4dCRGUITXmpQJrNIMZIqVbBJzqN9LVHDNc/hEVZGt0EjtHWdpFCgD4ypg== +"@lerna/github-client@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-6.0.3.tgz#3b6f0016a962d5790396a5b9b80f8b73aae46709" + integrity sha512-wMOKH3FIDdE5T8UF88gvhUEBEFD9IUseFHqYt19hgzQyZxAx/hQQE2lqAEosYThPXqtKntIPKQGAfl0gquAMFQ== dependencies: - "@lerna/child-process" "6.0.1" + "@lerna/child-process" "6.0.3" "@octokit/plugin-enterprise-rest" "^6.0.1" "@octokit/rest" "^19.0.3" git-url-parse "^13.1.0" npmlog "^6.0.2" -"@lerna/gitlab-client@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/gitlab-client/-/gitlab-client-6.0.1.tgz#1863b621a1530bc482113cac8791247664dedb2a" - integrity sha512-yyaBKf/OqBAau6xDk1tnMjfkxRpC/j3OwUyXFFGfJFSulWRHpbHoFSfvIgOn/hkjAr9FfHC7TXItRg8qdm38Wg== +"@lerna/gitlab-client@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/gitlab-client/-/gitlab-client-6.0.3.tgz#59b592572dc640f1aa4d89a1393e29478e45ddc8" + integrity sha512-dBZiTsiHJ1j3tkW9JKSqCCZCk6aBiYaU9R/dSnpoPb6ZRthgoMGxtnfdk/1CKZlDargAu12XLJmcXLi7+UbyPg== dependencies: node-fetch "^2.6.1" npmlog "^6.0.2" -"@lerna/global-options@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-6.0.1.tgz#83061d85759c105120ff55716959642ba6eb0eea" - integrity sha512-vzjDI3Bg2NR+cSgfjHWax2bF1HmQYjJF2tmZlT/hJbwhaVMIEnhzHnJ9Yycmm98cdV77xEMlbmk5YD7xgFdG2w== +"@lerna/global-options@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-6.0.3.tgz#e878d45b3ed4b14efecd37306f5e876779d8e2c8" + integrity sha512-XE22Mogzjh8w1rr07hALq40kmPuCr25cQ+K0OwYEiPsyH1dpOM7PSkP4qdT1l2UlWNM64LjgJtnjZ9hsx282VQ== -"@lerna/has-npm-version@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-6.0.1.tgz#ed27a27cad2090069feb3108b105ceec765bec5e" - integrity sha512-ol1onJaauMXK0cQsfRX2rvbhNRyNBY9Ne5trrRjfMROa7Tnr8c3I4+aKQs7m4z1JdWaGBV4xBH+NSZ/esPuaWA== +"@lerna/has-npm-version@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-6.0.3.tgz#db16127ead4819d6cec97cf0597e392def886ee3" + integrity sha512-azZJkKPUWmfZf4AR40t9L6+utZaaCcZcXHOw/vHhmpn9GpZuc8Ck5cM5+8w9bgMglz0YwvTTWvutY2/mCnN5jA== dependencies: - "@lerna/child-process" "6.0.1" + "@lerna/child-process" "6.0.3" semver "^7.3.4" -"@lerna/import@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-6.0.1.tgz#9e869d6bbe82446ee3620c4310ca6232881b7952" - integrity sha512-GrTtIWUCnDf+FqRjenV2OKWU+khoZj0h/etgfXus45PBO2+V/SkkzIY4xof23XphiydUYrSrYtwx2i1aEmk3Wg== - dependencies: - "@lerna/child-process" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/prompt" "6.0.1" - "@lerna/pulse-till-done" "6.0.1" - "@lerna/validation-error" "6.0.1" +"@lerna/import@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-6.0.3.tgz#d881cd2c4420cb91a701fc4fb43da3e70cb9335f" + integrity sha512-AWSwoS9e5udSrJ7E15rR+8V7Hnhli4+3IHh658bpvcGvsIntL7hBZucqWiKRMOmrsafncaBpLkfFgdiyGwy1Pw== + dependencies: + "@lerna/child-process" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/prompt" "6.0.3" + "@lerna/pulse-till-done" "6.0.3" + "@lerna/validation-error" "6.0.3" dedent "^0.7.0" fs-extra "^9.1.0" p-map-series "^2.1.0" -"@lerna/info@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/info/-/info-6.0.1.tgz#68395061ffbd81c7716d60b99b5220c90ade2862" - integrity sha512-QEW7JtJjoR1etUrcft7BnrwPZFHE2JPmt2DoSvSmLISLyy+HlmdXHK+p6Ej3g1ql8gS0GWCacgwmlRZ27CDp5A== +"@lerna/info@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/info/-/info-6.0.3.tgz#b22af49db401580d8e46bf99be07de5c71fab000" + integrity sha512-fqFGejIjjHN9obKUiWgmkknDJliyyRDbv/g6TMvQptxwiGfFBjR55TSPdKyUi9XslIQL5HWMYU7NWzZPiilk/A== dependencies: - "@lerna/command" "6.0.1" - "@lerna/output" "6.0.1" + "@lerna/command" "6.0.3" + "@lerna/output" "6.0.3" envinfo "^7.7.4" -"@lerna/init@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-6.0.1.tgz#babee56707bd19b3c1b82967e3360d1083c04cf9" - integrity sha512-zOMrSij09LSAVUUujpD3y32wkHp8dQ+/dVCp4USlfcGfI+kIPc5prkYCGDO8dEcqkze0pMfDMF23pVNvAf9g7w== +"@lerna/init@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-6.0.3.tgz#48e259c90712792bd5cdc21fa5602ae7083b143d" + integrity sha512-PmEmIJNNpXkGtEINBO5wfFrOlipAwY/4k674mbBWAfVJX+Affyx8yMcnMM28oDnFwe8gi12w5oRI0JcxcjpCFg== dependencies: - "@lerna/child-process" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/project" "6.0.1" + "@lerna/child-process" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/project" "6.0.3" fs-extra "^9.1.0" p-map "^4.0.0" write-json-file "^4.3.0" -"@lerna/link@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-6.0.1.tgz#a94cf3aead92538835d955c6de281c65097f3471" - integrity sha512-VXZ77AWsJCycTu219ZLUHyRzMd5hgivLk5ZyBD1s/emArFvdEmGLscj2RXn3P3w/951b+DNG2Zbi6nek0iJ6DA== +"@lerna/link@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-6.0.3.tgz#364387ba44a347e3dde41d4925d04e42aeb583d9" + integrity sha512-jVTk8QWoVb+gPSkLm6XLtEKdOyqH4WwpOatSZ5zMgiRfjGDiwxCc3dB994JFPJ5FEnr9qCwqXFKjIqef7POIyQ== dependencies: - "@lerna/command" "6.0.1" - "@lerna/package-graph" "6.0.1" - "@lerna/symlink-dependencies" "6.0.1" - "@lerna/validation-error" "6.0.1" + "@lerna/command" "6.0.3" + "@lerna/package-graph" "6.0.3" + "@lerna/symlink-dependencies" "6.0.3" + "@lerna/validation-error" "6.0.3" p-map "^4.0.0" slash "^3.0.0" -"@lerna/list@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-6.0.1.tgz#ab6d056c5d7b99ca0ed6a17d48bf907afd9d970a" - integrity sha512-M9Vneh866E1nlpU88rcUMLR+XTVi3VY0fLPr1OqXdYF+eTe6RkEHUQj8HIk94Rnt02HsWc4+FO31T4i5sf+PaA== +"@lerna/list@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-6.0.3.tgz#83c3fd2b6e4a31e804737a472df15e414819ed66" + integrity sha512-5cQHJ2GAeN2/GV6uMJ4CVIQa3YOcmuNGqzr0DWwatR+5tire6dxFu5uY9Kjn2PYjmFUlwFwVgZzqRrSKPPPiVw== dependencies: - "@lerna/command" "6.0.1" - "@lerna/filter-options" "6.0.1" - "@lerna/listable" "6.0.1" - "@lerna/output" "6.0.1" + "@lerna/command" "6.0.3" + "@lerna/filter-options" "6.0.3" + "@lerna/listable" "6.0.3" + "@lerna/output" "6.0.3" -"@lerna/listable@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-6.0.1.tgz#444e81f6642c198d116e9e6b86d96d10ddf2e147" - integrity sha512-+xEByVX0sbnBW3EBu3XCg71Bz9/dahncmCjNK0kVnZLnQZzfULCndaQeSt+f9KO0VCs8h1tnXdo2uLPm4lThnw== +"@lerna/listable@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-6.0.3.tgz#9460d5efce0850985a9ade03b277184c22d744be" + integrity sha512-7EDzDMc22A/U4O1tCfLzb7MoFQVwwfv6E4F8JSilRupd7mp+2tMi7kvrwS5Dk5imNlHia4e5T0fVWXDUnIO2Sg== dependencies: - "@lerna/query-graph" "6.0.1" + "@lerna/query-graph" "6.0.3" chalk "^4.1.0" columnify "^1.6.0" -"@lerna/log-packed@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-6.0.1.tgz#20fe38b5f18e65392b42bf84cfdda0afc0b62330" - integrity sha512-HTJdZzfBbb5jyk/QU2O6o+yaWRwLoaPruhK+Q3ESTzQ2mlNCr0CI4UKWDcWURWx0EsVsYqsoUHuPZInpIHqCnA== +"@lerna/log-packed@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/log-packed/-/log-packed-6.0.3.tgz#2bcd152613de9abb938e5acde0d62d9a7f1645da" + integrity sha512-MCGAaaywfs8Z0eeG4mhP1u1ma+ORO8c9gGgtpX0LkjJ9HlE23BkCznC8VrJSVTqChtU4tkVp/38hhwEzZmcPFA== dependencies: byte-size "^7.0.0" columnify "^1.6.0" has-unicode "^2.0.1" npmlog "^6.0.2" -"@lerna/npm-conf@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-6.0.1.tgz#fa242a36ef687c7b5207a9d9a85b9e7a4f38bdc5" - integrity sha512-VjxODCnl6QJGoQ8z8AWEID1GO9CtCr2yRyn6NoRdBOTYmzI5KhBBM+nWmyMSOUe0EZI+K5j04/GRzKHg2KXTAQ== +"@lerna/npm-conf@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/npm-conf/-/npm-conf-6.0.3.tgz#94f7c23fe19e5406913e08f160e244a89e309204" + integrity sha512-lX4nAJgScfDmmdPVM9rOO6AzwCY9UPjuNpY6ZpMYkg/FIr1dch5+MFjexpan4VL2KRBNMWUYpDk3U/e2V+7k/A== dependencies: config-chain "^1.1.12" pify "^5.0.0" -"@lerna/npm-dist-tag@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-6.0.1.tgz#4718bdedd82f375ba619319070b694f1113e627b" - integrity sha512-jJKDgnhj6xGqSWGcbwdcbPtoo2m4mHRwqu8iln9e3TMOEyUO9aA4uvd0/18tEAsboOMiLUhhcQ8709iKv21ZEA== +"@lerna/npm-dist-tag@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-6.0.3.tgz#7dda3da557c1c9a729c2942de5eda26e83497dfa" + integrity sha512-wjbVPZQq1bdfikldEJ6TICikKhVh8gOWPsqR0iTj5iCDRUAiQM5HscrCApTIrB/hASyKV2xG60ruCpMG2Qo6AQ== dependencies: - "@lerna/otplease" "6.0.1" + "@lerna/otplease" "6.0.3" npm-package-arg "8.1.1" npm-registry-fetch "^13.3.0" npmlog "^6.0.2" -"@lerna/npm-install@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-6.0.1.tgz#5d6f0c62b34f2bfeb8f20b81b08f01ca0d3ed60b" - integrity sha512-saDJSyhhl/wxgZSzRx2/pr0wsMR+hZpdhLGd1lZgo5XzLq3ogK+BxPFz3AK3xhRnNaMq96gDQ3xmeetoV53lwQ== +"@lerna/npm-install@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-6.0.3.tgz#6ea619ddbbe2c995477209ebf8d21fd46dd87ff5" + integrity sha512-mBypvdtt1feL7L6f8++/tChn/5bM+KbYX06WXjW3yUT81o9geg6p7aaZoxfP6A8ff5XVsTFFL7j86MwPxTsTQQ== dependencies: - "@lerna/child-process" "6.0.1" - "@lerna/get-npm-exec-opts" "6.0.1" + "@lerna/child-process" "6.0.3" + "@lerna/get-npm-exec-opts" "6.0.3" fs-extra "^9.1.0" npm-package-arg "8.1.1" npmlog "^6.0.2" signal-exit "^3.0.3" write-pkg "^4.0.0" -"@lerna/npm-publish@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-6.0.1.tgz#ffbca4be5b971df978a60917460ee8f28b1c62b7" - integrity sha512-hgzF9fOfp010z7PJtqNLxNXiHr6u4UDVwiX8g22rhJKBh9Ekrq7N9NS3mF0l+RcleRU/jJKYtZ0Ci3fICaaRUg== +"@lerna/npm-publish@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-6.0.3.tgz#6c34b566c65fb6131a2bf91e518b58be65ffda41" + integrity sha512-RpjnUy7wWIWu7DJB2NQJ8rNgKz+yPoIXpzYOktIjb7gUrL+Ks4KjfbrgGuYk2nWFUEAzJlsOSJ8ggAQUoNIL9Q== dependencies: - "@lerna/otplease" "6.0.1" - "@lerna/run-lifecycle" "6.0.1" + "@lerna/otplease" "6.0.3" + "@lerna/run-lifecycle" "6.0.3" fs-extra "^9.1.0" libnpmpublish "^6.0.4" npm-package-arg "8.1.1" @@ -2686,85 +2686,85 @@ pify "^5.0.0" read-package-json "^5.0.1" -"@lerna/npm-run-script@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-6.0.1.tgz#3a255aa6f37a5e2369a37a8ddcb2709f84019ed1" - integrity sha512-K+D4LEoVRuBoKRImprkVRHIORu0xouX+c6yI1B93KWHKJ60H8qCeB0gQkA30pFALx3qG07bXVnFmfK9SGQXD3Q== +"@lerna/npm-run-script@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-6.0.3.tgz#5a2054d8c9317d5cfe7f2437ad835ae3e9efae03" + integrity sha512-+IEo8BYBdyEzgdqHCw3sr4ZxAM9g7SoSdo+oskXyrwD8zScH+OadAZz+DukCad8kXlaSPWSNEc42biP2o611Ew== dependencies: - "@lerna/child-process" "6.0.1" - "@lerna/get-npm-exec-opts" "6.0.1" + "@lerna/child-process" "6.0.3" + "@lerna/get-npm-exec-opts" "6.0.3" npmlog "^6.0.2" -"@lerna/otplease@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-6.0.1.tgz#da5467c603565940c1f91e65d077abf25d96df7f" - integrity sha512-RrP8GtfE9yz37GuuCFqddR3mVIQc1ulUpAaaDNK4AOTb7gM0aCsTN7V2gCGBk1zdIsBuvNvNqt5jpWm4U6/EAA== +"@lerna/otplease@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-6.0.3.tgz#0523f396c83b4f2c3141824569b5827903489808" + integrity sha512-bNQn6IRrMJ8D6yF9v52KHiWD/XDB7ZkN2ziQjPwwOBcbzoVrDRCar91HQK7ygudPgmyjQNQZOrZqGlSTrh/wqA== dependencies: - "@lerna/prompt" "6.0.1" + "@lerna/prompt" "6.0.3" -"@lerna/output@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/output/-/output-6.0.1.tgz#5e301ad0bed607ee139cf207fd75ed1e5fac7908" - integrity sha512-4jZ3fgaCbnsTZ353/lXE/3w20Cge6G3iUoESVip+JE2yhZ8rWgPISG8RFR0YGEtSgq2yC9AgGnGlvmOnAc4SAQ== +"@lerna/output@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/output/-/output-6.0.3.tgz#582f6785193f2bb3d4e059f5276bcc7bfd8e01b5" + integrity sha512-/x7Bv4MVRwBJM6UVbfUYE1wjTGNUEnpFCHNc15MCUU3VY9O/Y1ZYq7iZHkYGMT9BmNeMS64fHBkDEwoqoJn/vA== dependencies: npmlog "^6.0.2" -"@lerna/pack-directory@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-6.0.1.tgz#4a0bf61b7cb1b1b3f1fb95afec987a7c63ff9f95" - integrity sha512-vNgS5Rs7s6khOYuHE5nTds0VDfHBH8YNGvV1s0yGAg/Zkivi7bOTs8jDQFiYhQX3HOTC1/85BLhGQ3zcDHlrew== +"@lerna/pack-directory@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/pack-directory/-/pack-directory-6.0.3.tgz#90b7e89420ffad96807b001455bee38ae04e449e" + integrity sha512-LVs/q6Dn1kXIxHA80e/Jo9AmAsesPs7TbBAxZ40lHXhJFvvFgx0r2bY+r3eV+77sziGmyKVBorgcbkEfFehfZw== dependencies: - "@lerna/get-packed" "6.0.1" - "@lerna/package" "6.0.1" - "@lerna/run-lifecycle" "6.0.1" - "@lerna/temp-write" "6.0.1" + "@lerna/get-packed" "6.0.3" + "@lerna/package" "6.0.3" + "@lerna/run-lifecycle" "6.0.3" + "@lerna/temp-write" "6.0.3" npm-packlist "^5.1.1" npmlog "^6.0.2" tar "^6.1.0" -"@lerna/package-graph@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-6.0.1.tgz#db72ab9ed45933d1518de7f7389a6c79e6059336" - integrity sha512-OMppRWpfSaI6HO/Tc5FVpNefgOsCc3/DzaMLme6QTTpbEwD3EhvQ3Xx0MgsGMPdmZhWp/WOoAJsVRnLa+l03gg== +"@lerna/package-graph@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-6.0.3.tgz#cc6452c9935569104ccf1ae600d48f325ca523b3" + integrity sha512-Xf4FxCpCFB2vSI+D/LR3k+ueSmam5Tx7LRbGiZnzdfXPvPqukZfcAXHLZbSzuJiv5NKVyG/VJjZk4SCogjrFTQ== dependencies: - "@lerna/prerelease-id-from-version" "6.0.1" - "@lerna/validation-error" "6.0.1" + "@lerna/prerelease-id-from-version" "6.0.3" + "@lerna/validation-error" "6.0.3" npm-package-arg "8.1.1" npmlog "^6.0.2" semver "^7.3.4" -"@lerna/package@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/package/-/package-6.0.1.tgz#cb950e574b1ea3ef5cd8cf62b3c4308f6c869122" - integrity sha512-vCwyiLVJ4K3SR6KZleglq1dUXIiYGmk3b+NrFWP/Z3dhVE0C+RqgxSsAS4aaUNMSO2KSI0dBdce7BT/D+FdpIQ== +"@lerna/package@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/package/-/package-6.0.3.tgz#7211f7e3d1e1b4a22c666b9abd2ebb4edebc9cfa" + integrity sha512-UbaZSRT3lTmncmPCws0V6XcZhc0GLRm8LtspxyLeDjhyP0EabKAbaB3HVCelPn69CM81UtP8CLkTh+NpUNH2Aw== dependencies: load-json-file "^6.2.0" npm-package-arg "8.1.1" write-pkg "^4.0.0" -"@lerna/prerelease-id-from-version@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-6.0.1.tgz#a47980aa6c78deaa36430d03b6300bc889960b50" - integrity sha512-aZBs/FinztKjNXlk0cW99FpABynZzZwlmJuW4h9nMrQPgWoaDAERfImbefIH/lcpxdRuuGtClyZUFBOSq8ppfg== +"@lerna/prerelease-id-from-version@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/prerelease-id-from-version/-/prerelease-id-from-version-6.0.3.tgz#17f50960fb7df1b3f8eb4e36b86c5917f1e0fab4" + integrity sha512-mgDo6L93mlcg7GDgWZfRGxHmR5xFPQSMQJZeyU/5VY6sCbTnwTDSpYOoce6m71E4v15iJ/G5EKIchq8yVUIBBw== dependencies: semver "^7.3.4" -"@lerna/profiler@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/profiler/-/profiler-6.0.1.tgz#2b7a043e6999823ad97a7ddaea0ed7f338032f92" - integrity sha512-vZrgF5pDhYWY/Gx7MjtyOgTVMA6swDV2+xPZwkvRD1Z0XpWEIn5d79zRN/1SBpdMNozC7Lj++1oEbCGNWhy/ow== +"@lerna/profiler@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/profiler/-/profiler-6.0.3.tgz#cc9ba5ce9bd78fcc47ad105380877341cba17b3b" + integrity sha512-tkFZEAALPtPOzcEZlH554SHH4rMORmpWH45mF3Py3mpy+HpQXLZmYlxot+wr3jPXkXQzwaIgDe0DMYJhhC8T9A== dependencies: fs-extra "^9.1.0" npmlog "^6.0.2" upath "^2.0.1" -"@lerna/project@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/project/-/project-6.0.1.tgz#0d4a6dbca1943478d554d4a3a610968caf9b303a" - integrity sha512-/n2QuAEgImbwUqrJND15FxYu29p/mLTUpL/8cSg6IUlOQRFyXteESRyl8A2Ex7Wj00FMbtB13vgbmTdkTgKL0A== +"@lerna/project@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/project/-/project-6.0.3.tgz#40f59c9c0063b1098c3af85d2b8a7aa9e321a4ff" + integrity sha512-YBSWZRnRlwAwDuLKx7M7f1HyiqDY/dH+eMadHgasWgFJ5yHhtkwMCZTNgHvMAXTdN6iGb/A6mkPAN5zWhcDYBw== dependencies: - "@lerna/package" "6.0.1" - "@lerna/validation-error" "6.0.1" + "@lerna/package" "6.0.3" + "@lerna/validation-error" "6.0.3" cosmiconfig "^7.0.0" dedent "^0.7.0" dot-prop "^6.0.1" @@ -2777,38 +2777,38 @@ resolve-from "^5.0.0" write-json-file "^4.3.0" -"@lerna/prompt@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-6.0.1.tgz#2a744b168ce4a29b7c66d500258a3f65b3f028e2" - integrity sha512-faR7oVdHBO3QTJ6o9kUEDPpyjCftd/CCa1rAC6q8f3vlLfCPrTym0qT+DcOBFGpDQh4m2dmGfJZgpXIVi6bMbg== +"@lerna/prompt@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-6.0.3.tgz#251ad1c80a15dbdfca0153cf02044ec455e471a4" + integrity sha512-M/3poJp9Nqr2xJ2nB9gE6qsCwxJqvVyEnM5mMPUzRpfCvAtVa6Rhx/x60I20GSogb8/J9Zapav3MNoX2rdv2UQ== dependencies: inquirer "^8.2.4" npmlog "^6.0.2" -"@lerna/publish@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-6.0.1.tgz#9448a35a87e2c986c8919114698f3a314a9a2574" - integrity sha512-xIleRwCuPHtShNSPc6RDH33Z+EO1E4O0LOhPq5qTwanNPYh5eL6bDHBsox44BbMD9dhhI4PUrqIGTu3AoKdDxg== - dependencies: - "@lerna/check-working-tree" "6.0.1" - "@lerna/child-process" "6.0.1" - "@lerna/collect-updates" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/describe-ref" "6.0.1" - "@lerna/log-packed" "6.0.1" - "@lerna/npm-conf" "6.0.1" - "@lerna/npm-dist-tag" "6.0.1" - "@lerna/npm-publish" "6.0.1" - "@lerna/otplease" "6.0.1" - "@lerna/output" "6.0.1" - "@lerna/pack-directory" "6.0.1" - "@lerna/prerelease-id-from-version" "6.0.1" - "@lerna/prompt" "6.0.1" - "@lerna/pulse-till-done" "6.0.1" - "@lerna/run-lifecycle" "6.0.1" - "@lerna/run-topologically" "6.0.1" - "@lerna/validation-error" "6.0.1" - "@lerna/version" "6.0.1" +"@lerna/publish@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-6.0.3.tgz#029b30d6bb877102beca153d81e305939bfcf859" + integrity sha512-Vv9aDQEQv+5NRfaIpZpBqXcgfXkb18kpIUqBI4bAnqC/t168Gn/UzOxxjVkl5wuAKJ2sj8tDoZTEIb/DVoV53Q== + dependencies: + "@lerna/check-working-tree" "6.0.3" + "@lerna/child-process" "6.0.3" + "@lerna/collect-updates" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/describe-ref" "6.0.3" + "@lerna/log-packed" "6.0.3" + "@lerna/npm-conf" "6.0.3" + "@lerna/npm-dist-tag" "6.0.3" + "@lerna/npm-publish" "6.0.3" + "@lerna/otplease" "6.0.3" + "@lerna/output" "6.0.3" + "@lerna/pack-directory" "6.0.3" + "@lerna/prerelease-id-from-version" "6.0.3" + "@lerna/prompt" "6.0.3" + "@lerna/pulse-till-done" "6.0.3" + "@lerna/run-lifecycle" "6.0.3" + "@lerna/run-topologically" "6.0.3" + "@lerna/validation-error" "6.0.3" + "@lerna/version" "6.0.3" fs-extra "^9.1.0" libnpmaccess "^6.0.3" npm-package-arg "8.1.1" @@ -2819,99 +2819,99 @@ pacote "^13.6.1" semver "^7.3.4" -"@lerna/pulse-till-done@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/pulse-till-done/-/pulse-till-done-6.0.1.tgz#d23985aea1ba25bb33cf74b39f36f2b7a5d21791" - integrity sha512-DK5Ylh/O7Vzn9ObEggvoHdLxc1hiXsDZ4fUvSmi50kc5QrMrk+xo6OyPgIaDBhYxj6lm3TQ1KkvWnRgiEynKAg== +"@lerna/pulse-till-done@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/pulse-till-done/-/pulse-till-done-6.0.3.tgz#d3ec687799023b8baccc6af003cce738a114ea9c" + integrity sha512-/HjvHtaDCr0qJuhJT6PuwoHFvPsZMB7f/GnEYGIzS0+ovwOTrbULD6ESo2lWcsFnxJ3tWv2OPIKEiHkJ0y1PCg== dependencies: npmlog "^6.0.2" -"@lerna/query-graph@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-6.0.1.tgz#f72b55f0ee4662d06167e639e975019e5c004c59" - integrity sha512-X8Z63Ax5a9nXgNBG+IAXEdCL4MG88akr7L4mBvKiTPrK5VgP46YzuZSaSoPI8bU67MlWBkSYQWAJJ5t0HEtKTw== +"@lerna/query-graph@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-6.0.3.tgz#302498ac354cb7a58f5447822d8524582fd0143f" + integrity sha512-Se3G4ZIckjleki/BWUEInITfLTuNIYkqeStq50KEz74xhQ9jQs7ZLAOWc/Qxn3EPngCTLe8WqhLVeHFOfxgjvw== dependencies: - "@lerna/package-graph" "6.0.1" + "@lerna/package-graph" "6.0.3" -"@lerna/resolve-symlink@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-6.0.1.tgz#30c3ccf4c730451754ce7aa002772f26dd757c20" - integrity sha512-btosycLN+2lpqou6pz0Oeq4XIKHDIn0NvdnuCBLxtuBOBNIkdlx5QWKCtZ31GYKbCUt55w1DSGL64kfVuejVQQ== +"@lerna/resolve-symlink@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/resolve-symlink/-/resolve-symlink-6.0.3.tgz#9dd4b2903e4a0bb11b000fb220efd11ce5909f28" + integrity sha512-9HkEl7kMQ4sZ3/+FEOhBt2rYoQP2cXQlhV7TNIej6SGaR0VtKe98ciM9bQAdkc/rOZtyZLc2cFBoUd10NEjzoA== dependencies: fs-extra "^9.1.0" npmlog "^6.0.2" read-cmd-shim "^3.0.0" -"@lerna/rimraf-dir@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-6.0.1.tgz#e52ba283a4c39ade75792c23d0c6dcec65dcbbf4" - integrity sha512-rBFkwrxEQWFfZV5IMiPfGVubOquvOTNsPJPUf5tZoPAqKHXVQi5iYZGB65VG8JA7eFenZxh5mVErX2gtWFh1Ew== +"@lerna/rimraf-dir@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-6.0.3.tgz#be12f791a7cf1d455d25ae0cdc70d45767ee343f" + integrity sha512-jyC/PVL3rqC83l5Wphog8pSOmDbe5CIAHn9TeHvV8f/zdJnNE3zKXWTNjvyLgB1aPneQ4i2V+3BgdfpeDVAtHQ== dependencies: - "@lerna/child-process" "6.0.1" + "@lerna/child-process" "6.0.3" npmlog "^6.0.2" path-exists "^4.0.0" rimraf "^3.0.2" -"@lerna/run-lifecycle@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-6.0.1.tgz#ab94838cf7daa1edd6228be0a161b38ec1a42a0b" - integrity sha512-gC7rnV3mrgFFIM8GlHc3d22ovYHoExu9CuIAxN26CVrMq7iEYxWoxYvweqVANsCHR7CVbs+dsDx8/TP1pQG8wg== +"@lerna/run-lifecycle@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/run-lifecycle/-/run-lifecycle-6.0.3.tgz#84dad555d56c3aa668e1cbdf2a5b98f8baabcc64" + integrity sha512-qnFOyp9de81FA2HSBuXtW7LSklF+T6WtFkYH9q3kOJY/EghZlgzFmQYFHgJ/xVYxNu75QDuv6fsfJu4EtrR7ag== dependencies: - "@lerna/npm-conf" "6.0.1" + "@lerna/npm-conf" "6.0.3" "@npmcli/run-script" "^4.1.7" npmlog "^6.0.2" p-queue "^6.6.2" -"@lerna/run-topologically@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-6.0.1.tgz#dcf26259e57b224d4aad2e3b259555ecd2f226ea" - integrity sha512-p4J9RvOUyDUjQ21tDh7Durci9YnuBu3T8WXD8xu5ZwcxVnawK1h5B8kP4V1R5L/jwNqkXsAnlLwikPVGQ5Iptw== +"@lerna/run-topologically@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-6.0.3.tgz#37d7ec11bafeb9be3f93a56a012444fec5982efc" + integrity sha512-nN0kcOO1TzWlxg5byM1V12tm4+lvchbawc1mNje1KsujdzE4gSwD84ub4SFRNkUUBmsPvTGysorhtXckQfqQWw== dependencies: - "@lerna/query-graph" "6.0.1" + "@lerna/query-graph" "6.0.3" p-queue "^6.6.2" -"@lerna/run@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-6.0.1.tgz#20d3c77fa8faad01b915214b95477ae5390c8b45" - integrity sha512-F1vvpaevsWCjaQs3NlBegH54izm3cO3Qbg/cRRzPZMK4Jo7gE1ddL7+zCIq0zGt6aeVqRGBOtUMk4SvNGkzI4w== - dependencies: - "@lerna/command" "6.0.1" - "@lerna/filter-options" "6.0.1" - "@lerna/npm-run-script" "6.0.1" - "@lerna/output" "6.0.1" - "@lerna/profiler" "6.0.1" - "@lerna/run-topologically" "6.0.1" - "@lerna/timer" "6.0.1" - "@lerna/validation-error" "6.0.1" +"@lerna/run@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-6.0.3.tgz#604c49708a348c72683c6cf1575d2e9b7ff9e07b" + integrity sha512-eiMF/Pfld/ngH+Emkwyxqf40WWEK6bQE2KhRtu0xyuSIFycFlZJursd72ylTnvZAX3Qx4P4drdHaFnfWyuglcw== + dependencies: + "@lerna/command" "6.0.3" + "@lerna/filter-options" "6.0.3" + "@lerna/npm-run-script" "6.0.3" + "@lerna/output" "6.0.3" + "@lerna/profiler" "6.0.3" + "@lerna/run-topologically" "6.0.3" + "@lerna/timer" "6.0.3" + "@lerna/validation-error" "6.0.3" fs-extra "^9.1.0" p-map "^4.0.0" -"@lerna/symlink-binary@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-6.0.1.tgz#b9278650c3360cc518e0d313d9999cd740a2c054" - integrity sha512-TcwxDMgU9w+hGl0EeYihPytVRKV0KTeZZW4Bq6NEtjTCIIuKWxZjcY5ocxW22i6BClBvfFAJqkf+e+i3Nixlhg== +"@lerna/symlink-binary@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/symlink-binary/-/symlink-binary-6.0.3.tgz#5f40b6e8e9f2230adefd87165c3e81420d25be25" + integrity sha512-bRrPPuZoYvEDc8eTGwhTLQwRmtjYfD/hBVElqhfAlUTPcuA36VrQwBkmhGAUKcIDmEHTVk6IHNiFb/JwuiOSYA== dependencies: - "@lerna/create-symlink" "6.0.1" - "@lerna/package" "6.0.1" + "@lerna/create-symlink" "6.0.3" + "@lerna/package" "6.0.3" fs-extra "^9.1.0" p-map "^4.0.0" -"@lerna/symlink-dependencies@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-6.0.1.tgz#28c01b3f910c1d13b1d447d27c47f5c76efd0096" - integrity sha512-ImyqjLjMBu0ORGO9gYHr9oDgN/5QeeGuELtYNweLS5vMNSH1dokQW9fqZSrgfCJPbxeCizBcDTi/Knqg17ebkA== +"@lerna/symlink-dependencies@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/symlink-dependencies/-/symlink-dependencies-6.0.3.tgz#552cd9a4dc81ad925d583c392022ae9321c065d0" + integrity sha512-4DmKLZkJ9oyQ8DXdXCMT6fns6w6G/7h9D2pXGNOYa/IFtjb4mKDMBfJ61XhmvTlxrEzjEc9CnqMeO7BQBXWt8A== dependencies: - "@lerna/create-symlink" "6.0.1" - "@lerna/resolve-symlink" "6.0.1" - "@lerna/symlink-binary" "6.0.1" + "@lerna/create-symlink" "6.0.3" + "@lerna/resolve-symlink" "6.0.3" + "@lerna/symlink-binary" "6.0.3" fs-extra "^9.1.0" p-map "^4.0.0" p-map-series "^2.1.0" -"@lerna/temp-write@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/temp-write/-/temp-write-6.0.1.tgz#84f8aa3f74b6150706a70430c68815517f5301cf" - integrity sha512-9eklYncDnwTnGF9o14GOrZU05ZK5n6/x5XYRQHbuLfK5T9pmOiUyl6sO1613cZygUMaWHHi7BLtBPiw2CklqXQ== +"@lerna/temp-write@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/temp-write/-/temp-write-6.0.3.tgz#b08e329ca122a24f4f9687f1f928b2022724baf5" + integrity sha512-ws+EHk7Bp4hR6liusGk8K+ybnh9iOSkCnHD6d+avwa2lMYtX28v93kle/Y5JbTghjumgDUF9/C+EQg51zIVQmw== dependencies: graceful-fs "^4.1.15" is-stream "^2.0.0" @@ -2919,37 +2919,37 @@ temp-dir "^1.0.0" uuid "^8.3.2" -"@lerna/timer@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/timer/-/timer-6.0.1.tgz#eb10242c48a1246e1bf216af305974fbd6332d39" - integrity sha512-FLoga8iprKmRkh9jO+LP4Bm7MZLO4wNHM4LML4Dlh9CPwcIOWTteI8wSgRXvEJpt33IRIoPOUnfL3iHh8WwaYA== +"@lerna/timer@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/timer/-/timer-6.0.3.tgz#73bb3e301c76c8fabcb35831b1d398f272287f5a" + integrity sha512-Ywfu3cGi0pV9vN4ki8oTu+qdJArMwrW3MiXL3/2fospKRdGL7sGCuXlS9Byd+aduMvmMwKbnX0EW+6R7Np+qSg== -"@lerna/validation-error@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/validation-error/-/validation-error-6.0.1.tgz#afcf6b193eae86d64df9561afb7698696257304f" - integrity sha512-kjAxfFY1pDltwoCTvMQCbnpBwMXBFuvE4hdi8qePhBQ1Lf0PlTOI4ZqMFIkaTud+oujzysDXraTJbYTjc+C+zw== +"@lerna/validation-error@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/validation-error/-/validation-error-6.0.3.tgz#9e0cc7fdb2117f82db9a73eaf287f6b46521f2c9" + integrity sha512-cWYKMFne/euWnW4w7ry+RvDkj8iVNYMrbRF86Px/609GXFOoOwEROJyvTlRp1BgCmC2/3KzidyBletN/R3JHEA== dependencies: npmlog "^6.0.2" -"@lerna/version@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-6.0.1.tgz#988675be8ea29f1548cb4554c257c2cc94b78084" - integrity sha512-d/addeHVsRFWx3fb/XZIh6f23KuEC9Fn3ytpaMzA8rlLF3Nob1opIR98ZfUz7Nf+skpIV1QiIbXdJTZzIKvd9g== - dependencies: - "@lerna/check-working-tree" "6.0.1" - "@lerna/child-process" "6.0.1" - "@lerna/collect-updates" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/conventional-commits" "6.0.1" - "@lerna/github-client" "6.0.1" - "@lerna/gitlab-client" "6.0.1" - "@lerna/output" "6.0.1" - "@lerna/prerelease-id-from-version" "6.0.1" - "@lerna/prompt" "6.0.1" - "@lerna/run-lifecycle" "6.0.1" - "@lerna/run-topologically" "6.0.1" - "@lerna/temp-write" "6.0.1" - "@lerna/validation-error" "6.0.1" +"@lerna/version@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-6.0.3.tgz#de44ecf9598e77e22b5088bd3a62b76a87bcf683" + integrity sha512-ssQhsK51IBMabB+RpQPIRn93iozwMRpvfh2vVIVdTs76j8r/1ljIs3gLXPDzLo9RbyLcou+VKi3c/7coCAwsdw== + dependencies: + "@lerna/check-working-tree" "6.0.3" + "@lerna/child-process" "6.0.3" + "@lerna/collect-updates" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/conventional-commits" "6.0.3" + "@lerna/github-client" "6.0.3" + "@lerna/gitlab-client" "6.0.3" + "@lerna/output" "6.0.3" + "@lerna/prerelease-id-from-version" "6.0.3" + "@lerna/prompt" "6.0.3" + "@lerna/run-lifecycle" "6.0.3" + "@lerna/run-topologically" "6.0.3" + "@lerna/temp-write" "6.0.3" + "@lerna/validation-error" "6.0.3" "@nrwl/devkit" ">=14.8.6 < 16" chalk "^4.1.0" dedent "^0.7.0" @@ -2964,10 +2964,10 @@ slash "^3.0.0" write-json-file "^4.3.0" -"@lerna/write-log-file@6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/@lerna/write-log-file/-/write-log-file-6.0.1.tgz#4335d5e08686f8250ebae9d7f56b64452bd90cd3" - integrity sha512-fJGDE8rlE35DwKSqV8M1VV2xw/vQlgwTwURjNOMvd1Ar23Aa9CkJC4XAwc9uUgIku34IsWUM8MNbw9ClSsJaqw== +"@lerna/write-log-file@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@lerna/write-log-file/-/write-log-file-6.0.3.tgz#21f4c2fcf6a41a3420c46a571dd52fb5c8a64242" + integrity sha512-xZFC9IgGkvuv1MUIC7EKD5ltlljgLlz7isbfQ2QHAqOmGJG6jPqa0Yo38pGe8wEDtGSVgtlUGkx7iHK22MawEA== dependencies: npmlog "^6.0.2" write-file-atomic "^4.0.1" @@ -4124,10 +4124,10 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@12.20.24", "@types/node@^17.0.5", "@types/node@^18.0.0": - version "18.8.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.8.3.tgz#ce750ab4017effa51aed6a7230651778d54e327c" - integrity sha512-0os9vz6BpGwxGe9LOhgP/ncvYN5Tx1fNcd2TM3rD/aCGBkysb+ZWpXEocG24h6ZzOi13+VB8HndAQFezsSOw1w== +"@types/node@*", "@types/node@12.20.24", "@types/node@^17.0.5", "@types/node@^18.11.9": + version "18.11.9" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" + integrity sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg== "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -6969,7 +6969,7 @@ eslint-plugin-simple-import-sort@^8.0.0: resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-8.0.0.tgz#9d9a2372b0606e999ea841b10458a370a6ccc160" integrity sha512-bXgJQ+lqhtQBCuWY/FUWdB27j4+lqcvXv5rUARkzbeWLwea+S5eBZEQrhnO+WgX3ZoJHVj0cn943iyXwByHHQw== -eslint-scope@5.1.1: +eslint-scope@5.1.1, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== @@ -9178,7 +9178,7 @@ jest-runtime@^29.1.2: slash "^3.0.0" strip-bom "^4.0.0" -jest-snapshot@*, jest-snapshot@^27.0.2, jest-snapshot@^29, jest-snapshot@^29.0.3, jest-snapshot@^29.1.2: +jest-snapshot@*, jest-snapshot@^28.0.0, jest-snapshot@^29, jest-snapshot@^29.0.3, jest-snapshot@^29.1.2: version "29.1.2" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.1.2.tgz#7dd277e88c45f2d2ff5888de1612e63c7ceb575b" integrity sha512-rYFomGpVMdBlfwTYxkUp3sjD6usptvZcONFYNqVlaz4EpHPnDvlWjvmOQ9OCSNKqYZqLM2aS3wq01tWujLg7gg== @@ -9208,12 +9208,12 @@ jest-snapshot@*, jest-snapshot@^27.0.2, jest-snapshot@^29, jest-snapshot@^29.0.3 pretty-format "^29.1.2" semver "^7.3.5" -jest-specific-snapshot@*, jest-specific-snapshot@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/jest-specific-snapshot/-/jest-specific-snapshot-5.0.0.tgz#48f72d5613af7f3e30df75b6b3534db6bab32ea0" - integrity sha512-V65vuPxZQExD3tGbv+Du5tbG1E3H3Dq/HFbsCEkPJP27w5vr/nATQJl61Dx5doBfu54OrJak0JaeYVSeZubDKg== +jest-specific-snapshot@*, jest-specific-snapshot@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/jest-specific-snapshot/-/jest-specific-snapshot-6.0.0.tgz#8373589825234fbbeef1bf054f5a6720a15a54f3" + integrity sha512-IiAfq0bmuXNwRkfCO3mLTCMhZJBdU05y/zEUKRk0KDhW6WQ7ZL0xTgjjtMrfLb0h+o/i+1/N68Ls3NrIFTykiA== dependencies: - jest-snapshot "^27.0.2" + jest-snapshot "^28.0.0" jest-util@28.1.1, jest-util@^29, jest-util@^29.1.2: version "29.1.2" @@ -9529,28 +9529,28 @@ latest-version@^5.1.0: dependencies: package-json "^6.3.0" -lerna@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-6.0.1.tgz#7b14f05d1e17dc628478d33f225a579a6088d317" - integrity sha512-aNodtj1jyuEqzYmkYh+vTfRuzLkG3RZkvYxFCuLeXXzIYD5pjMHtf+1q4m03SPsZt+cElhhwkgjdg6GjihraBw== - dependencies: - "@lerna/add" "6.0.1" - "@lerna/bootstrap" "6.0.1" - "@lerna/changed" "6.0.1" - "@lerna/clean" "6.0.1" - "@lerna/cli" "6.0.1" - "@lerna/command" "6.0.1" - "@lerna/create" "6.0.1" - "@lerna/diff" "6.0.1" - "@lerna/exec" "6.0.1" - "@lerna/import" "6.0.1" - "@lerna/info" "6.0.1" - "@lerna/init" "6.0.1" - "@lerna/link" "6.0.1" - "@lerna/list" "6.0.1" - "@lerna/publish" "6.0.1" - "@lerna/run" "6.0.1" - "@lerna/version" "6.0.1" +lerna@6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-6.0.3.tgz#0364eadeedbdf5ade375d8a6f0a87bb9003f6019" + integrity sha512-DzRCTZGoDI502daViNK1Ha+HPAVvTp72xshDOQ6o6SWCDTvnxFI3hGF6CBqGWnOoPwEOlQowHEIcPw5PjoMz8A== + dependencies: + "@lerna/add" "6.0.3" + "@lerna/bootstrap" "6.0.3" + "@lerna/changed" "6.0.3" + "@lerna/clean" "6.0.3" + "@lerna/cli" "6.0.3" + "@lerna/command" "6.0.3" + "@lerna/create" "6.0.3" + "@lerna/diff" "6.0.3" + "@lerna/exec" "6.0.3" + "@lerna/import" "6.0.3" + "@lerna/info" "6.0.3" + "@lerna/init" "6.0.3" + "@lerna/link" "6.0.3" + "@lerna/list" "6.0.3" + "@lerna/publish" "6.0.3" + "@lerna/run" "6.0.3" + "@lerna/version" "6.0.3" "@nrwl/devkit" ">=14.8.6 < 16" import-local "^3.0.2" inquirer "^8.2.4" @@ -9923,6 +9923,11 @@ markdown-it@13.0.1: mdurl "^1.0.1" uc.micro "^1.0.5" +markdown-table@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-3.0.2.tgz#9b59eb2c1b22fe71954a65ff512887065a7bb57c" + integrity sha512-y8j3a5/DkJCmS5x4dMCQL+OR0+2EAq3DOtio1COSHsmW2BGXnNCK3v12hJt1LrUz5iZH5g0LmuYOjDdI+czghA== + markdownlint-cli@^0.32.0: version "0.32.2" resolved "https://registry.yarnpkg.com/markdownlint-cli/-/markdownlint-cli-0.32.2.tgz#b7b5c5808039aef4022aef603efaa607caf8e0de" @@ -13622,10 +13627,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=4.2.4 <4.9.0", "typescript@^3 || ^4", typescript@next, typescript@~4.8.3, typescript@~4.8.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== +typescript@*, "typescript@>=4.2.4 <5.0.0", "typescript@^3 || ^4", typescript@next, typescript@~4.8.4, typescript@~4.9.3: + version "4.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db" + integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA== ua-parser-js@^0.7.30: version "0.7.31"