diff --git a/.eslintrc.js b/.eslintrc.js
index 6dfb0c353629..81f745d38247 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -264,6 +264,16 @@ module.exports = {
// specifically for rules - default exports makes the tooling easier
'import/no-default-export': 'off',
+
+ 'no-restricted-syntax': [
+ 'error',
+ {
+ selector:
+ 'ExportDefaultDeclaration Property[key.name="create"] MemberExpression[object.name="context"][property.name="options"]',
+ message:
+ "Retrieve options from create's second parameter so that defaultOptions are applied.",
+ },
+ ],
},
},
// plugin rule tests
diff --git a/.github/renovate.json5 b/.github/renovate.json5
index f5d016eb6dbb..0c18b35da840 100644
--- a/.github/renovate.json5
+++ b/.github/renovate.json5
@@ -5,14 +5,14 @@
'globby',
// this dep now uses package.json exports - we will be removing it next major
'eslint-scope',
+ // this dep is now ESM only
+ 'execa',
// the nx packages get updated using the nx migrate CLI
'@nrwl/cli',
'@nrwl/devkit',
'@nrwl/jest',
'@nrwl/nx-cloud',
'@nrwl/tao',
- '@nrwl/workspace',
- 'nx',
],
ignorePaths: [
// integration test package.json's should never be updated as they're purposely fixed tests
diff --git a/.github/workflows/nx-migrate.yml b/.github/workflows/nx-migrate.yml
new file mode 100644
index 000000000000..af107f6c3910
--- /dev/null
+++ b/.github/workflows/nx-migrate.yml
@@ -0,0 +1,85 @@
+# This workflow is used to augment the capabilities of the renovate GitHub app by running a full
+# `nx migrate` when renovate opens a PR to change the version of @nrwl/workspace.
+#
+# You will therefore also notice that in the renovate configuration, we ignore any packages which
+# Nx will manage for us as part of `nx migrate` such as the remaining @nrwl/* packages and jest.
+
+name: Nx Migrate
+
+on:
+ pull_request:
+ branches: [main]
+ paths:
+ - 'package.json'
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ maybe_nx_migrate:
+ # Only run if it was the renovate bot that triggered the workflow (otherwise we'll create a loop)
+ if: contains('["renovate[bot]"]', github.actor) == true
+ name: Run nx migrate if required
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ # To allow us to perform the git diff we need the git history
+ fetch-depth: 0
+ # To ensure we can push from a different user (and therefore cause actions to rerun)
+ persist-credentials: false
+
+ - name: Derive appropriate SHAs for base and head for `nx affected` commands
+ uses: nrwl/nx-set-shas@v3
+
+ - name: Check if @nrwl/workspace was changed as part of the latest commit on the PR
+ id: nrwl-workspace-package-check
+ run: |
+ git diff HEAD~1 -G"@nrwl/workspace" --exit-code package.json && echo "@nrwl/workspace unchanged" || echo "::set-output name=was-changed::true"
+
+ - name: Run nx migrate if @nrwl/workspace changed and commit the results
+ if: ${{ steps.nrwl-workspace-package-check.outputs.was-changed == 'true' }}
+ env:
+ # We cannot use secrets.GITHUB_TOKEN for this because it is not permitted to kick off subsequent actions worfklow runs, so we use a PAT instead
+ GITHUB_TOKEN: ${{ secrets.JAMES_HENRY_GITHUB_TOKEN }}
+ # We don't want to run any of our postinstall logic when Nx is invoking install behind the scenes
+ SKIP_POSTINSTALL: 'true'
+ run: |
+ # Checkout the PR branch using the github CLI
+ gh pr checkout ${{ github.event.pull_request.number }}
+
+ # Get the version of Nx we are migrating to
+ NX_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@nrwl/workspace'])")
+
+ # Revert renovate's changes to package.json and yarn.lock so that it is a clean migrate from the status quo
+ git checkout HEAD~1 -- package.json yarn.lock
+
+ yarn --ignore-scripts
+
+ npx nx migrate @nrwl/workspace@$NX_VERSION
+
+ # Sometimes Nx can require config formatting changes after a migrate command
+ yarn --ignore-scripts
+ npx nx format
+
+ # migrations.json may or may not exist after running nx migrate
+ if [ -f migrations.json ]; then
+ # This will also invoke yarn automatically
+ npx nx migrate --run-migrations=migrations.json
+
+ # After we have run its migrations, we no longer need the migrations.json file
+ rm migrations.json
+ fi
+
+ # Ensure all the changed files are formatted appropriately
+ yarn format
+
+ # Commit all the changes to the PR (see note on not being able to use secrets.GITHUB_TOKEN for this)
+ git config --global user.email "james@henry.sc"
+ git config --global user.name "JamesHenry"
+ git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git
+
+ git add --all
+ git commit -m "chore: run nx migrate for @nrwl/workspace v$NX_VERSION"
+ git push
diff --git a/.github/workflows/semantic-pr-titles.yml b/.github/workflows/semantic-pr-titles.yml
new file mode 100644
index 000000000000..24b6fb7c7ab9
--- /dev/null
+++ b/.github/workflows/semantic-pr-titles.yml
@@ -0,0 +1,52 @@
+name: Semantic PR Titles
+
+on:
+ pull_request_target:
+ types:
+ - opened
+ - edited
+ - synchronize
+
+jobs:
+ main:
+ name: Validate PR title
+ runs-on: ubuntu-latest
+ steps:
+ - uses: amannn/action-semantic-pull-request@v5
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ # keep this synchronized with the /CONTRIBUTING.md
+ types: |
+ docs
+ feat
+ fix
+ test
+ chore
+ # deps is used by renovate for its PRs
+ scopes: |
+ deps
+ ast-spec
+ eslint-plugin
+ eslint-plugin-internal
+ eslint-plugin-tslint
+ experimental-utils
+ parser
+ scope-manager
+ type-utils
+ types
+ typescript-estree
+ utils
+ visitor-keys
+ website
+ # we allow "cross package" PRs with no scope
+ requireScope: false
+ # ensure that the subject is lower-case first
+ # also allows "[rule-name] " prefix for eslint-plugin rule PRs
+ # https://regexr.com/733ed
+ subjectPattern: ^(\[[a-z\-]+\] )?[a-z].+[^\.]$
+ subjectPatternError: |
+ The "subject" must start with a lower-case letter and must not
+ end with a full-stop.
+ For PRs that add or change ESLint-plugin rules, you should begin
+ the title with "[rule-name] "
diff --git a/.lintstagedrc b/.lintstagedrc
index 691f6e0eb0e5..c4eebcd2f404 100644
--- a/.lintstagedrc
+++ b/.lintstagedrc
@@ -1,5 +1,3 @@
{
- "*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}": [
- "prettier --write"
- ]
+ "*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}": ["prettier --write"]
}
diff --git a/.prettierignore b/.prettierignore
index 88af276a1b24..edaa57ceac45 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -12,8 +12,8 @@ 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/
+# prettier doesn't yet support auto-accessors
+packages/ast-spec/src/element/AccessorProperty/fixtures
# Ignore CHANGELOG.md files to avoid issues with automated release job
CHANGELOG.md
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b6e1fb0f5296..6c2b7d9c7a22 100644
--- a/CHANGELOG.md
+++ b/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.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+### Bug Fixes
+
+- **eslint-plugin:** [array-type] --fix flag removes parentheses from type ([#5997](https://github.com/typescript-eslint/typescript-eslint/issues/5997)) ([42b33af](https://github.com/typescript-eslint/typescript-eslint/commit/42b33af256e5269feb214c7bb161079f770964fa))
+- **eslint-plugin:** [keyword-spacing] prevent crash on no options ([#6073](https://github.com/typescript-eslint/typescript-eslint/issues/6073)) ([1f19998](https://github.com/typescript-eslint/typescript-eslint/commit/1f19998e3ec6d592fc679a7490708e2e96816f4c))
+- **eslint-plugin:** [member-ordering] support private fields ([#5859](https://github.com/typescript-eslint/typescript-eslint/issues/5859)) ([f02761a](https://github.com/typescript-eslint/typescript-eslint/commit/f02761af19848a84b8d1832bd00fd6c95d38fa0c))
+- **eslint-plugin:** [prefer-readonly] report if a member's property is reassigned ([#6043](https://github.com/typescript-eslint/typescript-eslint/issues/6043)) ([6e079eb](https://github.com/typescript-eslint/typescript-eslint/commit/6e079eb35cfec79ba9965627477117f026d161ac))
+- **scope-manager:** add support for TS4.9 satisfies expression ([#6059](https://github.com/typescript-eslint/typescript-eslint/issues/6059)) ([44027db](https://github.com/typescript-eslint/typescript-eslint/commit/44027db379e6e074a16cda2755ef554c2b0a4c5a))
+- **typescript-estree:** stub out `ts.SatisfiesExpression` on old TS versions ([#6076](https://github.com/typescript-eslint/typescript-eslint/issues/6076)) ([1302b30](https://github.com/typescript-eslint/typescript-eslint/commit/1302b30ecad9eb55aa9f1daa5068d9fb72c3688e))
+
+### Features
+
+- **eslint-plugin:** [member-ordering] add a required option for required vs. optional member ordering ([#5965](https://github.com/typescript-eslint/typescript-eslint/issues/5965)) ([2abadc6](https://github.com/typescript-eslint/typescript-eslint/commit/2abadc6c26cd6300764157d405a2462b754d050b))
+- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a))
+
# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21)
### Bug Fixes
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3c08116cdc9c..aaf07b243ee4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -84,6 +84,8 @@ Within the body of your PR, make sure you reference the issue that you have work
Must be one of the following:
+
+
- `docs` - if you only change documentation, and not shipped code
- `feat` - for any new functionality additions
- `fix` - for any bug fixes that don't add new functionality
diff --git a/docs/linting/CONFIGURATIONS.md b/docs/linting/CONFIGURATIONS.md
deleted file mode 100644
index de05a216ff87..000000000000
--- a/docs/linting/CONFIGURATIONS.md
+++ /dev/null
@@ -1,122 +0,0 @@
----
-id: configs
-title: Configurations
----
-
-[ESLint shareable configurations](https://eslint.org/docs/latest/developer-guide/shareable-configs) exist to provide a comprehensive base config for you, with the intention that you add the config and it gives you an opinionated setup.
-
-## Built-In Configurations
-
-`@typescript-eslint/eslint-plugin` includes built-in configurations you can extend from to pull in the recommended starting rules.
-
-With the exception of `strict`, all configurations are considered "stable".
-Rule additions and removals are treated as breaking changes and will only be done in major version bumps.
-
-:::note
-We recommend most packages extend from [`recommended-requiring-type-checking`](#recommended-requiring-type-checking) (which requires [typed linting](./TYPED_LINTING.md)).
-:::
-
-### `eslint-recommended`
-
-This ruleset is meant to be used after extending `eslint:recommended`.
-It disables core ESLint rules that are already checked by the TypeScript compiler.
-Additionally, it enables rules that promote using the more modern constructs TypeScript allows for.
-
-```jsonc
-{
- "extends": [
- "eslint:recommended",
- "plugin:@typescript-eslint/eslint-recommended"
- ]
-}
-```
-
-This config is automatically included if you use any of the other configurations mentioned on this page.
-
-### `recommended`
-
-Recommended rules for code correctness that you can drop in without additional configuration.
-These rules are those whose reports are almost always for a bad practice and/or likely bug.
-`recommended` also disables rules known to conflict with this repository, or cause issues in TypeScript codebases.
-
-```json
-{
- "extends": ["plugin:@typescript-eslint/recommended"]
-}
-```
-
-:::tip
-We strongly recommend all TypeScript projects extend from this configuration.
-:::
-
-### `recommended-requiring-type-checking`
-
-Additional recommended rules that require type information.
-Rules in this configuration are similarly useful to those in `recommended`.
-
-```json
-{
- "extends": [
- "plugin:@typescript-eslint/recommended",
- "plugin:@typescript-eslint/recommended-requiring-type-checking"
- ]
-}
-```
-
-:::tip
-We recommend all TypeScript projects extend from this configuration, with the caveat that rules using type information take longer to run.
-See [Linting with Type Information](/docs/linting/typed-linting) for more details.
-:::
-
-### `strict`
-
-Additional strict rules that can also catch bugs but are more opinionated than recommended rules.
-
-```json
-{
- "extends": [
- "plugin:@typescript-eslint/recommended",
- "plugin:@typescript-eslint/recommended-requiring-type-checking",
- "plugin:@typescript-eslint/strict"
- ]
-}
-```
-
-:::tip
-We recommend a TypeScript project extend from this configuration only if a nontrivial percentage of its developers are highly proficient in TypeScript.
-:::
-
-## Overriding Configurations
-
-These configurations are our recommended starting points, but **you don't need to use them as-is**.
-ESLint allows you to configure your own rule settings on top of any extended configurations.
-See [ESLint's Configuring Rules docs](https://eslint.org/docs/user-guide/configuring/rules#using-configuration-files).
-
-### Suggesting Configuration Changes
-
-If you feel strongly that a specific rule should (or should not) be one of these configurations, please [file an issue](https://github.com/typescript-eslint/typescript-eslint/issues/new?assignees=&labels=package%3A+eslint-plugin%2Cpreset+config+change%2Ctriage&template=09-config-change.yaml&title=Configs%3A+%3Ca+short+description+of+my+proposal%3E) along with a **detailed** argument explaining your reasoning.
-
-## Prettier
-
-If you use [`prettier`](https://www.npmjs.com/package/prettier), there is also a helpful config to help ensure ESLint doesn't report on formatting issues that prettier will fix: [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier).
-
-Using this config by adding it to the end of your `extends`:
-
-```js title=".eslintrc.js"
-module.exports = {
- root: true,
- parser: '@typescript-eslint/parser',
- plugins: ['@typescript-eslint'],
- extends: [
- 'eslint:recommended',
- 'plugin:@typescript-eslint/recommended',
- // Add this line
- 'prettier',
- ],
-};
-```
-
-:::warning
-**We strongly recommend you use Prettier or an equivalent**, not ESLint formatting rules.
-See [this issue](https://github.com/typescript-eslint/typescript-eslint/issues/4907 'Issue: Docs: Add our opinion on delegating stylistic issues to a tool such as Prettier #4907') for more information.
-:::
diff --git a/docs/linting/CONFIGURATIONS.mdx b/docs/linting/CONFIGURATIONS.mdx
new file mode 100644
index 000000000000..eebf58cf8fd2
--- /dev/null
+++ b/docs/linting/CONFIGURATIONS.mdx
@@ -0,0 +1,141 @@
+---
+id: configs
+title: Configurations
+---
+
+[ESLint shareable configurations](https://eslint.org/docs/latest/developer-guide/shareable-configs) exist to provide a comprehensive base config for you.
+`@typescript-eslint/eslint-plugin` includes built-in configurations you can extend from to pull in the recommended starting rules.
+
+> With the exception of `strict`, all configurations are considered "stable".
+> Rule additions and removals are treated as breaking changes and will only be done in major version bumps.
+
+## Recommended Configurations
+
+Most projects should extend from at least one of:
+
+- [`recommended`](#recommended): Recommended rules for code correctness that you can drop in without additional configuration.
+- [`recommended-requiring-type-checking`](#recommended-requiring-type-checking): Additional recommended rules that require type information.
+- [`strict`](#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules.
+
+:::tip
+We recommend most projects use [`recommended-requiring-type-checking`](#recommended-requiring-type-checking) (which requires [typed linting](./TYPED_LINTING.md)).
+:::
+
+:::note
+These configurations are our recommended starting points, but **you don't need to use them as-is**.
+ESLint allows configuring own rule settings on top of extended configurations.
+See [ESLint's Configuring Rules docs](https://eslint.org/docs/user-guide/configuring/rules#using-configuration-files).
+:::
+
+### `recommended`
+
+Recommended rules for code correctness that you can drop in without additional configuration.
+These rules are those whose reports are almost always for a bad practice and/or likely bug.
+`recommended` also disables rules known to conflict with this repository, or cause issues in TypeScript codebases.
+
+```json
+{
+ "extends": ["plugin:@typescript-eslint/recommended"]
+}
+```
+
+See [`configs/recommended.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.ts) for the exact contents of this config.
+
+:::tip
+We strongly recommend all TypeScript projects extend from `plugin:@typescript-eslint/recommended`.
+:::
+
+### `recommended-requiring-type-checking`
+
+Additional recommended rules that require type information.
+Rules in this configuration are similarly useful to those in `recommended`.
+
+```json
+{
+ "extends": [
+ "plugin:@typescript-eslint/recommended",
+ "plugin:@typescript-eslint/recommended-requiring-type-checking"
+ ]
+}
+```
+
+See [`configs/recommended-requiring-type-checking.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts) for the exact contents of this config.
+
+:::tip
+We recommend all TypeScript projects extend from `plugin:@typescript-eslint/recommended-requiring-type-checking`, with the caveat that rules using type information take longer to run.
+See [Linting with Type Information](/docs/linting/typed-linting) for more details.
+:::
+
+### `strict`
+
+Additional strict rules that can also catch bugs but are more opinionated than recommended rules.
+
+```json
+{
+ "extends": [
+ "plugin:@typescript-eslint/recommended",
+ "plugin:@typescript-eslint/recommended-requiring-type-checking",
+ "plugin:@typescript-eslint/strict"
+ ]
+}
+```
+
+See [`configs/strict.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts) for the exact contents of this config.
+
+:::caution
+We recommend a TypeScript project extend from `plugin:@typescript-eslint/strict` only if a nontrivial percentage of its developers are highly proficient in TypeScript.
+:::
+
+## Other Configurations
+
+TypeScript ESLint includes a scattering of utility configurations used by the recommended configurations.
+We don't recommend using these directly; instead, extend from an earlier recommended rule.
+
+### `all`
+
+Enables each the rules provided as a part of TypeScript ESLint.
+Note that many rules are not applicable in all codebases, or are meant to be configured.
+
+See [`configs/all.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/all.ts) for the exact contents of this config.
+
+:::warning
+We do not recommend a TypeScript projects extend from `plugin:@typescript-eslint/all`.
+Many rules conflict with each other and/or are intended to be configured per-project.
+:::
+
+### `base`
+
+A minimal ruleset that sets only the required parser and plugin options needed to run TypeScript ESLint.
+
+
+
+This config is automatically included if you use any of the recommended configurations.
+
+### `eslint-recommended`
+
+This ruleset is meant to be used after extending `eslint:recommended`.
+It disables core ESLint rules that are already checked by the TypeScript compiler.
+Additionally, it enables rules that promote using the more modern constructs TypeScript allows for.
+
+```jsonc
+{
+ "extends": [
+ "eslint:recommended",
+ "plugin:@typescript-eslint/eslint-recommended"
+ ]
+}
+```
+
+This config is automatically included if you use any of the recommended configurations.
+
+See [`configs/eslint-recommended.ts``](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts) for the exact contents of this config.
+
+## Suggesting Configuration Changes
+
+If you feel strongly that a specific rule should (or should not) be one of these configurations, please [file an issue](https://github.com/typescript-eslint/typescript-eslint/issues/new?assignees=&labels=package%3A+eslint-plugin%2Cpreset+config+change%2Ctriage&template=09-config-change.yaml&title=Configs%3A+%3Ca+short+description+of+my+proposal%3E) along with a **detailed** argument explaining your reasoning.
+
+## Formatting
+
+None of the preset configs provided by TypeScript ESLint enable formatting rules (rules that only serve to enforce code whitespace and other trivia).
+We strongly recommend you use Prettier or an equivalent for formatting your code, not ESLint formatting rules.
+See [What About Formatting? > Suggested Usage](./troubleshooting/formatting#suggested-usage).
diff --git a/docs/linting/troubleshooting/FORMATTING.md b/docs/linting/troubleshooting/FORMATTING.md
index 2acb36d0e600..47ff57c3b45c 100644
--- a/docs/linting/troubleshooting/FORMATTING.md
+++ b/docs/linting/troubleshooting/FORMATTING.md
@@ -27,6 +27,22 @@ Linters typically run on a rule-by-rule basis, typically resulting in many edge
We recommend using [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) to disable formatting rules in your ESLint configuration.
You can then configure your formatter separately from ESLint.
+Using this config by adding it to the end of your `extends`:
+
+```js title=".eslintrc.js"
+module.exports = {
+ extends: [
+ 'eslint:recommended',
+ 'plugin:@typescript-eslint/recommended',
+ // Add this line
+ 'prettier',
+ ],
+ parser: '@typescript-eslint/parser',
+ plugins: ['@typescript-eslint'],
+ root: true,
+};
+```
+
## ESLint Core and Formatting
Per [ESLint's 2020 Changes to Rule Policies blog post](https://eslint.org/blog/2020/05/changes-to-rules-policies#what-are-the-changes):
diff --git a/lerna.json b/lerna.json
index 112f88b34a7c..df2f5631f3d5 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "version": "5.44.0",
+ "version": "5.45.0",
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true
diff --git a/package.json b/package.json
index bddf6b4fe48c..89bc49447f2e 100644
--- a/package.json
+++ b/package.json
@@ -38,7 +38,7 @@
"lint-markdown-fix": "yarn lint-markdown --fix",
"lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
"lint": "nx run-many --target=lint --all --parallel",
- "postinstall": "yarn patch-package && yarn husky install && yarn build",
+ "postinstall": "yarn ts-node --transpile-only ./tools/postinstall.ts",
"pre-commit": "yarn lint-staged",
"start": "nx run website:start",
"test": "nx run-many --target=test --all --parallel",
@@ -86,12 +86,13 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.1.5",
"eslint-plugin-simple-import-sort": "^8.0.0",
+ "execa": "5.1.1",
"glob": "^8.0.1",
"husky": "^8.0.1",
"jest": "^29.0.3",
"jest-diff": "^29.0.3",
"jest-snapshot": "^29.0.3",
- "jest-specific-snapshot": "^6.0.0",
+ "jest-specific-snapshot": "^7.0.0",
"lerna": "6.0.3",
"lint-staged": "^13.0.0",
"make-dir": "^3.1.0",
@@ -99,7 +100,7 @@
"ncp": "^2.0.0",
"nx": "14.8.4",
"patch-package": "^6.4.7",
- "prettier": "2.7.1",
+ "prettier": "2.8.0",
"pretty-format": "^29.0.3",
"rimraf": "^3.0.2",
"tmp": "^0.2.1",
diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md
index 98f5cb54d737..41f4b761b1fc 100644
--- a/packages/ast-spec/CHANGELOG.md
+++ b/packages/ast-spec/CHANGELOG.md
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+### Features
+
+- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a))
+
# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21)
### Features
diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json
index a0c4f5d53625..de9818c347fa 100644
--- a/packages/ast-spec/package.json
+++ b/packages/ast-spec/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/ast-spec",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "TypeScript-ESTree AST spec",
"private": true,
"keywords": [
diff --git a/packages/ast-spec/src/ast-node-types.ts b/packages/ast-spec/src/ast-node-types.ts
index dbed6723fed4..7a637489eb0d 100644
--- a/packages/ast-spec/src/ast-node-types.ts
+++ b/packages/ast-spec/src/ast-node-types.ts
@@ -1,4 +1,5 @@
export enum AST_NODE_TYPES {
+ AccessorProperty = 'AccessorProperty',
ArrayExpression = 'ArrayExpression',
ArrayPattern = 'ArrayPattern',
ArrowFunctionExpression = 'ArrowFunctionExpression',
@@ -90,6 +91,7 @@ export enum AST_NODE_TYPES {
/**
* TS-prefixed nodes
*/
+ TSAbstractAccessorProperty = 'TSAbstractAccessorProperty',
TSAbstractKeyword = 'TSAbstractKeyword',
TSAbstractMethodDefinition = 'TSAbstractMethodDefinition',
TSAbstractPropertyDefinition = 'TSAbstractPropertyDefinition',
diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot
deleted file mode 100644
index 4e1ab2405d45..000000000000
--- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot
+++ /dev/null
@@ -1,48 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`AST Fixtures declaration ExportAllDeclaration kind-type TSESTree - AST 1`] = `
-Program {
- type: "Program",
- body: Array [
- ExportAllDeclaration {
- type: "ExportAllDeclaration",
- assertions: Array [],
- exported: Identifier {
- type: "Identifier",
- name: "x",
-
- range: [17, 18],
- loc: {
- start: { column: 17, line: 1 },
- end: { column: 18, line: 1 },
- },
- },
- exportKind: "type",
- source: Literal {
- type: "Literal",
- raw: "'a'",
- value: "a",
-
- range: [24, 27],
- loc: {
- start: { column: 24, line: 1 },
- end: { column: 27, line: 1 },
- },
- },
-
- range: [0, 28],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 28, line: 1 },
- },
- },
- ],
- sourceType: "module",
-
- range: [0, 29],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 0, line: 2 },
- },
-}
-`;
diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot
deleted file mode 100644
index f5bfa8f5615e..000000000000
--- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot
+++ /dev/null
@@ -1,86 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`AST Fixtures declaration ExportAllDeclaration kind-type TSESTree - Tokens 1`] = `
-Array [
- Keyword {
- type: "Keyword",
- value: "export",
-
- range: [0, 6],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 6, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "type",
-
- range: [7, 11],
- loc: {
- start: { column: 7, line: 1 },
- end: { column: 11, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: "*",
-
- range: [12, 13],
- loc: {
- start: { column: 12, line: 1 },
- end: { column: 13, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "as",
-
- range: [14, 16],
- loc: {
- start: { column: 14, line: 1 },
- end: { column: 16, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "x",
-
- range: [17, 18],
- loc: {
- start: { column: 17, line: 1 },
- end: { column: 18, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "from",
-
- range: [19, 23],
- loc: {
- start: { column: 19, line: 1 },
- end: { column: 23, line: 1 },
- },
- },
- String {
- type: "String",
- value: "'a'",
-
- range: [24, 27],
- loc: {
- start: { column: 24, 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/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot
deleted file mode 100644
index 9136ca295cb1..000000000000
--- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-TSESTree-AST.shot
+++ /dev/null
@@ -1,102 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`AST Fixtures declaration ExportNamedDeclaration assertion TSESTree - AST 1`] = `
-Program {
- type: "Program",
- body: Array [
- ExportNamedDeclaration {
- type: "ExportNamedDeclaration",
- assertions: Array [
- ImportAttribute {
- type: "ImportAttribute",
- key: Identifier {
- type: "Identifier",
- name: "type",
-
- range: [35, 39],
- loc: {
- start: { column: 35, line: 1 },
- end: { column: 39, line: 1 },
- },
- },
- value: Literal {
- type: "Literal",
- raw: "'json'",
- value: "json",
-
- range: [41, 47],
- loc: {
- start: { column: 41, line: 1 },
- end: { column: 47, line: 1 },
- },
- },
-
- range: [35, 47],
- loc: {
- start: { column: 35, line: 1 },
- end: { column: 47, line: 1 },
- },
- },
- ],
- declaration: null,
- exportKind: "value",
- source: Literal {
- type: "Literal",
- raw: "'mod'",
- value: "mod",
-
- range: [20, 25],
- loc: {
- start: { column: 20, line: 1 },
- end: { column: 25, line: 1 },
- },
- },
- specifiers: Array [
- ExportSpecifier {
- type: "ExportSpecifier",
- exported: Identifier {
- type: "Identifier",
- name: "foo",
-
- range: [9, 12],
- loc: {
- start: { column: 9, line: 1 },
- end: { column: 12, line: 1 },
- },
- },
- exportKind: "value",
- local: Identifier {
- type: "Identifier",
- name: "foo",
-
- range: [9, 12],
- loc: {
- start: { column: 9, line: 1 },
- end: { column: 12, line: 1 },
- },
- },
-
- range: [9, 12],
- loc: {
- start: { column: 9, line: 1 },
- end: { column: 12, line: 1 },
- },
- },
- ],
-
- range: [0, 50],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 50, line: 1 },
- },
- },
- ],
- sourceType: "module",
-
- range: [0, 51],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 0, line: 2 },
- },
-}
-`;
diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot
deleted file mode 100644
index 9a30eb2745ce..000000000000
--- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-TSESTree-Tokens.shot
+++ /dev/null
@@ -1,136 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`AST Fixtures declaration ExportNamedDeclaration assertion TSESTree - Tokens 1`] = `
-Array [
- Keyword {
- type: "Keyword",
- value: "export",
-
- range: [0, 6],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 6, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: "{",
-
- range: [7, 8],
- loc: {
- start: { column: 7, line: 1 },
- end: { column: 8, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "foo",
-
- range: [9, 12],
- loc: {
- start: { column: 9, line: 1 },
- end: { column: 12, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: "}",
-
- range: [13, 14],
- loc: {
- start: { column: 13, line: 1 },
- end: { column: 14, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "from",
-
- range: [15, 19],
- loc: {
- start: { column: 15, line: 1 },
- end: { column: 19, line: 1 },
- },
- },
- String {
- type: "String",
- value: "'mod'",
-
- range: [20, 25],
- loc: {
- start: { column: 20, line: 1 },
- end: { column: 25, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "assert",
-
- range: [26, 32],
- loc: {
- start: { column: 26, line: 1 },
- end: { column: 32, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: "{",
-
- range: [33, 34],
- loc: {
- start: { column: 33, line: 1 },
- end: { column: 34, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "type",
-
- range: [35, 39],
- loc: {
- start: { column: 35, line: 1 },
- end: { column: 39, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: ":",
-
- range: [39, 40],
- loc: {
- start: { column: 39, line: 1 },
- end: { column: 40, line: 1 },
- },
- },
- String {
- type: "String",
- value: "'json'",
-
- range: [41, 47],
- loc: {
- start: { column: 41, line: 1 },
- end: { column: 47, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: "}",
-
- range: [48, 49],
- loc: {
- start: { column: 48, line: 1 },
- end: { column: 49, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: ";",
-
- range: [49, 50],
- loc: {
- start: { column: 49, line: 1 },
- end: { column: 50, line: 1 },
- },
- },
-]
-`;
diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot
deleted file mode 100644
index b2ee980389e8..000000000000
--- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/3-Babel-AST.shot
+++ /dev/null
@@ -1,102 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`AST Fixtures declaration ExportNamedDeclaration assertion Babel - AST 1`] = `
-Program {
- type: "Program",
- body: Array [
- ExportNamedDeclaration {
- type: "ExportNamedDeclaration",
- assertions: Array [
- ImportAttribute {
- type: "ImportAttribute",
- key: Identifier {
- type: "Identifier",
- name: "type",
-
- range: [35, 39],
- loc: {
- start: { column: 35, line: 1 },
- end: { column: 39, line: 1 },
- },
- },
- value: Literal {
- type: "Literal",
- raw: "'json'",
- value: "json",
-
- range: [41, 47],
- loc: {
- start: { column: 41, line: 1 },
- end: { column: 47, line: 1 },
- },
- },
-
- range: [35, 47],
- loc: {
- start: { column: 35, line: 1 },
- end: { column: 47, line: 1 },
- },
- },
- ],
- declaration: null,
- exportKind: "value",
- source: Literal {
- type: "Literal",
- raw: "'mod'",
- value: "mod",
-
- range: [20, 25],
- loc: {
- start: { column: 20, line: 1 },
- end: { column: 25, line: 1 },
- },
- },
- specifiers: Array [
- ExportSpecifier {
- type: "ExportSpecifier",
- exported: Identifier {
- type: "Identifier",
- name: "foo",
-
- range: [9, 12],
- loc: {
- start: { column: 9, line: 1 },
- end: { column: 12, line: 1 },
- },
- },
- exportKind: "value",
- local: Identifier {
- type: "Identifier",
- name: "foo",
-
- range: [9, 12],
- loc: {
- start: { column: 9, line: 1 },
- end: { column: 12, line: 1 },
- },
- },
-
- range: [9, 12],
- loc: {
- start: { column: 9, line: 1 },
- end: { column: 12, line: 1 },
- },
- },
- ],
-
- range: [0, 50],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 50, line: 1 },
- },
- },
- ],
- sourceType: "module",
-
- range: [0, 51],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 0, line: 2 },
- },
-}
-`;
diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot
deleted file mode 100644
index 95aa314bf6b3..000000000000
--- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/4-Babel-Tokens.shot
+++ /dev/null
@@ -1,136 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`AST Fixtures declaration ExportNamedDeclaration assertion Babel - Tokens 1`] = `
-Array [
- Keyword {
- type: "Keyword",
- value: "export",
-
- range: [0, 6],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 6, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: "{",
-
- range: [7, 8],
- loc: {
- start: { column: 7, line: 1 },
- end: { column: 8, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "foo",
-
- range: [9, 12],
- loc: {
- start: { column: 9, line: 1 },
- end: { column: 12, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: "}",
-
- range: [13, 14],
- loc: {
- start: { column: 13, line: 1 },
- end: { column: 14, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "from",
-
- range: [15, 19],
- loc: {
- start: { column: 15, line: 1 },
- end: { column: 19, line: 1 },
- },
- },
- String {
- type: "String",
- value: "'mod'",
-
- range: [20, 25],
- loc: {
- start: { column: 20, line: 1 },
- end: { column: 25, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "assert",
-
- range: [26, 32],
- loc: {
- start: { column: 26, line: 1 },
- end: { column: 32, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: "{",
-
- range: [33, 34],
- loc: {
- start: { column: 33, line: 1 },
- end: { column: 34, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "type",
-
- range: [35, 39],
- loc: {
- start: { column: 35, line: 1 },
- end: { column: 39, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: ":",
-
- range: [39, 40],
- loc: {
- start: { column: 39, line: 1 },
- end: { column: 40, line: 1 },
- },
- },
- String {
- type: "String",
- value: "'json'",
-
- range: [41, 47],
- loc: {
- start: { column: 41, line: 1 },
- end: { column: 47, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: "}",
-
- range: [48, 49],
- loc: {
- start: { column: 48, line: 1 },
- end: { column: 49, line: 1 },
- },
- },
- Punctuator {
- type: "Punctuator",
- value: ";",
-
- range: [49, 50],
- loc: {
- start: { column: 49, line: 1 },
- end: { column: 50, line: 1 },
- },
- },
-]
-`;
diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot
deleted file mode 100644
index d01382249a1a..000000000000
--- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot
+++ /dev/null
@@ -1,40 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`AST Fixtures declaration TSDeclareFunction async TSESTree - AST 1`] = `
-Program {
- type: "Program",
- body: Array [
- TSDeclareFunction {
- type: "TSDeclareFunction",
- async: true,
- declare: true,
- expression: false,
- generator: false,
- id: Identifier {
- type: "Identifier",
- name: "foo",
-
- range: [23, 26],
- loc: {
- start: { column: 23, line: 1 },
- end: { column: 26, line: 1 },
- },
- },
- params: Array [],
-
- 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/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot
deleted file mode 100644
index 57b56f38b089..000000000000
--- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot
+++ /dev/null
@@ -1,76 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`AST Fixtures declaration TSDeclareFunction async TSESTree - Tokens 1`] = `
-Array [
- Identifier {
- type: "Identifier",
- value: "declare",
-
- range: [0, 7],
- loc: {
- start: { column: 0, line: 1 },
- end: { column: 7, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "async",
-
- range: [8, 13],
- loc: {
- start: { column: 8, line: 1 },
- end: { column: 13, line: 1 },
- },
- },
- Keyword {
- type: "Keyword",
- value: "function",
-
- range: [14, 22],
- loc: {
- start: { column: 14, line: 1 },
- end: { column: 22, line: 1 },
- },
- },
- Identifier {
- type: "Identifier",
- value: "foo",
-
- range: [23, 26],
- loc: {
- start: { column: 23, 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 },
- },
- },
- 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/element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts
new file mode 100644
index 000000000000..2a4248c0bf80
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ declare accessor foo: number;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot
new file mode 100644
index 000000000000..e9efe0512eb3
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/1-TSESTree-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty _error_ modifier-declare TSESTree - Error 1`] = `"NO ERROR"`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot
new file mode 100644
index 000000000000..7d44c5a9712d
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/2-Babel-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty _error_ modifier-declare Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:22)]`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot
new file mode 100644
index 000000000000..a6fbd60e31cf
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-declare/snapshots/3-Alignment-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty _error_ modifier-declare Error Alignment 1`] = `"Babel errored but TSESTree didn't"`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts
new file mode 100644
index 000000000000..3369657d82be
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ override accessor foo = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot
new file mode 100644
index 000000000000..e1f58f42d42c
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-TSESTree-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends TSESTree - Error 1`] = `"NO ERROR"`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot
new file mode 100644
index 000000000000..071d521919f4
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Babel-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends Babel - Error 1`] = `[SyntaxError: This member cannot have an 'override' modifier because its containing class does not extend another class. (2:2)]`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot
new file mode 100644
index 000000000000..27d6eef74b02
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/3-Alignment-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts
new file mode 100644
index 000000000000..5dc28758b4e5
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ accessor 1 = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..00745c8a8d31
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,82 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-complex TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: Literal {
+ type: "Literal",
+ raw: "1",
+ value: 1,
+
+ range: [23, 24],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 12, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+
+ range: [14, 29],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 31],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 31],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 32],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..97c056640e76
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-complex TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "1",
+
+ range: [23, 24],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 12, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [25, 26],
+ loc: {
+ start: { column: 13, line: 2 },
+ end: { column: 14, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [28, 29],
+ loc: {
+ start: { column: 16, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..e52653f4094a
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot
@@ -0,0 +1,80 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-complex Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: false,
+ key: Literal {
+ type: "Literal",
+ raw: "1",
+ value: 1,
+
+ range: [23, 24],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 12, line: 2 },
+ },
+ },
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+
+ range: [14, 29],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 31],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 31],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 32],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..651eb3314710
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-complex Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "1",
+
+ range: [23, 24],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 12, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [25, 26],
+ loc: {
+ start: { column: 13, line: 2 },
+ end: { column: 14, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [28, 29],
+ loc: {
+ start: { column: 16, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..b6b30dd18c6c
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: false,
+- declare: false,
+ key: Literal {
+ type: 'Literal',
+ raw: '1',
+ value: 1,
+
+ range: [23, 24],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 12, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '2',
+ value: 2,
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+
+ range: [14, 29],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 31],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 31],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 32],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..8375156efe18
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,6 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignment - Token 1`] = `
+"Snapshot Diff:
+Compared values have no visual difference."
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts
new file mode 100644
index 000000000000..e6eb4123594a
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ accessor [1] = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..abb1554d8a24
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,82 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-number TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: true,
+ declare: false,
+ key: Literal {
+ type: "Literal",
+ raw: "1",
+ value: 1,
+
+ range: [24, 25],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 13, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [29, 30],
+ loc: {
+ start: { column: 17, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+
+ range: [14, 31],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 33],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 33],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 34],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..d12fe10489e6
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,116 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-number TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "[",
+
+ range: [23, 24],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 12, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "1",
+
+ range: [24, 25],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 13, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "]",
+
+ range: [25, 26],
+ loc: {
+ start: { column: 13, line: 2 },
+ end: { column: 14, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [29, 30],
+ loc: {
+ start: { column: 17, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [32, 33],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..69de24d530d2
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/3-Babel-AST.shot
@@ -0,0 +1,80 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-number Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: true,
+ key: Literal {
+ type: "Literal",
+ raw: "1",
+ value: 1,
+
+ range: [24, 25],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 13, line: 2 },
+ },
+ },
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [29, 30],
+ loc: {
+ start: { column: 17, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+
+ range: [14, 31],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 33],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 33],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 34],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..e2dd78f3f2fa
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,116 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-number Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "[",
+
+ range: [23, 24],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 12, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "1",
+
+ range: [24, 25],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 13, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "]",
+
+ range: [25, 26],
+ loc: {
+ start: { column: 13, line: 2 },
+ end: { column: 14, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [29, 30],
+ loc: {
+ start: { column: 17, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [32, 33],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..bd3b115af807
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: true,
+- declare: false,
+ key: Literal {
+ type: 'Literal',
+ raw: '1',
+ value: 1,
+
+ range: [24, 25],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 13, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '2',
+ value: 2,
+
+ range: [29, 30],
+ loc: {
+ start: { column: 17, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+
+ range: [14, 31],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 33],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 33],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 34],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot
similarity index 52%
rename from packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot
rename to packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot
index dade8ee29e7f..2243b91ca2e6 100644
--- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/6-AST-Alignment-Tokens.shot
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/6-AST-Alignment-Tokens.shot
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`AST Fixtures declaration ExportNamedDeclaration assertion AST Alignment - Token 1`] = `
+exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment - Token 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts
new file mode 100644
index 000000000000..feb7a8c14ce3
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ accessor ['prop'] = 'value';
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..24de40f9aaea
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,82 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-string TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: true,
+ declare: false,
+ key: Literal {
+ type: "Literal",
+ raw: "'prop'",
+ value: "prop",
+
+ range: [24, 30],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "'value'",
+ value: "value",
+
+ range: [34, 41],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+
+ range: [14, 42],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 30, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 44],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 44],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 45],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..9b1fd979379b
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,116 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-string TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "[",
+
+ range: [23, 24],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 12, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'prop'",
+
+ range: [24, 30],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "]",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [32, 33],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'value'",
+
+ range: [34, 41],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [41, 42],
+ loc: {
+ start: { column: 29, line: 2 },
+ end: { column: 30, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [43, 44],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..d8b18a559106
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/3-Babel-AST.shot
@@ -0,0 +1,80 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-string Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: true,
+ key: Literal {
+ type: "Literal",
+ raw: "'prop'",
+ value: "prop",
+
+ range: [24, 30],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "'value'",
+ value: "value",
+
+ range: [34, 41],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+
+ range: [14, 42],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 30, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 44],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 44],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 45],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..29da5db38843
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,116 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-string Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "[",
+
+ range: [23, 24],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 12, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'prop'",
+
+ range: [24, 30],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "]",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [32, 33],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'value'",
+
+ range: [34, 41],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [41, 42],
+ loc: {
+ start: { column: 29, line: 2 },
+ end: { column: 30, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [43, 44],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..3ca8eaf26ea5
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: true,
+- declare: false,
+ key: Literal {
+ type: 'Literal',
+ raw: '\\\\'prop\\\\'',
+ value: 'prop',
+
+ range: [24, 30],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '\\\\'value\\\\'',
+ value: 'value',
+
+ range: [34, 41],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+
+ range: [14, 42],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 30, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 44],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 44],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 45],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..628cbb97adb7
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,6 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment - Token 1`] = `
+"Snapshot Diff:
+Compared values have no visual difference."
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..40d09186f6d5
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,15 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-number TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [],
+ sourceType: "script",
+
+ range: [0, 0],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 1 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..ea5732d8dee1
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-number TSESTree - Tokens 1`] = `Array []`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..c3c65ccd7f84
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot
@@ -0,0 +1,15 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-number Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [],
+ sourceType: "script",
+
+ range: [0, 0],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 1 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..75ca02a990c4
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-number Babel - Tokens 1`] = `Array []`;
diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot
similarity index 52%
rename from packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot
rename to packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot
index 258519a7adf2..55fd7a3d4754 100644
--- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/5-AST-Alignment-AST.shot
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`AST Fixtures declaration ExportNamedDeclaration assertion AST Alignment - AST 1`] = `
+exports[`AST Fixtures element AccessorProperty key-number AST Alignment - AST 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..0ee5b89aab4f
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,6 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-number AST Alignment - Token 1`] = `
+"Snapshot Diff:
+Compared values have no visual difference."
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts
new file mode 100644
index 000000000000..255b0794a5e3
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ accessor #foo = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..e30dd5e502f1
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,81 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-private TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: PrivateIdentifier {
+ type: "PrivateIdentifier",
+ name: "foo",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+
+ range: [14, 32],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 20, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 34],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 34],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 35],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..1a3c3d84ed7b
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-private TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "#foo",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [28, 29],
+ loc: {
+ start: { column: 16, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [31, 32],
+ loc: {
+ start: { column: 19, line: 2 },
+ end: { column: 20, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [33, 34],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..e687dfd0d9a0
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/3-Babel-AST.shot
@@ -0,0 +1,79 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-private Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: false,
+ key: PrivateIdentifier {
+ type: "PrivateIdentifier",
+ name: "foo",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+
+ range: [14, 32],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 20, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 34],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 34],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 35],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..52963d76a15b
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-private Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ PrivateIdentifier {
+ type: "PrivateIdentifier",
+ value: "foo",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [28, 29],
+ loc: {
+ start: { column: 16, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [31, 32],
+ loc: {
+ start: { column: 19, line: 2 },
+ end: { column: 20, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [33, 34],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..100c519c06c4
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,87 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: false,
+- declare: false,
+ key: PrivateIdentifier {
+ type: 'PrivateIdentifier',
+ name: 'foo',
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '2',
+ value: 2,
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+
+ range: [14, 32],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 20, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 34],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 34],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 35],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..11bd633e0491
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,103 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-private AST Alignment - Token 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Array [
+ Keyword {
+ type: 'Keyword',
+ value: 'class',
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '{',
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'accessor',
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+- Identifier {
+- type: 'Identifier',
+- value: '#foo',
++ PrivateIdentifier {
++ type: 'PrivateIdentifier',
++ value: 'foo',
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '=',
+
+ range: [28, 29],
+ loc: {
+ start: { column: 16, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Numeric {
+ type: 'Numeric',
+ value: '2',
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: ';',
+
+ range: [31, 32],
+ loc: {
+ start: { column: 19, line: 2 },
+ end: { column: 20, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '}',
+
+ range: [33, 34],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ]"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts
new file mode 100644
index 000000000000..808470d5b6ad
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ accessor 'prop' = 'value';
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..06a3b3705ed7
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,82 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-string TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: Literal {
+ type: "Literal",
+ raw: "'prop'",
+ value: "prop",
+
+ range: [23, 29],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "'value'",
+ value: "value",
+
+ range: [32, 39],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+
+ range: [14, 40],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 42],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 42],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 43],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..0fe6262dd931
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-string TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'prop'",
+
+ range: [23, 29],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'value'",
+
+ range: [32, 39],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [41, 42],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..9af9236878cb
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot
@@ -0,0 +1,80 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-string Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: false,
+ key: Literal {
+ type: "Literal",
+ raw: "'prop'",
+ value: "prop",
+
+ range: [23, 29],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "'value'",
+ value: "value",
+
+ range: [32, 39],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+
+ range: [14, 40],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 42],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 42],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 43],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..110b7cb99495
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-string Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'prop'",
+
+ range: [23, 29],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [30, 31],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'value'",
+
+ range: [32, 39],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [41, 42],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..f831283bcb4c
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: false,
+- declare: false,
+ key: Literal {
+ type: 'Literal',
+ raw: '\\\\'prop\\\\'',
+ value: 'prop',
+
+ range: [23, 29],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '\\\\'value\\\\'',
+ value: 'value',
+
+ range: [32, 39],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+
+ range: [14, 40],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 42],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 42],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 43],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..af1e8eed8c6f
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,6 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty key-string AST Alignment - Token 1`] = `
+"Snapshot Diff:
+Compared values have no visual difference."
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts
new file mode 100644
index 000000000000..61e0e137a0eb
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/config.ts
@@ -0,0 +1,3 @@
+export default {
+ expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205',
+} satisfies ASTFixtureConfig;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts
new file mode 100644
index 000000000000..26b6ab5a4e00
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts
@@ -0,0 +1,3 @@
+abstract class Foo {
+ abstract accessor foo: number = 1;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..1c8247fb96d8
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,90 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ abstract: true,
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ TSAbstractAccessorProperty {
+ type: "TSAbstractAccessorProperty",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [41, 44],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ typeAnnotation: TSTypeAnnotation {
+ type: "TSTypeAnnotation",
+ typeAnnotation: TSNumberKeyword {
+ type: "TSNumberKeyword",
+
+ range: [46, 52],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 31, line: 2 },
+ },
+ },
+
+ range: [44, 52],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 31, line: 2 },
+ },
+ },
+ value: null,
+
+ range: [23, 57],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 36, line: 2 },
+ },
+ },
+ ],
+
+ range: [19, 59],
+ loc: {
+ start: { column: 19, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [15, 18],
+ loc: {
+ start: { column: 15, line: 1 },
+ end: { column: 18, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 59],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 60],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..b993bfecdea8
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,136 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - Tokens 1`] = `
+Array [
+ Identifier {
+ type: "Identifier",
+ value: "abstract",
+
+ range: [0, 8],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 8, line: 1 },
+ },
+ },
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [9, 14],
+ loc: {
+ start: { column: 9, line: 1 },
+ end: { column: 14, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [15, 18],
+ loc: {
+ start: { column: 15, line: 1 },
+ end: { column: 18, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [19, 20],
+ loc: {
+ start: { column: 19, line: 1 },
+ end: { column: 20, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "abstract",
+
+ range: [23, 31],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [32, 40],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [41, 44],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ":",
+
+ range: [44, 45],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "number",
+
+ range: [46, 52],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 31, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [53, 54],
+ loc: {
+ start: { column: 32, line: 2 },
+ end: { column: 33, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "1",
+
+ range: [55, 56],
+ loc: {
+ start: { column: 34, line: 2 },
+ end: { column: 35, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [56, 57],
+ loc: {
+ start: { column: 35, line: 2 },
+ end: { column: 36, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [58, 59],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot
new file mode 100644
index 000000000000..c49a847cd3a8
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:23)]`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts
new file mode 100644
index 000000000000..61e0e137a0eb
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/config.ts
@@ -0,0 +1,3 @@
+export default {
+ expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205',
+} satisfies ASTFixtureConfig;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts
new file mode 100644
index 000000000000..61608bfc72d2
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/fixture.ts
@@ -0,0 +1,3 @@
+abstract class Foo {
+ abstract accessor foo: number;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..420e13ca4bf1
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,90 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-abstract TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ abstract: true,
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ TSAbstractAccessorProperty {
+ type: "TSAbstractAccessorProperty",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [41, 44],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ typeAnnotation: TSTypeAnnotation {
+ type: "TSTypeAnnotation",
+ typeAnnotation: TSNumberKeyword {
+ type: "TSNumberKeyword",
+
+ range: [46, 52],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 31, line: 2 },
+ },
+ },
+
+ range: [44, 52],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 31, line: 2 },
+ },
+ },
+ value: null,
+
+ range: [23, 53],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 32, line: 2 },
+ },
+ },
+ ],
+
+ range: [19, 55],
+ loc: {
+ start: { column: 19, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [15, 18],
+ loc: {
+ start: { column: 15, line: 1 },
+ end: { column: 18, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 55],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 56],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..732caf89fcef
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,116 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-abstract TSESTree - Tokens 1`] = `
+Array [
+ Identifier {
+ type: "Identifier",
+ value: "abstract",
+
+ range: [0, 8],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 8, line: 1 },
+ },
+ },
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [9, 14],
+ loc: {
+ start: { column: 9, line: 1 },
+ end: { column: 14, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [15, 18],
+ loc: {
+ start: { column: 15, line: 1 },
+ end: { column: 18, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [19, 20],
+ loc: {
+ start: { column: 19, line: 1 },
+ end: { column: 20, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "abstract",
+
+ range: [23, 31],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [32, 40],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [41, 44],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ":",
+
+ range: [44, 45],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "number",
+
+ range: [46, 52],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 31, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [52, 53],
+ loc: {
+ start: { column: 31, line: 2 },
+ end: { column: 32, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [54, 55],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot
new file mode 100644
index 000000000000..6f975b3a497d
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/3-Babel-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-abstract Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:23)]`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts
new file mode 100644
index 000000000000..70dd6b95f615
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/fixture.ts
@@ -0,0 +1,3 @@
+class Foo extends Bar {
+ override accessor foo = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..b0e78060a090
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,90 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-override TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [44, 47],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ override: true,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [50, 51],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+
+ range: [26, 52],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ ],
+
+ range: [22, 54],
+ loc: {
+ start: { column: 22, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: Identifier {
+ type: "Identifier",
+ name: "Bar",
+
+ range: [18, 21],
+ loc: {
+ start: { column: 18, line: 1 },
+ end: { column: 21, line: 1 },
+ },
+ },
+
+ range: [0, 54],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 55],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..24c22b851468
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,126 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-override TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Keyword {
+ type: "Keyword",
+ value: "extends",
+
+ range: [10, 17],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 17, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Bar",
+
+ range: [18, 21],
+ loc: {
+ start: { column: 18, line: 1 },
+ end: { column: 21, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [22, 23],
+ loc: {
+ start: { column: 22, line: 1 },
+ end: { column: 23, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "override",
+
+ range: [26, 34],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [35, 43],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [44, 47],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [48, 49],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [50, 51],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [51, 52],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [53, 54],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..49d82178de54
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/3-Babel-AST.shot
@@ -0,0 +1,89 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-override Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [44, 47],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ override: true,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [50, 51],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+
+ range: [26, 52],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ ],
+
+ range: [22, 54],
+ loc: {
+ start: { column: 22, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: Identifier {
+ type: "Identifier",
+ name: "Bar",
+
+ range: [18, 21],
+ loc: {
+ start: { column: 18, line: 1 },
+ end: { column: 21, line: 1 },
+ },
+ },
+
+ range: [0, 54],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 55],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..dd9763a4fcdc
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,126 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-override Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Keyword {
+ type: "Keyword",
+ value: "extends",
+
+ range: [10, 17],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 17, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Bar",
+
+ range: [18, 21],
+ loc: {
+ start: { column: 18, line: 1 },
+ end: { column: 21, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [22, 23],
+ loc: {
+ start: { column: 22, line: 1 },
+ end: { column: 23, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "override",
+
+ range: [26, 34],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [35, 43],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [44, 47],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [48, 49],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [50, 51],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [51, 52],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [53, 54],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..7949a056f9a6
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: false,
+- declare: false,
+ key: Identifier {
+ type: 'Identifier',
+ name: 'foo',
+
+ range: [44, 47],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ override: true,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '2',
+ value: 2,
+
+ range: [50, 51],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+
+ range: [26, 52],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ ],
+
+ range: [22, 54],
+ loc: {
+ start: { column: 22, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: Identifier {
+ type: 'Identifier',
+ name: 'Bar',
+
+ range: [18, 21],
+ loc: {
+ start: { column: 18, line: 1 },
+ end: { column: 21, line: 1 },
+ },
+ },
+
+ range: [0, 54],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 55],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..4585c5481d03
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,6 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - Token 1`] = `
+"Snapshot Diff:
+Compared values have no visual difference."
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts
new file mode 100644
index 000000000000..ceacabc649f7
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ private accessor foo = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..0f0fa0f2a107
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,82 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-private TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ accessibility: "private",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [31, 34],
+ loc: {
+ start: { column: 19, line: 2 },
+ end: { column: 22, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+
+ range: [14, 39],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 41],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 41],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 42],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..17510235b468
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-private TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Keyword {
+ type: "Keyword",
+ value: "private",
+
+ range: [14, 21],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 9, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [22, 30],
+ loc: {
+ start: { column: 10, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [31, 34],
+ loc: {
+ start: { column: 19, line: 2 },
+ end: { column: 22, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [35, 36],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [38, 39],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [40, 41],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..b11a056920dc
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/3-Babel-AST.shot
@@ -0,0 +1,80 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-private Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ accessibility: "private",
+ computed: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [31, 34],
+ loc: {
+ start: { column: 19, line: 2 },
+ end: { column: 22, line: 2 },
+ },
+ },
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+
+ range: [14, 39],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 41],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 41],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 42],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..75520e7741d1
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-private Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "private",
+
+ range: [14, 21],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 9, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [22, 30],
+ loc: {
+ start: { column: 10, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [31, 34],
+ loc: {
+ start: { column: 19, line: 2 },
+ end: { column: 22, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [35, 36],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [38, 39],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [40, 41],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..fd302779cf11
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ accessibility: 'private',
+ computed: false,
+- declare: false,
+ key: Identifier {
+ type: 'Identifier',
+ name: 'foo',
+
+ range: [31, 34],
+ loc: {
+ start: { column: 19, line: 2 },
+ end: { column: 22, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '2',
+ value: 2,
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+
+ range: [14, 39],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 41],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 41],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 42],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..35301570665f
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,112 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - Token 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Array [
+ Keyword {
+ type: 'Keyword',
+ value: 'class',
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '{',
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+- Keyword {
+- type: 'Keyword',
++ Identifier {
++ type: 'Identifier',
+ value: 'private',
+
+ range: [14, 21],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 9, line: 2 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'accessor',
+
+ range: [22, 30],
+ loc: {
+ start: { column: 10, line: 2 },
+ end: { column: 18, line: 2 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'foo',
+
+ range: [31, 34],
+ loc: {
+ start: { column: 19, line: 2 },
+ end: { column: 22, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '=',
+
+ range: [35, 36],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Numeric {
+ type: 'Numeric',
+ value: '2',
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: ';',
+
+ range: [38, 39],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '}',
+
+ range: [40, 41],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ]"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts
new file mode 100644
index 000000000000..dac8cd734c58
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ protected accessor foo = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..d862c8f8648d
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,82 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-protected TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ accessibility: "protected",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [33, 36],
+ loc: {
+ start: { column: 21, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+
+ range: [14, 41],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 43],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 43],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 44],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..88ab4ac1f406
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-protected TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Keyword {
+ type: "Keyword",
+ value: "protected",
+
+ range: [14, 23],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 11, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [24, 32],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 20, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [33, 36],
+ loc: {
+ start: { column: 21, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [40, 41],
+ loc: {
+ start: { column: 28, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [42, 43],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..dbabfaa6a934
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/3-Babel-AST.shot
@@ -0,0 +1,80 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-protected Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ accessibility: "protected",
+ computed: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [33, 36],
+ loc: {
+ start: { column: 21, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+
+ range: [14, 41],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 43],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 43],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 44],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..c730984ef441
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-protected Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "protected",
+
+ range: [14, 23],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 11, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [24, 32],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 20, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [33, 36],
+ loc: {
+ start: { column: 21, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [40, 41],
+ loc: {
+ start: { column: 28, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [42, 43],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..c26ec2b5985f
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ accessibility: 'protected',
+ computed: false,
+- declare: false,
+ key: Identifier {
+ type: 'Identifier',
+ name: 'foo',
+
+ range: [33, 36],
+ loc: {
+ start: { column: 21, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '2',
+ value: 2,
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+
+ range: [14, 41],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 43],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 43],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 44],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..cbbcda535414
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,112 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment - Token 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Array [
+ Keyword {
+ type: 'Keyword',
+ value: 'class',
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '{',
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+- Keyword {
+- type: 'Keyword',
++ Identifier {
++ type: 'Identifier',
+ value: 'protected',
+
+ range: [14, 23],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 11, line: 2 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'accessor',
+
+ range: [24, 32],
+ loc: {
+ start: { column: 12, line: 2 },
+ end: { column: 20, line: 2 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'foo',
+
+ range: [33, 36],
+ loc: {
+ start: { column: 21, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '=',
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Numeric {
+ type: 'Numeric',
+ value: '2',
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: ';',
+
+ range: [40, 41],
+ loc: {
+ start: { column: 28, line: 2 },
+ end: { column: 29, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '}',
+
+ range: [42, 43],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ]"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts
new file mode 100644
index 000000000000..bbcbc59c710f
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ public accessor foo = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..6a1c4d1b7ecb
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,82 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-public TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ accessibility: "public",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+
+ range: [14, 38],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 40],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 40],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 41],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..31de17a79dd9
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-public TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Keyword {
+ type: "Keyword",
+ value: "public",
+
+ range: [14, 20],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 8, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [21, 29],
+ loc: {
+ start: { column: 9, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [34, 35],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..ed50b70a5c77
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/3-Babel-AST.shot
@@ -0,0 +1,80 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-public Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ accessibility: "public",
+ computed: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+
+ range: [14, 38],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 40],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 40],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 41],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..e0257ccc7358
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-public Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "public",
+
+ range: [14, 20],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 8, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [21, 29],
+ loc: {
+ start: { column: 9, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [34, 35],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..9eb4ac8ef9bf
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ accessibility: 'public',
+ computed: false,
+- declare: false,
+ key: Identifier {
+ type: 'Identifier',
+ name: 'foo',
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '2',
+ value: 2,
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+
+ range: [14, 38],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 40],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 40],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 41],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..7228be97ad20
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,112 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - Token 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Array [
+ Keyword {
+ type: 'Keyword',
+ value: 'class',
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '{',
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+- Keyword {
+- type: 'Keyword',
++ Identifier {
++ type: 'Identifier',
+ value: 'public',
+
+ range: [14, 20],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 8, line: 2 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'accessor',
+
+ range: [21, 29],
+ loc: {
+ start: { column: 9, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Identifier {
+ type: 'Identifier',
+ value: 'foo',
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '=',
+
+ range: [34, 35],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Numeric {
+ type: 'Numeric',
+ value: '2',
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: ';',
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Punctuator {
+ type: 'Punctuator',
+ value: '}',
+
+ range: [39, 40],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ]"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts
new file mode 100644
index 000000000000..532df27a9eea
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ readonly accessor foo = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..41928f7e572a
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,82 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-readonly TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [32, 35],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ override: false,
+ readonly: true,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [38, 39],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+
+ range: [14, 40],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 42],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 42],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 43],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..802229ba8aea
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-readonly TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "readonly",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [23, 31],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [32, 35],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [38, 39],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [41, 42],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..369cfde552a0
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/3-Babel-AST.shot
@@ -0,0 +1,80 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-readonly Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [32, 35],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ readonly: true,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [38, 39],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+
+ range: [14, 40],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 42],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 42],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 43],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..673f38fe66ca
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-readonly Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "readonly",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [23, 31],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 19, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [32, 35],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [38, 39],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 27, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [41, 42],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..7f48bba2e58b
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: false,
+- declare: false,
+ key: Identifier {
+ type: 'Identifier',
+ name: 'foo',
+
+ range: [32, 35],
+ loc: {
+ start: { column: 20, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+- override: false,
+ readonly: true,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '2',
+ value: 2,
+
+ range: [38, 39],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 27, line: 2 },
+ },
+ },
+
+ range: [14, 40],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 28, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 42],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 42],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 43],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..ba78cbeda59f
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,6 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - Token 1`] = `
+"Snapshot Diff:
+Compared values have no visual difference."
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts
new file mode 100644
index 000000000000..0c8cd7ca6a43
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ static accessor foo = 2;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..6733de847c83
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,81 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-static TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ override: false,
+ static: true,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+
+ range: [14, 38],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 40],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 40],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 41],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..245c071ee555
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-static TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Keyword {
+ type: "Keyword",
+ value: "static",
+
+ range: [14, 20],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 8, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [21, 29],
+ loc: {
+ start: { column: 9, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [34, 35],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..917914d80fb4
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/3-Babel-AST.shot
@@ -0,0 +1,79 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-static Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "foo",
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ static: true,
+ value: Literal {
+ type: "Literal",
+ raw: "2",
+ value: 2,
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+
+ range: [14, 38],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 40],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 40],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 41],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..64b2cf044086
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,106 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-static Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Keyword {
+ type: "Keyword",
+ value: "static",
+
+ range: [14, 20],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 8, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [21, 29],
+ loc: {
+ start: { column: 9, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "foo",
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [34, 35],
+ loc: {
+ start: { column: 22, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Numeric {
+ type: "Numeric",
+ value: "2",
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 25, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [39, 40],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..c5c6c8589eeb
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,87 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: false,
+- declare: false,
+ key: Identifier {
+ type: 'Identifier',
+ name: 'foo',
+
+ range: [30, 33],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 21, line: 2 },
+ },
+ },
+- override: false,
+ static: true,
+ value: Literal {
+ type: 'Literal',
+ raw: '2',
+ value: 2,
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+
+ range: [14, 38],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 26, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 40],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 40],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 41],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..72680d23ee59
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,6 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - Token 1`] = `
+"Snapshot Diff:
+Compared values have no visual difference."
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts
new file mode 100644
index 000000000000..18afaa86480c
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ accessor prop;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..a5341fd2f70f
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,71 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-no-value TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: null,
+
+ range: [14, 28],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 30],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 30],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 31],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..b28c76ee39c6
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,76 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-no-value TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [29, 30],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..7cf14ad2c925
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/3-Babel-AST.shot
@@ -0,0 +1,69 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-no-value Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ static: false,
+ value: null,
+
+ range: [14, 28],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 30],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 30],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 31],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..46747c3659a1
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,76 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-no-value Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [29, 30],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..b08e790e91d3
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,77 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: false,
+- declare: false,
+ key: Identifier {
+ type: 'Identifier',
+ name: 'prop',
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: null,
+
+ range: [14, 28],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 30],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 30],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 31],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..3a66da8c8d92
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,6 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignment - Token 1`] = `
+"Snapshot Diff:
+Compared values have no visual difference."
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts
new file mode 100644
index 000000000000..4ac51cccf924
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ accessor prop = 'str';
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..0cc63f224869
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,81 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-with-value TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "'str'",
+ value: "str",
+
+ range: [30, 35],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+
+ range: [14, 36],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 38],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 38],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 39],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..e98ce8a1ccf0
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-with-value TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [28, 29],
+ loc: {
+ start: { column: 16, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'str'",
+
+ range: [30, 35],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [35, 36],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot
new file mode 100644
index 000000000000..7c1c8d024f9b
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/3-Babel-AST.shot
@@ -0,0 +1,79 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-with-value Babel - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ ClassAccessorProperty {
+ type: "ClassAccessorProperty",
+ computed: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ static: false,
+ value: Literal {
+ type: "Literal",
+ raw: "'str'",
+ value: "str",
+
+ range: [30, 35],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+
+ range: [14, 36],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 38],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 38],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 39],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot
new file mode 100644
index 000000000000..fbe3b7015a85
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/4-Babel-Tokens.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-with-value Babel - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [28, 29],
+ loc: {
+ start: { column: 16, line: 2 },
+ end: { column: 17, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'str'",
+
+ range: [30, 35],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [35, 36],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot
new file mode 100644
index 000000000000..2d4b943581cf
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot
@@ -0,0 +1,87 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alignment - AST 1`] = `
+"Snapshot Diff:
+- TSESTree
++ Babel
+
+ Program {
+ type: 'Program',
+ body: Array [
+ ClassDeclaration {
+ type: 'ClassDeclaration',
+ body: ClassBody {
+ type: 'ClassBody',
+ body: Array [
+- AccessorProperty {
+- type: 'AccessorProperty',
++ ClassAccessorProperty {
++ type: 'ClassAccessorProperty',
+ computed: false,
+- declare: false,
+ key: Identifier {
+ type: 'Identifier',
+ name: 'prop',
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+- override: false,
+ static: false,
+ value: Literal {
+ type: 'Literal',
+ raw: '\\\\'str\\\\'',
+ value: 'str',
+
+ range: [30, 35],
+ loc: {
+ start: { column: 18, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+
+ range: [14, 36],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 38],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: 'Identifier',
+ name: 'Foo',
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 38],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: 'script',
+
+ range: [0, 39],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+ }"
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot
new file mode 100644
index 000000000000..01d2c94e6853
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/6-AST-Alignment-Tokens.shot
@@ -0,0 +1,6 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alignment - Token 1`] = `
+"Snapshot Diff:
+Compared values have no visual difference."
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts
new file mode 100644
index 000000000000..61e0e137a0eb
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/config.ts
@@ -0,0 +1,3 @@
+export default {
+ expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205',
+} satisfies ASTFixtureConfig;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts
new file mode 100644
index 000000000000..1ec3f55869e5
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ accessor prop: string;
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..be65f1b2fcdc
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,89 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty with-annotation-no-value TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ typeAnnotation: TSTypeAnnotation {
+ type: "TSTypeAnnotation",
+ typeAnnotation: TSStringKeyword {
+ type: "TSStringKeyword",
+
+ range: [29, 35],
+ loc: {
+ start: { column: 17, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+
+ range: [27, 35],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ value: null,
+
+ range: [14, 36],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 38],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 38],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 39],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..3787e2a78f81
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,96 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty with-annotation-no-value TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ":",
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "string",
+
+ range: [29, 35],
+ loc: {
+ start: { column: 17, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [35, 36],
+ loc: {
+ start: { column: 23, line: 2 },
+ end: { column: 24, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [37, 38],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot
new file mode 100644
index 000000000000..95932fa93896
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/3-Babel-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty with-annotation-no-value Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:15)]`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts
new file mode 100644
index 000000000000..61e0e137a0eb
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/config.ts
@@ -0,0 +1,3 @@
+export default {
+ expectBabelToNotSupport: 'https://github.com/babel/babel/issues/15205',
+} satisfies ASTFixtureConfig;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts
new file mode 100644
index 000000000000..0fde6c3138cb
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts
@@ -0,0 +1,3 @@
+class Foo {
+ accessor prop: string = 'str';
+}
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot
new file mode 100644
index 000000000000..9e9448b46f1e
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot
@@ -0,0 +1,99 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty with-annotation-with-value TSESTree - AST 1`] = `
+Program {
+ type: "Program",
+ body: Array [
+ ClassDeclaration {
+ type: "ClassDeclaration",
+ body: ClassBody {
+ type: "ClassBody",
+ body: Array [
+ AccessorProperty {
+ type: "AccessorProperty",
+ computed: false,
+ declare: false,
+ key: Identifier {
+ type: "Identifier",
+ name: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ override: false,
+ static: false,
+ typeAnnotation: TSTypeAnnotation {
+ type: "TSTypeAnnotation",
+ typeAnnotation: TSStringKeyword {
+ type: "TSStringKeyword",
+
+ range: [29, 35],
+ loc: {
+ start: { column: 17, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+
+ range: [27, 35],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ value: Literal {
+ type: "Literal",
+ raw: "'str'",
+ value: "str",
+
+ range: [38, 43],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 31, line: 2 },
+ },
+ },
+
+ range: [14, 44],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 32, line: 2 },
+ },
+ },
+ ],
+
+ range: [10, 46],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ id: Identifier {
+ type: "Identifier",
+ name: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ superClass: null,
+
+ range: [0, 46],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 1, line: 3 },
+ },
+ },
+ ],
+ sourceType: "script",
+
+ range: [0, 47],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 0, line: 4 },
+ },
+}
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot
new file mode 100644
index 000000000000..2ee9140971ce
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/2-TSESTree-Tokens.shot
@@ -0,0 +1,116 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty with-annotation-with-value TSESTree - Tokens 1`] = `
+Array [
+ Keyword {
+ type: "Keyword",
+ value: "class",
+
+ range: [0, 5],
+ loc: {
+ start: { column: 0, line: 1 },
+ end: { column: 5, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "Foo",
+
+ range: [6, 9],
+ loc: {
+ start: { column: 6, line: 1 },
+ end: { column: 9, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "{",
+
+ range: [10, 11],
+ loc: {
+ start: { column: 10, line: 1 },
+ end: { column: 11, line: 1 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "accessor",
+
+ range: [14, 22],
+ loc: {
+ start: { column: 2, line: 2 },
+ end: { column: 10, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "prop",
+
+ range: [23, 27],
+ loc: {
+ start: { column: 11, line: 2 },
+ end: { column: 15, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ":",
+
+ range: [27, 28],
+ loc: {
+ start: { column: 15, line: 2 },
+ end: { column: 16, line: 2 },
+ },
+ },
+ Identifier {
+ type: "Identifier",
+ value: "string",
+
+ range: [29, 35],
+ loc: {
+ start: { column: 17, line: 2 },
+ end: { column: 23, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "=",
+
+ range: [36, 37],
+ loc: {
+ start: { column: 24, line: 2 },
+ end: { column: 25, line: 2 },
+ },
+ },
+ String {
+ type: "String",
+ value: "'str'",
+
+ range: [38, 43],
+ loc: {
+ start: { column: 26, line: 2 },
+ end: { column: 31, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [43, 44],
+ loc: {
+ start: { column: 31, line: 2 },
+ end: { column: 32, line: 2 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: "}",
+
+ range: [45, 46],
+ loc: {
+ start: { column: 0, line: 3 },
+ end: { column: 1, line: 3 },
+ },
+ },
+]
+`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot
new file mode 100644
index 000000000000..58104f64f7b3
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/3-Babel-Error.shot
@@ -0,0 +1,3 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures element AccessorProperty with-annotation-with-value Babel - Error 1`] = `[SyntaxError: Missing semicolon. (2:15)]`;
diff --git a/packages/ast-spec/src/element/AccessorProperty/spec.ts b/packages/ast-spec/src/element/AccessorProperty/spec.ts
new file mode 100644
index 000000000000..739481e9c231
--- /dev/null
+++ b/packages/ast-spec/src/element/AccessorProperty/spec.ts
@@ -0,0 +1,19 @@
+import type { AST_NODE_TYPES } from '../../ast-node-types';
+import type {
+ PropertyDefinitionComputedNameBase,
+ PropertyDefinitionNonComputedNameBase,
+} from '../../base/PropertyDefinitionBase';
+
+export interface AccessorPropertyComputedName
+ extends PropertyDefinitionComputedNameBase {
+ type: AST_NODE_TYPES.AccessorProperty;
+}
+
+export interface AccessorPropertyNonComputedName
+ extends PropertyDefinitionNonComputedNameBase {
+ type: AST_NODE_TYPES.AccessorProperty;
+}
+
+export type AccessorProperty =
+ | AccessorPropertyComputedName
+ | AccessorPropertyNonComputedName;
diff --git a/packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts b/packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts
new file mode 100644
index 000000000000..6ca44e441836
--- /dev/null
+++ b/packages/ast-spec/src/element/TSAbstractAccessorProperty/spec.ts
@@ -0,0 +1,22 @@
+import type { AST_NODE_TYPES } from '../../ast-node-types';
+import type {
+ PropertyDefinitionComputedNameBase,
+ PropertyDefinitionNonComputedNameBase,
+} from '../../base/PropertyDefinitionBase';
+
+export interface TSAbstractAccessorPropertyComputedName
+ extends PropertyDefinitionComputedNameBase {
+ type: AST_NODE_TYPES.TSAbstractAccessorProperty;
+ value: null;
+}
+
+export interface TSAbstractAccessorPropertyNonComputedName
+ // this does not extend ClassPropertyDefinitionNonComputedNameBase because abstract private names are not allowed
+ extends PropertyDefinitionNonComputedNameBase {
+ type: AST_NODE_TYPES.TSAbstractAccessorProperty;
+ value: null;
+}
+
+export type TSAbstractAccessorProperty =
+ | TSAbstractAccessorPropertyComputedName
+ | TSAbstractAccessorPropertyNonComputedName;
diff --git a/packages/ast-spec/src/element/spec.ts b/packages/ast-spec/src/element/spec.ts
index 77ed3f2f283d..eeecc41028cb 100644
--- a/packages/ast-spec/src/element/spec.ts
+++ b/packages/ast-spec/src/element/spec.ts
@@ -1,8 +1,10 @@
+export * from './AccessorProperty/spec';
export * from './PropertyDefinition/spec';
export * from './MethodDefinition/spec';
export * from './Property/spec';
export * from './SpreadElement/spec';
export * from './StaticBlock/spec';
+export * from './TSAbstractAccessorProperty/spec';
export * from './TSAbstractPropertyDefinition/spec';
export * from './TSAbstractMethodDefinition/spec';
export * from './TSCallSignatureDeclaration/spec';
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
index 917317da825e..36e81ab9edbd 100644
--- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/fixture.ts
+++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/array-array/fixture.ts
@@ -1 +1 @@
-[1,2,3] satisfies [1, 2, 3];
+[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
index 8c0e41971eaa..cfbfed088ce2 100644
--- 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
@@ -27,10 +27,10 @@ Program {
raw: "2",
value: 2,
- range: [3, 4],
+ range: [4, 5],
loc: {
- start: { column: 3, line: 1 },
- end: { column: 4, line: 1 },
+ start: { column: 4, line: 1 },
+ end: { column: 5, line: 1 },
},
},
Literal {
@@ -38,18 +38,18 @@ Program {
raw: "3",
value: 3,
- range: [5, 6],
+ range: [7, 8],
loc: {
- start: { column: 5, line: 1 },
- end: { column: 6, line: 1 },
+ start: { column: 7, line: 1 },
+ end: { column: 8, line: 1 },
},
},
],
- range: [0, 7],
+ range: [0, 9],
loc: {
start: { column: 0, line: 1 },
- end: { column: 7, line: 1 },
+ end: { column: 9, line: 1 },
},
},
typeAnnotation: TSTupleType {
@@ -62,17 +62,17 @@ Program {
raw: "1",
value: 1,
- range: [19, 20],
+ range: [21, 22],
loc: {
- start: { column: 19, line: 1 },
- end: { column: 20, line: 1 },
+ start: { column: 21, line: 1 },
+ end: { column: 22, line: 1 },
},
},
- range: [19, 20],
+ range: [21, 22],
loc: {
- start: { column: 19, line: 1 },
- end: { column: 20, line: 1 },
+ start: { column: 21, line: 1 },
+ end: { column: 22, line: 1 },
},
},
TSLiteralType {
@@ -82,17 +82,17 @@ Program {
raw: "2",
value: 2,
- range: [22, 23],
+ range: [24, 25],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 23, line: 1 },
+ start: { column: 24, line: 1 },
+ end: { column: 25, line: 1 },
},
},
- range: [22, 23],
+ range: [24, 25],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 23, line: 1 },
+ start: { column: 24, line: 1 },
+ end: { column: 25, line: 1 },
},
},
TSLiteralType {
@@ -102,45 +102,45 @@ Program {
raw: "3",
value: 3,
- range: [25, 26],
+ range: [27, 28],
loc: {
- start: { column: 25, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 27, line: 1 },
+ end: { column: 28, line: 1 },
},
},
- range: [25, 26],
+ range: [27, 28],
loc: {
- start: { column: 25, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 27, line: 1 },
+ end: { column: 28, line: 1 },
},
},
],
- range: [18, 27],
+ range: [20, 29],
loc: {
- start: { column: 18, line: 1 },
- end: { column: 27, line: 1 },
+ start: { column: 20, line: 1 },
+ end: { column: 29, line: 1 },
},
},
- range: [0, 27],
+ range: [0, 29],
loc: {
start: { column: 0, line: 1 },
- end: { column: 27, line: 1 },
+ end: { column: 29, line: 1 },
},
},
- range: [0, 28],
+ range: [0, 30],
loc: {
start: { column: 0, line: 1 },
- end: { column: 28, line: 1 },
+ end: { column: 30, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 29],
+ range: [0, 31],
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
index 1bde181188ca..b4adbaf21bb9 100644
--- 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
@@ -36,130 +36,130 @@ Array [
type: "Numeric",
value: "2",
- range: [3, 4],
+ range: [4, 5],
loc: {
- start: { column: 3, line: 1 },
- end: { column: 4, line: 1 },
+ start: { column: 4, line: 1 },
+ end: { column: 5, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ",",
- range: [4, 5],
+ range: [5, 6],
loc: {
- start: { column: 4, line: 1 },
- end: { column: 5, line: 1 },
+ start: { column: 5, line: 1 },
+ end: { column: 6, line: 1 },
},
},
Numeric {
type: "Numeric",
value: "3",
- range: [5, 6],
+ range: [7, 8],
loc: {
- start: { column: 5, line: 1 },
- end: { column: 6, line: 1 },
+ start: { column: 7, line: 1 },
+ end: { column: 8, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: "]",
- range: [6, 7],
+ range: [8, 9],
loc: {
- start: { column: 6, line: 1 },
- end: { column: 7, line: 1 },
+ start: { column: 8, line: 1 },
+ end: { column: 9, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "satisfies",
- range: [8, 17],
+ range: [10, 19],
loc: {
- start: { column: 8, line: 1 },
- end: { column: 17, line: 1 },
+ start: { column: 10, line: 1 },
+ end: { column: 19, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: "[",
- range: [18, 19],
+ range: [20, 21],
loc: {
- start: { column: 18, line: 1 },
- end: { column: 19, line: 1 },
+ start: { column: 20, line: 1 },
+ end: { column: 21, line: 1 },
},
},
Numeric {
type: "Numeric",
value: "1",
- range: [19, 20],
+ range: [21, 22],
loc: {
- start: { column: 19, line: 1 },
- end: { column: 20, line: 1 },
+ start: { column: 21, line: 1 },
+ end: { column: 22, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ",",
- range: [20, 21],
+ range: [22, 23],
loc: {
- start: { column: 20, line: 1 },
- end: { column: 21, line: 1 },
+ start: { column: 22, line: 1 },
+ end: { column: 23, line: 1 },
},
},
Numeric {
type: "Numeric",
value: "2",
- range: [22, 23],
+ range: [24, 25],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 23, line: 1 },
+ start: { column: 24, line: 1 },
+ end: { column: 25, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ",",
- range: [23, 24],
+ range: [25, 26],
loc: {
- start: { column: 23, line: 1 },
- end: { column: 24, line: 1 },
+ start: { column: 25, line: 1 },
+ end: { column: 26, line: 1 },
},
},
Numeric {
type: "Numeric",
value: "3",
- range: [25, 26],
+ range: [27, 28],
loc: {
- start: { column: 25, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 27, line: 1 },
+ end: { column: 28, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: "]",
- range: [26, 27],
+ range: [28, 29],
loc: {
- start: { column: 26, line: 1 },
- end: { column: 27, line: 1 },
+ start: { column: 28, line: 1 },
+ end: { column: 29, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ";",
- range: [27, 28],
+ range: [29, 30],
loc: {
- start: { column: 27, line: 1 },
- end: { column: 28, line: 1 },
+ start: { column: 29, line: 1 },
+ end: { column: 30, 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
index d7f5aec514ed..635240ef2dd1 100644
--- 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
@@ -27,10 +27,10 @@ Program {
raw: "2",
value: 2,
- range: [3, 4],
+ range: [4, 5],
loc: {
- start: { column: 3, line: 1 },
- end: { column: 4, line: 1 },
+ start: { column: 4, line: 1 },
+ end: { column: 5, line: 1 },
},
},
Literal {
@@ -38,18 +38,18 @@ Program {
raw: "3",
value: 3,
- range: [5, 6],
+ range: [7, 8],
loc: {
- start: { column: 5, line: 1 },
- end: { column: 6, line: 1 },
+ start: { column: 7, line: 1 },
+ end: { column: 8, line: 1 },
},
},
],
- range: [0, 7],
+ range: [0, 9],
loc: {
start: { column: 0, line: 1 },
- end: { column: 7, line: 1 },
+ end: { column: 9, line: 1 },
},
},
typeAnnotation: TSTupleType {
@@ -62,17 +62,17 @@ Program {
raw: "1",
value: 1,
- range: [19, 20],
+ range: [21, 22],
loc: {
- start: { column: 19, line: 1 },
- end: { column: 20, line: 1 },
+ start: { column: 21, line: 1 },
+ end: { column: 22, line: 1 },
},
},
- range: [19, 20],
+ range: [21, 22],
loc: {
- start: { column: 19, line: 1 },
- end: { column: 20, line: 1 },
+ start: { column: 21, line: 1 },
+ end: { column: 22, line: 1 },
},
},
TSLiteralType {
@@ -82,17 +82,17 @@ Program {
raw: "2",
value: 2,
- range: [22, 23],
+ range: [24, 25],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 23, line: 1 },
+ start: { column: 24, line: 1 },
+ end: { column: 25, line: 1 },
},
},
- range: [22, 23],
+ range: [24, 25],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 23, line: 1 },
+ start: { column: 24, line: 1 },
+ end: { column: 25, line: 1 },
},
},
TSLiteralType {
@@ -102,45 +102,45 @@ Program {
raw: "3",
value: 3,
- range: [25, 26],
+ range: [27, 28],
loc: {
- start: { column: 25, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 27, line: 1 },
+ end: { column: 28, line: 1 },
},
},
- range: [25, 26],
+ range: [27, 28],
loc: {
- start: { column: 25, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 27, line: 1 },
+ end: { column: 28, line: 1 },
},
},
],
- range: [18, 27],
+ range: [20, 29],
loc: {
- start: { column: 18, line: 1 },
- end: { column: 27, line: 1 },
+ start: { column: 20, line: 1 },
+ end: { column: 29, line: 1 },
},
},
- range: [0, 27],
+ range: [0, 29],
loc: {
start: { column: 0, line: 1 },
- end: { column: 27, line: 1 },
+ end: { column: 29, line: 1 },
},
},
- range: [0, 28],
+ range: [0, 30],
loc: {
start: { column: 0, line: 1 },
- end: { column: 28, line: 1 },
+ end: { column: 30, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 29],
+ range: [0, 31],
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
index 02abe5d8cba1..814b7c0915b2 100644
--- 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
@@ -36,130 +36,130 @@ Array [
type: "Numeric",
value: "2",
- range: [3, 4],
+ range: [4, 5],
loc: {
- start: { column: 3, line: 1 },
- end: { column: 4, line: 1 },
+ start: { column: 4, line: 1 },
+ end: { column: 5, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ",",
- range: [4, 5],
+ range: [5, 6],
loc: {
- start: { column: 4, line: 1 },
- end: { column: 5, line: 1 },
+ start: { column: 5, line: 1 },
+ end: { column: 6, line: 1 },
},
},
Numeric {
type: "Numeric",
value: "3",
- range: [5, 6],
+ range: [7, 8],
loc: {
- start: { column: 5, line: 1 },
- end: { column: 6, line: 1 },
+ start: { column: 7, line: 1 },
+ end: { column: 8, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: "]",
- range: [6, 7],
+ range: [8, 9],
loc: {
- start: { column: 6, line: 1 },
- end: { column: 7, line: 1 },
+ start: { column: 8, line: 1 },
+ end: { column: 9, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "satisfies",
- range: [8, 17],
+ range: [10, 19],
loc: {
- start: { column: 8, line: 1 },
- end: { column: 17, line: 1 },
+ start: { column: 10, line: 1 },
+ end: { column: 19, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: "[",
- range: [18, 19],
+ range: [20, 21],
loc: {
- start: { column: 18, line: 1 },
- end: { column: 19, line: 1 },
+ start: { column: 20, line: 1 },
+ end: { column: 21, line: 1 },
},
},
Numeric {
type: "Numeric",
value: "1",
- range: [19, 20],
+ range: [21, 22],
loc: {
- start: { column: 19, line: 1 },
- end: { column: 20, line: 1 },
+ start: { column: 21, line: 1 },
+ end: { column: 22, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ",",
- range: [20, 21],
+ range: [22, 23],
loc: {
- start: { column: 20, line: 1 },
- end: { column: 21, line: 1 },
+ start: { column: 22, line: 1 },
+ end: { column: 23, line: 1 },
},
},
Numeric {
type: "Numeric",
value: "2",
- range: [22, 23],
+ range: [24, 25],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 23, line: 1 },
+ start: { column: 24, line: 1 },
+ end: { column: 25, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ",",
- range: [23, 24],
+ range: [25, 26],
loc: {
- start: { column: 23, line: 1 },
- end: { column: 24, line: 1 },
+ start: { column: 25, line: 1 },
+ end: { column: 26, line: 1 },
},
},
Numeric {
type: "Numeric",
value: "3",
- range: [25, 26],
+ range: [27, 28],
loc: {
- start: { column: 25, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 27, line: 1 },
+ end: { column: 28, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: "]",
- range: [26, 27],
+ range: [28, 29],
loc: {
- start: { column: 26, line: 1 },
- end: { column: 27, line: 1 },
+ start: { column: 28, line: 1 },
+ end: { column: 29, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ";",
- range: [27, 28],
+ range: [29, 30],
loc: {
- start: { column: 27, line: 1 },
- end: { column: 28, line: 1 },
+ start: { column: 29, line: 1 },
+ end: { column: 30, line: 1 },
},
},
]
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
index 8478834cb780..23c6cdf5a50c 100644
--- 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
@@ -1 +1 @@
-() => 1 satisfies number
+() => 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
index 57067f8fbff5..d678e2b5acef 100644
--- 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
@@ -50,16 +50,16 @@ Program {
},
},
- range: [0, 24],
+ range: [0, 25],
loc: {
start: { column: 0, line: 1 },
- end: { column: 24, line: 1 },
+ end: { column: 25, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 25],
+ range: [0, 26],
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
index 09102ae267b1..0d642d948246 100644
--- 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
@@ -62,5 +62,15 @@ Array [
end: { column: 24, line: 1 },
},
},
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [24, 25],
+ loc: {
+ start: { column: 24, line: 1 },
+ end: { column: 25, 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
index 1ef0e54b35d8..55e90ce71c0c 100644
--- 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
@@ -50,16 +50,16 @@ Program {
},
},
- range: [0, 24],
+ range: [0, 25],
loc: {
start: { column: 0, line: 1 },
- end: { column: 24, line: 1 },
+ end: { column: 25, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 25],
+ range: [0, 26],
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
index 24cc5b2042ed..c921c840faaf 100644
--- 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
@@ -62,5 +62,15 @@ Array [
end: { column: 24, line: 1 },
},
},
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [24, 25],
+ loc: {
+ start: { column: 24, line: 1 },
+ end: { column: 25, line: 1 },
+ },
+ },
]
`;
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
index 15624b9aaf34..d0e16762720a 100644
--- 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
@@ -1 +1 @@
-(() => 1) satisfies () => number
+(() => 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
index 7fa95a22000e..193cbbd12e38 100644
--- 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
@@ -69,16 +69,16 @@ Program {
},
},
- range: [0, 32],
+ range: [0, 33],
loc: {
start: { column: 0, line: 1 },
- end: { column: 32, line: 1 },
+ end: { column: 33, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 33],
+ range: [0, 34],
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
index b590cfdea64d..7e75dcaa2c0c 100644
--- 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
@@ -112,5 +112,15 @@ Array [
end: { column: 32, line: 1 },
},
},
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [32, 33],
+ loc: {
+ start: { column: 32, line: 1 },
+ end: { column: 33, 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
index 71627f35b044..7bddc387f4cf 100644
--- 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
@@ -69,16 +69,16 @@ Program {
},
},
- range: [0, 32],
+ range: [0, 33],
loc: {
start: { column: 0, line: 1 },
- end: { column: 32, line: 1 },
+ end: { column: 33, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 33],
+ range: [0, 34],
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
index 58d8821988a5..5edb3e0a8411 100644
--- 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
@@ -112,5 +112,15 @@ Array [
end: { column: 32, line: 1 },
},
},
+ Punctuator {
+ type: "Punctuator",
+ value: ";",
+
+ range: [32, 33],
+ loc: {
+ start: { column: 32, line: 1 },
+ end: { column: 33, 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
index b45b591c63da..1999cc34c680 100644
--- 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
@@ -75,16 +75,16 @@ exports[`AST Fixtures expression TSSatisfiesExpression arrow-func-with-parenthes
},
},
- range: [0, 32],
+ range: [0, 33],
loc: {
start: { column: 0, line: 1 },
- end: { column: 32, line: 1 },
+ end: { column: 33, line: 1 },
},
},
],
sourceType: 'script',
- range: [0, 33],
+ range: [0, 34],
loc: {
start: { column: 0, line: 1 },
end: { column: 0, line: 2 },
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
index 6ead32331fa4..dc8407dc0d6c 100644
--- 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
@@ -1 +1 @@
-foo ? 1 : 0 satisfies number;
+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
index 5674f78acdf1..bb649ea977d4 100644
--- 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
@@ -15,26 +15,26 @@ Program {
raw: "0",
value: 0,
- range: [10, 11],
+ range: [11, 12],
loc: {
- start: { column: 10, line: 1 },
- end: { column: 11, line: 1 },
+ start: { column: 11, line: 1 },
+ end: { column: 12, line: 1 },
},
},
typeAnnotation: TSNumberKeyword {
type: "TSNumberKeyword",
- range: [22, 28],
+ range: [23, 29],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 28, line: 1 },
+ start: { column: 23, line: 1 },
+ end: { column: 29, line: 1 },
},
},
- range: [10, 28],
+ range: [11, 29],
loc: {
- start: { column: 10, line: 1 },
- end: { column: 28, line: 1 },
+ start: { column: 11, line: 1 },
+ end: { column: 29, line: 1 },
},
},
consequent: Literal {
@@ -59,23 +59,23 @@ Program {
},
},
- range: [0, 28],
+ range: [0, 30],
loc: {
start: { column: 0, line: 1 },
- end: { column: 28, line: 1 },
+ end: { column: 30, line: 1 },
},
},
- range: [0, 29],
+ range: [0, 31],
loc: {
start: { column: 0, line: 1 },
- end: { column: 29, line: 1 },
+ end: { column: 31, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 30],
+ 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-no-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/2-TSESTree-Tokens.shot
index 579fa0c06152..43f6da6a6806 100644
--- 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
@@ -42,9 +42,9 @@ Array [
end: { column: 9, line: 1 },
},
},
- Numeric {
- type: "Numeric",
- value: "0",
+ Punctuator {
+ type: "Punctuator",
+ value: "(",
range: [10, 11],
loc: {
@@ -52,34 +52,54 @@ Array [
end: { column: 11, line: 1 },
},
},
+ Numeric {
+ type: "Numeric",
+ value: "0",
+
+ range: [11, 12],
+ loc: {
+ start: { column: 11, line: 1 },
+ end: { column: 12, line: 1 },
+ },
+ },
Identifier {
type: "Identifier",
value: "satisfies",
- range: [12, 21],
+ range: [13, 22],
loc: {
- start: { column: 12, line: 1 },
- end: { column: 21, line: 1 },
+ start: { column: 13, line: 1 },
+ end: { column: 22, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "number",
- range: [22, 28],
+ range: [23, 29],
+ loc: {
+ start: { column: 23, line: 1 },
+ end: { column: 29, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ")",
+
+ range: [29, 30],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 28, line: 1 },
+ start: { column: 29, line: 1 },
+ end: { column: 30, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ";",
- range: [28, 29],
+ range: [30, 31],
loc: {
- start: { column: 28, line: 1 },
- end: { column: 29, line: 1 },
+ start: { column: 30, line: 1 },
+ end: { column: 31, 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
index 9c3ff77da55f..4cba5b2f4f14 100644
--- 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
@@ -15,26 +15,26 @@ Program {
raw: "0",
value: 0,
- range: [10, 11],
+ range: [11, 12],
loc: {
- start: { column: 10, line: 1 },
- end: { column: 11, line: 1 },
+ start: { column: 11, line: 1 },
+ end: { column: 12, line: 1 },
},
},
typeAnnotation: TSNumberKeyword {
type: "TSNumberKeyword",
- range: [22, 28],
+ range: [23, 29],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 28, line: 1 },
+ start: { column: 23, line: 1 },
+ end: { column: 29, line: 1 },
},
},
- range: [10, 28],
+ range: [11, 29],
loc: {
- start: { column: 10, line: 1 },
- end: { column: 28, line: 1 },
+ start: { column: 11, line: 1 },
+ end: { column: 29, line: 1 },
},
},
consequent: Literal {
@@ -59,23 +59,23 @@ Program {
},
},
- range: [0, 28],
+ range: [0, 30],
loc: {
start: { column: 0, line: 1 },
- end: { column: 28, line: 1 },
+ end: { column: 30, line: 1 },
},
},
- range: [0, 29],
+ range: [0, 31],
loc: {
start: { column: 0, line: 1 },
- end: { column: 29, line: 1 },
+ end: { column: 31, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 30],
+ 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-no-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/4-Babel-Tokens.shot
index d9c69f96e5ef..80d8c6ce89ea 100644
--- 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
@@ -42,9 +42,9 @@ Array [
end: { column: 9, line: 1 },
},
},
- Numeric {
- type: "Numeric",
- value: "0",
+ Punctuator {
+ type: "Punctuator",
+ value: "(",
range: [10, 11],
loc: {
@@ -52,34 +52,54 @@ Array [
end: { column: 11, line: 1 },
},
},
+ Numeric {
+ type: "Numeric",
+ value: "0",
+
+ range: [11, 12],
+ loc: {
+ start: { column: 11, line: 1 },
+ end: { column: 12, line: 1 },
+ },
+ },
Identifier {
type: "Identifier",
value: "satisfies",
- range: [12, 21],
+ range: [13, 22],
loc: {
- start: { column: 12, line: 1 },
- end: { column: 21, line: 1 },
+ start: { column: 13, line: 1 },
+ end: { column: 22, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "number",
- range: [22, 28],
+ range: [23, 29],
+ loc: {
+ start: { column: 23, line: 1 },
+ end: { column: 29, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ")",
+
+ range: [29, 30],
loc: {
- start: { column: 22, line: 1 },
- end: { column: 28, line: 1 },
+ start: { column: 29, line: 1 },
+ end: { column: 30, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ";",
- range: [28, 29],
+ range: [30, 31],
loc: {
- start: { column: 28, line: 1 },
- end: { column: 29, line: 1 },
+ start: { column: 30, line: 1 },
+ end: { column: 31, line: 1 },
},
},
]
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
index 09a4c612e307..953653b0e23a 100644
--- 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
@@ -1 +1 @@
-foo === 1 satisfies number;
+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
index f80151c90329..1ad1131264a4 100644
--- 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
@@ -26,46 +26,46 @@ Program {
raw: "1",
value: 1,
- range: [8, 9],
+ range: [9, 10],
loc: {
- start: { column: 8, line: 1 },
- end: { column: 9, line: 1 },
+ start: { column: 9, line: 1 },
+ end: { column: 10, line: 1 },
},
},
typeAnnotation: TSNumberKeyword {
type: "TSNumberKeyword",
- range: [20, 26],
+ range: [21, 27],
loc: {
- start: { column: 20, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 21, line: 1 },
+ end: { column: 27, line: 1 },
},
},
- range: [8, 26],
+ range: [9, 27],
loc: {
- start: { column: 8, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 9, line: 1 },
+ end: { column: 27, line: 1 },
},
},
- range: [0, 26],
+ range: [0, 28],
loc: {
start: { column: 0, line: 1 },
- end: { column: 26, line: 1 },
+ end: { column: 28, line: 1 },
},
},
- range: [0, 27],
+ range: [0, 29],
loc: {
start: { column: 0, line: 1 },
- end: { column: 27, line: 1 },
+ end: { column: 29, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 28],
+ range: [0, 30],
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
index 5391022e27f0..f5e333ee1db9 100644
--- 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
@@ -22,9 +22,9 @@ Array [
end: { column: 7, line: 1 },
},
},
- Numeric {
- type: "Numeric",
- value: "1",
+ Punctuator {
+ type: "Punctuator",
+ value: "(",
range: [8, 9],
loc: {
@@ -32,34 +32,54 @@ Array [
end: { column: 9, line: 1 },
},
},
+ Numeric {
+ type: "Numeric",
+ value: "1",
+
+ range: [9, 10],
+ loc: {
+ start: { column: 9, line: 1 },
+ end: { column: 10, line: 1 },
+ },
+ },
Identifier {
type: "Identifier",
value: "satisfies",
- range: [10, 19],
+ range: [11, 20],
loc: {
- start: { column: 10, line: 1 },
- end: { column: 19, line: 1 },
+ start: { column: 11, line: 1 },
+ end: { column: 20, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "number",
- range: [20, 26],
+ range: [21, 27],
+ loc: {
+ start: { column: 21, line: 1 },
+ end: { column: 27, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ")",
+
+ range: [27, 28],
loc: {
- start: { column: 20, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 27, line: 1 },
+ end: { column: 28, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ";",
- range: [26, 27],
+ range: [28, 29],
loc: {
- start: { column: 26, line: 1 },
- end: { column: 27, line: 1 },
+ start: { column: 28, line: 1 },
+ end: { column: 29, 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
index 60189a703583..a2add0503752 100644
--- 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
@@ -26,46 +26,46 @@ Program {
raw: "1",
value: 1,
- range: [8, 9],
+ range: [9, 10],
loc: {
- start: { column: 8, line: 1 },
- end: { column: 9, line: 1 },
+ start: { column: 9, line: 1 },
+ end: { column: 10, line: 1 },
},
},
typeAnnotation: TSNumberKeyword {
type: "TSNumberKeyword",
- range: [20, 26],
+ range: [21, 27],
loc: {
- start: { column: 20, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 21, line: 1 },
+ end: { column: 27, line: 1 },
},
},
- range: [8, 26],
+ range: [9, 27],
loc: {
- start: { column: 8, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 9, line: 1 },
+ end: { column: 27, line: 1 },
},
},
- range: [0, 26],
+ range: [0, 28],
loc: {
start: { column: 0, line: 1 },
- end: { column: 26, line: 1 },
+ end: { column: 28, line: 1 },
},
},
- range: [0, 27],
+ range: [0, 29],
loc: {
start: { column: 0, line: 1 },
- end: { column: 27, line: 1 },
+ end: { column: 29, line: 1 },
},
},
],
sourceType: "script",
- range: [0, 28],
+ range: [0, 30],
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
index cac159f58dc3..e4fa1f6cea58 100644
--- 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
@@ -22,9 +22,9 @@ Array [
end: { column: 7, line: 1 },
},
},
- Numeric {
- type: "Numeric",
- value: "1",
+ Punctuator {
+ type: "Punctuator",
+ value: "(",
range: [8, 9],
loc: {
@@ -32,34 +32,54 @@ Array [
end: { column: 9, line: 1 },
},
},
+ Numeric {
+ type: "Numeric",
+ value: "1",
+
+ range: [9, 10],
+ loc: {
+ start: { column: 9, line: 1 },
+ end: { column: 10, line: 1 },
+ },
+ },
Identifier {
type: "Identifier",
value: "satisfies",
- range: [10, 19],
+ range: [11, 20],
loc: {
- start: { column: 10, line: 1 },
- end: { column: 19, line: 1 },
+ start: { column: 11, line: 1 },
+ end: { column: 20, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "number",
- range: [20, 26],
+ range: [21, 27],
+ loc: {
+ start: { column: 21, line: 1 },
+ end: { column: 27, line: 1 },
+ },
+ },
+ Punctuator {
+ type: "Punctuator",
+ value: ")",
+
+ range: [27, 28],
loc: {
- start: { column: 20, line: 1 },
- end: { column: 26, line: 1 },
+ start: { column: 27, line: 1 },
+ end: { column: 28, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ";",
- range: [26, 27],
+ range: [28, 29],
loc: {
- start: { column: 26, line: 1 },
- end: { column: 27, line: 1 },
+ start: { column: 28, line: 1 },
+ end: { column: 29, line: 1 },
},
},
]
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
index ec7b71c8e2b1..b7726f7f1404 100644
--- 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
@@ -1 +1 @@
-({ prop: 'string' }) satisfies { prop: string };
+({ 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
index 1ed0e662a991..c39ffc049d11 100644
--- 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
@@ -63,10 +63,10 @@ Program {
type: "Identifier",
name: "prop",
- range: [33, 37],
+ range: [32, 36],
loc: {
- start: { column: 33, line: 1 },
- end: { column: 37, line: 1 },
+ start: { column: 32, line: 1 },
+ end: { column: 36, line: 1 },
},
},
typeAnnotation: TSTypeAnnotation {
@@ -74,39 +74,39 @@ Program {
typeAnnotation: TSStringKeyword {
type: "TSStringKeyword",
- range: [39, 45],
+ range: [38, 44],
loc: {
- start: { column: 39, line: 1 },
- end: { column: 45, line: 1 },
+ start: { column: 38, line: 1 },
+ end: { column: 44, line: 1 },
},
},
- range: [37, 45],
+ range: [36, 44],
loc: {
- start: { column: 37, line: 1 },
- end: { column: 45, line: 1 },
+ start: { column: 36, line: 1 },
+ end: { column: 44, line: 1 },
},
},
- range: [33, 45],
+ range: [32, 44],
loc: {
- start: { column: 33, line: 1 },
- end: { column: 45, line: 1 },
+ start: { column: 32, line: 1 },
+ end: { column: 44, line: 1 },
},
},
],
- range: [31, 47],
+ range: [30, 46],
loc: {
- start: { column: 31, line: 1 },
- end: { column: 47, line: 1 },
+ start: { column: 30, line: 1 },
+ end: { column: 46, line: 1 },
},
},
- range: [0, 47],
+ range: [1, 46],
loc: {
- start: { column: 0, line: 1 },
- end: { column: 47, line: 1 },
+ start: { column: 1, line: 1 },
+ end: { column: 46, line: 1 },
},
},
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
index 99f068a424bf..be50e77f2710 100644
--- 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
@@ -62,70 +62,70 @@ Array [
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],
+ range: [20, 29],
loc: {
- start: { column: 21, line: 1 },
- end: { column: 30, line: 1 },
+ start: { column: 20, line: 1 },
+ end: { column: 29, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: "{",
- range: [31, 32],
+ range: [30, 31],
loc: {
- start: { column: 31, line: 1 },
- end: { column: 32, line: 1 },
+ start: { column: 30, line: 1 },
+ end: { column: 31, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "prop",
- range: [33, 37],
+ range: [32, 36],
loc: {
- start: { column: 33, line: 1 },
- end: { column: 37, line: 1 },
+ start: { column: 32, line: 1 },
+ end: { column: 36, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ":",
- range: [37, 38],
+ range: [36, 37],
loc: {
- start: { column: 37, line: 1 },
- end: { column: 38, line: 1 },
+ start: { column: 36, line: 1 },
+ end: { column: 37, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "string",
- range: [39, 45],
+ range: [38, 44],
loc: {
- start: { column: 39, line: 1 },
- end: { column: 45, line: 1 },
+ 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 },
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
index c5868aaf0d1e..90c569abf825 100644
--- 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
@@ -63,10 +63,10 @@ Program {
type: "Identifier",
name: "prop",
- range: [33, 37],
+ range: [32, 36],
loc: {
- start: { column: 33, line: 1 },
- end: { column: 37, line: 1 },
+ start: { column: 32, line: 1 },
+ end: { column: 36, line: 1 },
},
},
typeAnnotation: TSTypeAnnotation {
@@ -74,39 +74,39 @@ Program {
typeAnnotation: TSStringKeyword {
type: "TSStringKeyword",
- range: [39, 45],
+ range: [38, 44],
loc: {
- start: { column: 39, line: 1 },
- end: { column: 45, line: 1 },
+ start: { column: 38, line: 1 },
+ end: { column: 44, line: 1 },
},
},
- range: [37, 45],
+ range: [36, 44],
loc: {
- start: { column: 37, line: 1 },
- end: { column: 45, line: 1 },
+ start: { column: 36, line: 1 },
+ end: { column: 44, line: 1 },
},
},
- range: [33, 45],
+ range: [32, 44],
loc: {
- start: { column: 33, line: 1 },
- end: { column: 45, line: 1 },
+ start: { column: 32, line: 1 },
+ end: { column: 44, line: 1 },
},
},
],
- range: [31, 47],
+ range: [30, 46],
loc: {
- start: { column: 31, line: 1 },
- end: { column: 47, line: 1 },
+ start: { column: 30, line: 1 },
+ end: { column: 46, line: 1 },
},
},
- range: [0, 47],
+ range: [1, 46],
loc: {
- start: { column: 0, line: 1 },
- end: { column: 47, line: 1 },
+ start: { column: 1, line: 1 },
+ end: { column: 46, line: 1 },
},
},
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
index 128fc9c61284..45fc90349daf 100644
--- 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
@@ -62,70 +62,70 @@ Array [
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],
+ range: [20, 29],
loc: {
- start: { column: 21, line: 1 },
- end: { column: 30, line: 1 },
+ start: { column: 20, line: 1 },
+ end: { column: 29, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: "{",
- range: [31, 32],
+ range: [30, 31],
loc: {
- start: { column: 31, line: 1 },
- end: { column: 32, line: 1 },
+ start: { column: 30, line: 1 },
+ end: { column: 31, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "prop",
- range: [33, 37],
+ range: [32, 36],
loc: {
- start: { column: 33, line: 1 },
- end: { column: 37, line: 1 },
+ start: { column: 32, line: 1 },
+ end: { column: 36, line: 1 },
},
},
Punctuator {
type: "Punctuator",
value: ":",
- range: [37, 38],
+ range: [36, 37],
loc: {
- start: { column: 37, line: 1 },
- end: { column: 38, line: 1 },
+ start: { column: 36, line: 1 },
+ end: { column: 37, line: 1 },
},
},
Identifier {
type: "Identifier",
value: "string",
- range: [39, 45],
+ range: [38, 44],
loc: {
- start: { column: 39, line: 1 },
- end: { column: 45, line: 1 },
+ 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 },
diff --git a/packages/ast-spec/src/unions/ClassElement.ts b/packages/ast-spec/src/unions/ClassElement.ts
index 27d4ec4d752c..21fba7babcf2 100644
--- a/packages/ast-spec/src/unions/ClassElement.ts
+++ b/packages/ast-spec/src/unions/ClassElement.ts
@@ -1,14 +1,18 @@
+import type { AccessorProperty } from '../element/AccessorProperty/spec';
import type { MethodDefinition } from '../element/MethodDefinition/spec';
import type { PropertyDefinition } from '../element/PropertyDefinition/spec';
import type { StaticBlock } from '../element/StaticBlock/spec';
+import type { TSAbstractAccessorProperty } from '../element/TSAbstractAccessorProperty/spec';
import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec';
import type { TSAbstractPropertyDefinition } from '../element/TSAbstractPropertyDefinition/spec';
import type { TSIndexSignature } from '../element/TSIndexSignature/spec';
export type ClassElement =
+ | AccessorProperty
| MethodDefinition
| PropertyDefinition
| StaticBlock
+ | TSAbstractAccessorProperty
| TSAbstractMethodDefinition
| TSAbstractPropertyDefinition
| TSIndexSignature;
diff --git a/packages/ast-spec/src/unions/Node.ts b/packages/ast-spec/src/unions/Node.ts
index 3656a3d677a0..b0952e0e1863 100644
--- a/packages/ast-spec/src/unions/Node.ts
+++ b/packages/ast-spec/src/unions/Node.ts
@@ -12,11 +12,13 @@ import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spe
import type { TSNamespaceExportDeclaration } from '../declaration/TSNamespaceExportDeclaration/spec';
import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec';
import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec';
+import type { AccessorProperty } from '../element/AccessorProperty/spec';
import type { MethodDefinition } from '../element/MethodDefinition/spec';
import type { Property } from '../element/Property/spec';
import type { PropertyDefinition } from '../element/PropertyDefinition/spec';
import type { SpreadElement } from '../element/SpreadElement/spec';
import type { StaticBlock } from '../element/StaticBlock/spec';
+import type { TSAbstractAccessorProperty } from '../element/TSAbstractAccessorProperty/spec';
import type { TSAbstractMethodDefinition } from '../element/TSAbstractMethodDefinition/spec';
import type { TSAbstractPropertyDefinition } from '../element/TSAbstractPropertyDefinition/spec';
import type { TSCallSignatureDeclaration } from '../element/TSCallSignatureDeclaration/spec';
@@ -170,6 +172,7 @@ import type { Literal } from './Literal';
*/
export type Node =
+ | AccessorProperty
| ArrayExpression
| ArrayPattern
| ArrowFunctionExpression
@@ -251,6 +254,7 @@ export type Node =
| ThisExpression
| ThrowStatement
| TryStatement
+ | TSAbstractAccessorProperty
| TSAbstractKeyword
| TSAbstractMethodDefinition
| TSAbstractPropertyDefinition
diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot
index beff8134d6e2..e6ea1804e84d 100644
--- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot
+++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot
@@ -24,6 +24,19 @@ 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",
+ "element/AccessorProperty/fixtures/key-computed-complex/fixture.ts",
+ "element/AccessorProperty/fixtures/key-computed-number/fixture.ts",
+ "element/AccessorProperty/fixtures/key-computed-string/fixture.ts",
+ "element/AccessorProperty/fixtures/key-private/fixture.ts",
+ "element/AccessorProperty/fixtures/key-string/fixture.ts",
+ "element/AccessorProperty/fixtures/modifier-override/fixture.ts",
+ "element/AccessorProperty/fixtures/modifier-private/fixture.ts",
+ "element/AccessorProperty/fixtures/modifier-protected/fixture.ts",
+ "element/AccessorProperty/fixtures/modifier-public/fixture.ts",
+ "element/AccessorProperty/fixtures/modifier-readonly/fixture.ts",
+ "element/AccessorProperty/fixtures/modifier-static/fixture.ts",
+ "element/AccessorProperty/fixtures/no-annotation-no-value/fixture.ts",
+ "element/AccessorProperty/fixtures/no-annotation-with-value/fixture.ts",
"expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts",
}
`;
diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot
index 7946dc0daabc..687999524970 100644
--- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot
+++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot
@@ -21,6 +21,8 @@ Object {
"declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/fixture.ts",
"declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts",
"declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts",
+ "element/AccessorProperty/fixtures/_error_/modifier-declare/fixture.ts",
+ "element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts",
},
"TSESTree errored but Babel didn't": Set {
"declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts",
diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot
index ee92fc9b050c..c9796a384595 100644
--- a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot
+++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot
@@ -22,5 +22,9 @@ Set {
"declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts",
"declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts",
"declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts",
+ "element/AccessorProperty/fixtures/key-private/fixture.ts",
+ "element/AccessorProperty/fixtures/modifier-private/fixture.ts",
+ "element/AccessorProperty/fixtures/modifier-protected/fixture.ts",
+ "element/AccessorProperty/fixtures/modifier-public/fixture.ts",
}
`;
diff --git a/packages/ast-spec/tests/fixtures-without-babel-support.shot b/packages/ast-spec/tests/fixtures-without-babel-support.shot
new file mode 100644
index 000000000000..a4022f6319b7
--- /dev/null
+++ b/packages/ast-spec/tests/fixtures-without-babel-support.shot
@@ -0,0 +1,10 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`AST Fixtures List fixtures we expect babel to not support 1`] = `
+Map {
+ "element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts" => "https://github.com/babel/babel/issues/15205",
+ "element/AccessorProperty/fixtures/modifier-abstract/fixture.ts" => "https://github.com/babel/babel/issues/15205",
+ "element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts" => "https://github.com/babel/babel/issues/15205",
+ "element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts" => "https://github.com/babel/babel/issues/15205",
+}
+`;
diff --git a/packages/ast-spec/tests/fixtures.test.ts b/packages/ast-spec/tests/fixtures.test.ts
index 3fff2ead3f2b..df70fe613eb6 100644
--- a/packages/ast-spec/tests/fixtures.test.ts
+++ b/packages/ast-spec/tests/fixtures.test.ts
@@ -25,6 +25,7 @@ const ONLY = [].join(path.sep);
const fixturesWithASTDifferences = new Set();
const fixturesWithTokenDifferences = new Set();
+const fixturesConfiguredToExpectBabelToNotSupport = new Map();
enum ErrorLabel {
TSESTree = "TSESTree errored but Babel didn't",
Babel = "Babel errored but TSESTree didn't",
@@ -36,46 +37,67 @@ const fixturesWithErrorDifferences = {
[ErrorLabel.Babel]: new Set(),
} as const;
-const validFixtures = glob.sync(`${SRC_DIR}/**/fixtures/*/*.{ts,tsx}`);
-const errorFixtures = glob.sync(`${SRC_DIR}/**/fixtures/_error_/*/*.{ts,tsx}`);
+const VALID_FIXTURES: readonly string[] = glob.sync(
+ `${SRC_DIR}/**/fixtures/*/fixture.{ts,tsx}`,
+);
+const ERROR_FIXTURES: readonly string[] = glob.sync(
+ `${SRC_DIR}/**/fixtures/_error_/*/fixture.{ts,tsx}`,
+);
-const fixtures: readonly Fixture[] = [...validFixtures, ...errorFixtures].map(
+const FIXTURES: readonly Fixture[] = [...VALID_FIXTURES, ...ERROR_FIXTURES].map(
absolute => {
const relativeToSrc = path.relative(SRC_DIR, absolute);
const { dir, ext } = path.parse(relativeToSrc);
const segments = dir.split(path.sep).filter(s => s !== 'fixtures');
const name = segments.pop()!;
- const snapshotPath = path.join(SRC_DIR, dir, 'snapshots');
+ const fixtureDir = path.join(SRC_DIR, dir);
+ const configPath = path.join(fixtureDir, 'config' /* .ts */);
+ const snapshotPath = path.join(fixtureDir, 'snapshots');
return {
absolute,
- name,
+ config: ((): ASTFixtureConfig => {
+ try {
+ return require(configPath).default;
+ } catch {
+ return {};
+ }
+ })(),
ext,
isError: absolute.includes('/_error_/'),
isJSX: ext.endsWith('x'),
+ name,
relative: path.relative(SRC_DIR, absolute),
segments,
- snapshotPath,
snapshotFiles: {
success: {
tsestree: {
- ast: path.join(snapshotPath, '1-TSESTree-AST.shot'),
- tokens: path.join(snapshotPath, '2-TSESTree-Tokens.shot'),
+ ast: (i: number) =>
+ path.join(snapshotPath, `${i}-TSESTree-AST.shot`),
+ tokens: (i: number) =>
+ path.join(snapshotPath, `${i}-TSESTree-Tokens.shot`),
},
babel: {
- ast: path.join(snapshotPath, '3-Babel-AST.shot'),
- tokens: path.join(snapshotPath, '4-Babel-Tokens.shot'),
+ ast: (i: number) => path.join(snapshotPath, `${i}-Babel-AST.shot`),
+ tokens: (i: number) =>
+ path.join(snapshotPath, `${i}-Babel-Tokens.shot`),
},
alignment: {
- ast: path.join(snapshotPath, '5-AST-Alignment-AST.shot'),
- tokens: path.join(snapshotPath, '6-AST-Alignment-Tokens.shot'),
+ ast: (i: number) =>
+ path.join(snapshotPath, `${i}-AST-Alignment-AST.shot`),
+ tokens: (i: number) =>
+ path.join(snapshotPath, `${i}-AST-Alignment-Tokens.shot`),
},
},
error: {
- tsestree: path.join(snapshotPath, '1-TSESTree-Error.shot'),
- babel: path.join(snapshotPath, '2-Babel-Error.shot'),
- alignment: path.join(snapshotPath, '3-Alignment-Error.shot'),
+ tsestree: (i: number) =>
+ path.join(snapshotPath, `${i}-TSESTree-Error.shot`),
+ babel: (i: number) =>
+ path.join(snapshotPath, `${i}-Babel-Error.shot`),
+ alignment: (i: number) =>
+ path.join(snapshotPath, `${i}-Alignment-Error.shot`),
},
},
+ snapshotPath,
};
},
);
@@ -130,6 +152,8 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void {
errorLabel = ErrorLabel.None;
}
+ let snapshotCounter = 1;
+
if (fixture.isError) {
if (
errorLabel === ErrorLabel.TSESTree ||
@@ -140,17 +164,17 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void {
it('TSESTree - Error', () => {
expect(tsestreeParsed.error).toMatchSpecificSnapshot(
- fixture.snapshotFiles.error.tsestree,
+ fixture.snapshotFiles.error.tsestree(snapshotCounter++),
);
});
it('Babel - Error', () => {
expect(babelParsed.error).toMatchSpecificSnapshot(
- fixture.snapshotFiles.error.babel,
+ fixture.snapshotFiles.error.babel(snapshotCounter++),
);
});
it('Error Alignment', () => {
expect(errorLabel).toMatchSpecificSnapshot(
- fixture.snapshotFiles.error.alignment,
+ fixture.snapshotFiles.error.alignment(snapshotCounter++),
);
});
it('Should parse with errors', () => {
@@ -162,63 +186,80 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void {
it('TSESTree - AST', () => {
expectSuccessResponse(tsestreeParsed);
expect(tsestreeParsed.ast).toMatchSpecificSnapshot(
- fixture.snapshotFiles.success.tsestree.ast,
+ fixture.snapshotFiles.success.tsestree.ast(snapshotCounter++),
);
});
it('TSESTree - Tokens', () => {
expectSuccessResponse(tsestreeParsed);
expect(tsestreeParsed.tokens).toMatchSpecificSnapshot(
- fixture.snapshotFiles.success.tsestree.tokens,
+ fixture.snapshotFiles.success.tsestree.tokens(snapshotCounter++),
);
});
- it('Babel - AST', () => {
- expectSuccessResponse(babelParsed);
- expect(babelParsed.ast).toMatchSpecificSnapshot(
- fixture.snapshotFiles.success.babel.ast,
+ if (fixture.config.expectBabelToNotSupport != null) {
+ fixturesConfiguredToExpectBabelToNotSupport.set(
+ fixture.relative,
+ fixture.config.expectBabelToNotSupport,
);
- });
- it('Babel - Tokens', () => {
- expectSuccessResponse(babelParsed);
- expect(babelParsed.tokens).toMatchSpecificSnapshot(
- fixture.snapshotFiles.success.babel.tokens,
- );
- });
- it('AST Alignment - AST', () => {
- expectSuccessResponse(tsestreeParsed);
- expectSuccessResponse(babelParsed);
- const diffResult = snapshotDiff(
- 'TSESTree',
- tsestreeParsed.ast,
- 'Babel',
- babelParsed.ast,
- );
- expect(diffResult).toMatchSpecificSnapshot(
- fixture.snapshotFiles.success.alignment.ast,
- );
+ // eslint-disable-next-line jest/no-identical-title -- intentional duplication that won't ever happen due to exclusionary conditions
+ it('Babel - Error', () => {
+ expect(babelParsed.error).toMatchSpecificSnapshot(
+ fixture.snapshotFiles.error.babel(snapshotCounter++),
+ );
+ });
+ // eslint-disable-next-line jest/no-disabled-tests -- intentional skip for CLI documentation purposes
+ it.skip('Babel - Skipped as this fixture is configured to expect babel to error', () => {});
+ // eslint-disable-next-line jest/no-disabled-tests -- intentional skip for CLI documentation purposes
+ it.skip('AST Alignment - Skipped as this fixture is configured to expect babel to error', () => {});
+ } else {
+ it('Babel - AST', () => {
+ expectSuccessResponse(babelParsed);
+ expect(babelParsed.ast).toMatchSpecificSnapshot(
+ fixture.snapshotFiles.success.babel.ast(snapshotCounter++),
+ );
+ });
+ it('Babel - Tokens', () => {
+ expectSuccessResponse(babelParsed);
+ expect(babelParsed.tokens).toMatchSpecificSnapshot(
+ fixture.snapshotFiles.success.babel.tokens(snapshotCounter++),
+ );
+ });
+ it('AST Alignment - AST', () => {
+ expectSuccessResponse(tsestreeParsed);
+ expectSuccessResponse(babelParsed);
+ const diffResult = snapshotDiff(
+ 'TSESTree',
+ tsestreeParsed.ast,
+ 'Babel',
+ babelParsed.ast,
+ );
+ expect(diffResult).toMatchSpecificSnapshot(
+ fixture.snapshotFiles.success.alignment.ast(snapshotCounter++),
+ );
- if (diffHasChanges(diffResult)) {
- fixturesWithASTDifferences.add(fixture.relative);
- }
- });
- it('AST Alignment - Token', () => {
- expectSuccessResponse(tsestreeParsed);
- expectSuccessResponse(babelParsed);
- const diffResult = snapshotDiff(
- 'TSESTree',
- tsestreeParsed.tokens,
- 'Babel',
- babelParsed.tokens,
- );
- expect(diffResult).toMatchSpecificSnapshot(
- fixture.snapshotFiles.success.alignment.tokens,
- );
+ if (diffHasChanges(diffResult)) {
+ fixturesWithASTDifferences.add(fixture.relative);
+ }
+ });
+ it('AST Alignment - Token', () => {
+ expectSuccessResponse(tsestreeParsed);
+ expectSuccessResponse(babelParsed);
+ const diffResult = snapshotDiff(
+ 'TSESTree',
+ tsestreeParsed.tokens,
+ 'Babel',
+ babelParsed.tokens,
+ );
+ expect(diffResult).toMatchSpecificSnapshot(
+ fixture.snapshotFiles.success.alignment.tokens(snapshotCounter++),
+ );
- if (diffHasChanges(diffResult)) {
- fixturesWithTokenDifferences.add(fixture.relative);
- }
- });
+ if (diffHasChanges(diffResult)) {
+ fixturesWithTokenDifferences.add(fixture.relative);
+ }
+ });
+ }
it('Should parse with no errors', () => {
// log the error for debug purposes in case there wasn't supposed to be an error
@@ -228,7 +269,9 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void {
case ErrorLabel.Babel:
expectErrorResponse(babelParsed);
- console.error('Babel:\n', babelParsed.error);
+ if (fixture.config.expectBabelToNotSupport == null) {
+ console.error('Babel:\n', babelParsed.error);
+ }
break;
case ErrorLabel.TSESTree:
@@ -244,15 +287,33 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void {
break;
}
+ // NOTE - the comments below exist so that they show up in the stack trace jest shows
+ // when the test fails. Yes, sadly, they're duplicated, but it's necessary to
+ // provide the best and most understandable DevX that we can here.
+ // Jest will print a code frame with the fail line as well as 2 lines before and after
+
+ // if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder
+ // if this fails and you WEREN'T expecting a parser error - then something is broken.
+ expect(errorLabel).not.toBe(ErrorLabel.TSESTree);
+
// if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder
// if this fails and you WEREN'T expecting a parser error - then something is broken.
- expect(errorLabel).toBe(ErrorLabel.None);
+ expect(errorLabel).not.toBe(ErrorLabel.Both);
+
+ if (fixture.config.expectBabelToNotSupport != null) {
+ // if this fails and you WERE expecting a parser error, then Babel parsed without error and you should remove the `expectBabelToNotSupport` config.
+ expect(errorLabel).toBe(ErrorLabel.Babel);
+ } else {
+ // if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder
+ // if this fails and you WEREN'T expecting a parser error - then something is broken.
+ expect(errorLabel).not.toBe(ErrorLabel.Babel);
+ }
});
}
};
if ([...fixture.segments, fixture.name].join(path.sep) === ONLY) {
- // eslint-disable-next-line jest/no-focused-tests
+ // eslint-disable-next-line jest/no-focused-tests -- intentional focused test that only happens during development
describe.only(fixture.name, test);
} else {
describe(fixture.name, test);
@@ -261,7 +322,7 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void {
}
describe('AST Fixtures', () => {
- fixtures.forEach(f => nestDescribe(f));
+ FIXTURES.forEach(f => nestDescribe(f));
// once we've run all the tests, snapshot the list of fixtures that have differences for easy reference
it('List fixtures with AST differences', () => {
@@ -279,4 +340,9 @@ describe('AST Fixtures', () => {
path.resolve(__dirname, 'fixtures-with-differences-errors.shot'),
);
});
+ it('List fixtures we expect babel to not support', () => {
+ expect(fixturesConfiguredToExpectBabelToNotSupport).toMatchSpecificSnapshot(
+ path.resolve(__dirname, 'fixtures-without-babel-support.shot'),
+ );
+ });
});
diff --git a/packages/ast-spec/tests/util/parsers/babel.ts b/packages/ast-spec/tests/util/parsers/babel.ts
index e0d4268bbcce..5e874be85afe 100644
--- a/packages/ast-spec/tests/util/parsers/babel.ts
+++ b/packages/ast-spec/tests/util/parsers/babel.ts
@@ -5,6 +5,7 @@ import type { Fixture, ParserResponse } from './parser-types';
import { ParserResponseType } from './parser-types';
const PLUGINS: ParserPlugin[] = [
+ 'decoratorAutoAccessors',
// TODO - enable classFeatures instead of classProperties when we support it
// 'classFeatures',
'classProperties',
diff --git a/packages/ast-spec/tests/util/parsers/parser-types.ts b/packages/ast-spec/tests/util/parsers/parser-types.ts
index 1278d43a99ef..4538d8ed4a9f 100644
--- a/packages/ast-spec/tests/util/parsers/parser-types.ts
+++ b/packages/ast-spec/tests/util/parsers/parser-types.ts
@@ -1,17 +1,19 @@
+type SnapshotPathFn = (i: number) => string;
+
interface SuccessSnapshotPaths {
- readonly ast: string;
- readonly tokens: string;
+ readonly ast: SnapshotPathFn;
+ readonly tokens: SnapshotPathFn;
}
export interface Fixture {
readonly absolute: string;
- readonly name: string;
+ readonly config: ASTFixtureConfig;
readonly ext: string;
readonly isError: boolean;
readonly isJSX: boolean;
+ readonly name: string;
readonly relative: string;
readonly segments: string[];
- readonly snapshotPath: string;
readonly snapshotFiles: {
readonly success: {
readonly tsestree: SuccessSnapshotPaths;
@@ -19,11 +21,12 @@ export interface Fixture {
readonly alignment: SuccessSnapshotPaths;
};
readonly error: {
- readonly tsestree: string;
- readonly babel: string;
- readonly alignment: string;
+ readonly tsestree: SnapshotPathFn;
+ readonly babel: SnapshotPathFn;
+ readonly alignment: SnapshotPathFn;
};
};
+ readonly snapshotPath: string;
}
export enum ParserResponseType {
diff --git a/packages/ast-spec/tsconfig.json b/packages/ast-spec/tsconfig.json
index fd3827cd5bae..35ae2aa3a17e 100644
--- a/packages/ast-spec/tsconfig.json
+++ b/packages/ast-spec/tsconfig.json
@@ -4,7 +4,14 @@
"composite": false,
"rootDir": "."
},
- "include": ["src", "typings", "tests", "tools", "./rollup.config.ts"],
- "exclude": ["**/fixtures/**"],
+ "include": [
+ "src",
+ "typings",
+ "tests",
+ "tools",
+ "./rollup.config.ts",
+ "**/fixtures/**/config.ts"
+ ],
+ "exclude": ["**/fixtures/**/fixture.ts"],
"references": [{ "path": "../typescript-estree/tsconfig.build.json" }]
}
diff --git a/packages/ast-spec/typings/global.d.ts b/packages/ast-spec/typings/global.d.ts
new file mode 100644
index 000000000000..4464c06fbcf7
--- /dev/null
+++ b/packages/ast-spec/typings/global.d.ts
@@ -0,0 +1,14 @@
+/**
+ * We define this as a global type to make it easier to consume from fixtures.
+ * It saves us having to import the type into `src` files from a test utils folder.
+ * This is a convenient property because it saves us from a lot of `../`!
+ */
+interface ASTFixtureConfig {
+ /**
+ * Specifies that we expect that babel doesn't yet support the code in this fixture, so we expect that it will error.
+ * This should not be used if we expect babel to throw for this feature due to a valid parser error!
+ *
+ * The value should be a description of why there isn't support - for example a github issue URL.
+ */
+ readonly expectBabelToNotSupport?: string;
+}
diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md
index 73d97608e265..9e53fd6f0bcf 100644
--- a/packages/eslint-plugin-internal/CHANGELOG.md
+++ b/packages/eslint-plugin-internal/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal
+
# [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
diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json
index 0b9495a98c38..11206ef2b581 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.44.0",
+ "version": "5.45.0",
"private": true,
"main": "dist/index.js",
"scripts": {
@@ -14,9 +14,9 @@
},
"dependencies": {
"@types/prettier": "*",
- "@typescript-eslint/scope-manager": "5.44.0",
- "@typescript-eslint/type-utils": "5.44.0",
- "@typescript-eslint/utils": "5.44.0",
+ "@typescript-eslint/scope-manager": "5.45.0",
+ "@typescript-eslint/type-utils": "5.45.0",
+ "@typescript-eslint/utils": "5.45.0",
"prettier": "*"
}
}
diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md
index 98f505041045..6ad97388e3c9 100644
--- a/packages/eslint-plugin-tslint/CHANGELOG.md
+++ b/packages/eslint-plugin-tslint/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
+
# [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
diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json
index fbd344b1d473..d44a4b3d98b5 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.44.0",
+ "version": "5.45.0",
"main": "dist/index.js",
"typings": "src/index.ts",
"description": "TSLint wrapper plugin for ESLint",
@@ -38,7 +38,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/utils": "5.44.0",
+ "@typescript-eslint/utils": "5.45.0",
"lodash": "^4.17.21"
},
"peerDependencies": {
@@ -48,6 +48,6 @@
},
"devDependencies": {
"@types/lodash": "*",
- "@typescript-eslint/parser": "5.44.0"
+ "@typescript-eslint/parser": "5.45.0"
}
}
diff --git a/packages/eslint-plugin-tslint/src/rules/config.ts b/packages/eslint-plugin-tslint/src/rules/config.ts
index 9fcfa844da11..97b77e7d0806 100644
--- a/packages/eslint-plugin-tslint/src/rules/config.ts
+++ b/packages/eslint-plugin-tslint/src/rules/config.ts
@@ -98,18 +98,13 @@ export default createRule({
],
},
defaultOptions: [{}],
- create(context) {
+ create(
+ context,
+ [{ rules: tslintRules, rulesDirectory: tslintRulesDirectory, lintFile }],
+ ) {
const fileName = context.getFilename();
const sourceCode = context.getSourceCode().text;
const parserServices = ESLintUtils.getParserServices(context);
-
- /**
- * The TSLint rules configuration passed in by the user
- */
- const [
- { rules: tslintRules, rulesDirectory: tslintRulesDirectory, lintFile },
- ] = context.options;
-
const program = parserServices.program;
/**
diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md
index 5346de33f1c6..5d7959eb27ce 100644
--- a/packages/eslint-plugin/CHANGELOG.md
+++ b/packages/eslint-plugin/CHANGELOG.md
@@ -3,6 +3,19 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+### Bug Fixes
+
+- **eslint-plugin:** [array-type] --fix flag removes parentheses from type ([#5997](https://github.com/typescript-eslint/typescript-eslint/issues/5997)) ([42b33af](https://github.com/typescript-eslint/typescript-eslint/commit/42b33af256e5269feb214c7bb161079f770964fa))
+- **eslint-plugin:** [keyword-spacing] prevent crash on no options ([#6073](https://github.com/typescript-eslint/typescript-eslint/issues/6073)) ([1f19998](https://github.com/typescript-eslint/typescript-eslint/commit/1f19998e3ec6d592fc679a7490708e2e96816f4c))
+- **eslint-plugin:** [member-ordering] support private fields ([#5859](https://github.com/typescript-eslint/typescript-eslint/issues/5859)) ([f02761a](https://github.com/typescript-eslint/typescript-eslint/commit/f02761af19848a84b8d1832bd00fd6c95d38fa0c))
+- **eslint-plugin:** [prefer-readonly] report if a member's property is reassigned ([#6043](https://github.com/typescript-eslint/typescript-eslint/issues/6043)) ([6e079eb](https://github.com/typescript-eslint/typescript-eslint/commit/6e079eb35cfec79ba9965627477117f026d161ac))
+
+### Features
+
+- **eslint-plugin:** [member-ordering] add a required option for required vs. optional member ordering ([#5965](https://github.com/typescript-eslint/typescript-eslint/issues/5965)) ([2abadc6](https://github.com/typescript-eslint/typescript-eslint/commit/2abadc6c26cd6300764157d405a2462b754d050b))
+
# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21)
### Bug Fixes
diff --git a/packages/eslint-plugin/docs/rules/member-ordering.md b/packages/eslint-plugin/docs/rules/member-ordering.md
index 7adde7ba9a63..aaece66adba2 100644
--- a/packages/eslint-plugin/docs/rules/member-ordering.md
+++ b/packages/eslint-plugin/docs/rules/member-ordering.md
@@ -24,6 +24,7 @@ type OrderConfig = MemberType[] | SortedOrderConfig | 'never';
interface SortedOrderConfig {
memberTypes?: MemberType[] | 'never';
+ optionalityOrder?: 'optional-first' | 'required-first';
order:
| 'alphabetically'
| 'alphabetically-case-insensitive'
@@ -44,9 +45,10 @@ You can configure `OrderConfig` options for:
- **`interfaces`**?: override ordering specifically for interfaces
- **`typeLiterals`**?: override ordering specifically for type literals
-The `OrderConfig` settings for each kind of construct may configure sorting on one or both two levels:
+The `OrderConfig` settings for each kind of construct may configure sorting on up to three levels:
- **`memberTypes`**: organizing on member type groups such as methods vs. properties
+- **`optionalityOrder`**: whether to put all optional members first or all required members first
- **`order`**: organizing based on member names, such as alphabetically
### Groups
@@ -54,7 +56,7 @@ The `OrderConfig` settings for each kind of construct may configure sorting on o
You can define many different groups based on different attributes of members.
The supported member attributes are, in order:
-- **Accessibility** (`'public' | 'protected' | 'private'`)
+- **Accessibility** (`'public' | 'protected' | 'private' | '#private'`)
- **Decoration** (`'decorated'`): Whether the member has an explicit accessibility decorator
- **Kind** (`'call-signature' | 'constructor' | 'field' | 'get' | 'method' | 'set' | 'signature'`)
@@ -81,11 +83,13 @@ The default configuration looks as follows:
"default": [
// Index signature
"signature",
+ "call-signature",
// Fields
"public-static-field",
"protected-static-field",
"private-static-field",
+ "#private-static-field",
"public-decorated-field",
"protected-decorated-field",
@@ -94,14 +98,15 @@ The default configuration looks as follows:
"public-instance-field",
"protected-instance-field",
"private-instance-field",
+ "#private-instance-field",
"public-abstract-field",
"protected-abstract-field",
- "private-abstract-field",
"public-field",
"protected-field",
"private-field",
+ "#private-field",
"static-field",
"instance-field",
@@ -125,6 +130,7 @@ The default configuration looks as follows:
"public-static-get",
"protected-static-get",
"private-static-get",
+ "#private-static-get",
"public-decorated-get",
"protected-decorated-get",
@@ -133,14 +139,15 @@ The default configuration looks as follows:
"public-instance-get",
"protected-instance-get",
"private-instance-get",
+ "#private-instance-get",
"public-abstract-get",
"protected-abstract-get",
- "private-abstract-get",
"public-get",
"protected-get",
"private-get",
+ "#private-get",
"static-get",
"instance-get",
@@ -154,6 +161,7 @@ The default configuration looks as follows:
"public-static-set",
"protected-static-set",
"private-static-set",
+ "#private-static-set",
"public-decorated-set",
"protected-decorated-set",
@@ -162,14 +170,15 @@ The default configuration looks as follows:
"public-instance-set",
"protected-instance-set",
"private-instance-set",
+ "#private-instance-set",
"public-abstract-set",
"protected-abstract-set",
- "private-abstract-set",
"public-set",
"protected-set",
"private-set",
+ "#private-set",
"static-set",
"instance-set",
@@ -183,6 +192,7 @@ The default configuration looks as follows:
"public-static-method",
"protected-static-method",
"private-static-method",
+ "#private-static-method",
"public-decorated-method",
"protected-decorated-method",
@@ -191,14 +201,15 @@ The default configuration looks as follows:
"public-instance-method",
"protected-instance-method",
"private-instance-method",
+ "#private-instance-method",
"public-abstract-method",
"protected-abstract-method",
- "private-abstract-method",
"public-method",
"protected-method",
"private-method",
+ "#private-method",
"static-method",
"instance-method",
@@ -902,6 +913,96 @@ interface Foo {
}
```
+#### Sorting Optional Members First or Last
+
+The `optionalityOrder` option may be enabled to place all optional members in a group at the beginning or end of that group.
+
+This config places all optional members before all required members:
+
+```jsonc
+// .eslintrc.json
+{
+ "rules": {
+ "@typescript-eslint/member-ordering": [
+ "error",
+ {
+ "default": {
+ "optionalityOrder": "optional-first",
+ "order": "alphabetically"
+ }
+ }
+ ]
+ }
+}
+```
+
+
+
+##### ❌ Incorrect
+
+```ts
+interface Foo {
+ a: boolean;
+ b?: number;
+ c: string;
+}
+```
+
+##### ✅ Correct
+
+```ts
+interface Foo {
+ b?: number;
+ a: boolean;
+ c: string;
+}
+```
+
+
+
+This config places all required members before all optional members:
+
+```jsonc
+// .eslintrc.json
+{
+ "rules": {
+ "@typescript-eslint/member-ordering": [
+ "error",
+ {
+ "default": {
+ "optionalityOrder": "required-first",
+ "order": "alphabetically"
+ }
+ }
+ ]
+ }
+}
+```
+
+
+
+##### ❌ Incorrect
+
+```ts
+interface Foo {
+ a: boolean;
+ b?: number;
+ c: string;
+}
+```
+
+##### ✅ Correct
+
+```ts
+interface Foo {
+ a: boolean;
+ c: string;
+ b?: number;
+}
+```
+
+
+
## All Supported Options
### Member Types (Granular Form)
@@ -918,15 +1019,32 @@ The most explicit and granular form is the following:
"public-static-field",
"protected-static-field",
"private-static-field",
+ "#private-static-field",
+
"public-decorated-field",
"protected-decorated-field",
"private-decorated-field",
+
"public-instance-field",
"protected-instance-field",
"private-instance-field",
+ "#private-instance-field",
+
"public-abstract-field",
"protected-abstract-field",
- "private-abstract-field",
+
+ "public-field",
+ "protected-field",
+ "private-field",
+ "#private-field",
+
+ "static-field",
+ "instance-field",
+ "abstract-field",
+
+ "decorated-field",
+
+ "field",
// Static initialization
"static-initialization",
@@ -940,6 +1058,7 @@ The most explicit and granular form is the following:
"public-static-get",
"protected-static-get",
"private-static-get",
+ "#private-static-get",
"public-decorated-get",
"protected-decorated-get",
@@ -948,14 +1067,15 @@ The most explicit and granular form is the following:
"public-instance-get",
"protected-instance-get",
"private-instance-get",
+ "#private-instance-get",
"public-abstract-get",
"protected-abstract-get",
- "private-abstract-get",
"public-get",
"protected-get",
"private-get",
+ "#private-get",
"static-get",
"instance-get",
@@ -969,6 +1089,7 @@ The most explicit and granular form is the following:
"public-static-set",
"protected-static-set",
"private-static-set",
+ "#private-static-set",
"public-decorated-set",
"protected-decorated-set",
@@ -977,10 +1098,10 @@ The most explicit and granular form is the following:
"public-instance-set",
"protected-instance-set",
"private-instance-set",
+ "#private-instance-set",
"public-abstract-set",
"protected-abstract-set",
- "private-abstract-set",
"public-set",
"protected-set",
@@ -998,15 +1119,16 @@ The most explicit and granular form is the following:
"public-static-method",
"protected-static-method",
"private-static-method",
+ "#private-static-method",
"public-decorated-method",
"protected-decorated-method",
"private-decorated-method",
"public-instance-method",
"protected-instance-method",
"private-instance-method",
+ "#private-instance-method",
"public-abstract-method",
- "protected-abstract-method",
- "private-abstract-method"
+ "protected-abstract-method"
]
```
diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json
index 4e6dde4cf878..ce7c23c480f3 100644
--- a/packages/eslint-plugin/package.json
+++ b/packages/eslint-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "TypeScript plugin for ESLint",
"keywords": [
"eslint",
@@ -44,9 +44,9 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/scope-manager": "5.44.0",
- "@typescript-eslint/type-utils": "5.44.0",
- "@typescript-eslint/utils": "5.44.0",
+ "@typescript-eslint/scope-manager": "5.45.0",
+ "@typescript-eslint/type-utils": "5.45.0",
+ "@typescript-eslint/utils": "5.45.0",
"debug": "^4.3.4",
"ignore": "^5.2.0",
"natural-compare-lite": "^1.4.0",
diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts
index 92040d8106aa..f353207e7d5d 100644
--- a/packages/eslint-plugin/src/rules/array-type.ts
+++ b/packages/eslint-plugin/src/rules/array-type.ts
@@ -252,8 +252,7 @@ export default util.createRule({
}
const type = typeParams[0];
- const typeParens =
- !util.isParenthesized(type, sourceCode) && typeNeedsParentheses(type);
+ const typeParens = typeNeedsParentheses(type);
const parentParens =
readonlyPrefix &&
node.parent?.type === AST_NODE_TYPES.TSArrayType &&
diff --git a/packages/eslint-plugin/src/rules/brace-style.ts b/packages/eslint-plugin/src/rules/brace-style.ts
index c4b052beaddb..43d4ba63c3cf 100644
--- a/packages/eslint-plugin/src/rules/brace-style.ts
+++ b/packages/eslint-plugin/src/rules/brace-style.ts
@@ -29,6 +29,7 @@ export default createRule({
defaultOptions: ['1tbs'],
create(context) {
const [style, { allowSingleLine } = { allowSingleLine: false }] =
+ // eslint-disable-next-line no-restricted-syntax -- Use raw options for extended rules.
context.options;
const isAllmanStyle = style === 'allman';
diff --git a/packages/eslint-plugin/src/rules/keyword-spacing.ts b/packages/eslint-plugin/src/rules/keyword-spacing.ts
index 6af42e5c2fb7..32fb2aaeb717 100644
--- a/packages/eslint-plugin/src/rules/keyword-spacing.ts
+++ b/packages/eslint-plugin/src/rules/keyword-spacing.ts
@@ -25,7 +25,7 @@ export default util.createRule({
},
defaultOptions: [{}],
- create(context) {
+ create(context, [{ after }]) {
const sourceCode = context.getSourceCode();
const baseRules = baseRule.create(context);
return {
@@ -58,7 +58,7 @@ export default util.createRule({
const punctuatorToken = sourceCode.getTokenAfter(typeToken)!;
const spacesBetweenTypeAndPunctuator =
punctuatorToken.range[0] - typeToken.range[1];
- if (context.options[0].after && spacesBetweenTypeAndPunctuator === 0) {
+ if (after && spacesBetweenTypeAndPunctuator === 0) {
context.report({
loc: punctuatorToken.loc,
messageId: 'expectedBefore',
@@ -68,7 +68,7 @@ export default util.createRule({
},
});
}
- if (!context.options[0].after && spacesBetweenTypeAndPunctuator > 0) {
+ if (!after && spacesBetweenTypeAndPunctuator > 0) {
context.report({
loc: punctuatorToken.loc,
messageId: 'unexpectedBefore',
diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts
index 3892c989bc9a..87022f16f4fd 100644
--- a/packages/eslint-plugin/src/rules/member-ordering.ts
+++ b/packages/eslint-plugin/src/rules/member-ordering.ts
@@ -4,7 +4,10 @@ import naturalCompare from 'natural-compare-lite';
import * as util from '../util';
-export type MessageIds = 'incorrectGroupOrder' | 'incorrectOrder';
+export type MessageIds =
+ | 'incorrectGroupOrder'
+ | 'incorrectOrder'
+ | 'incorrectRequiredMembersOrder';
type MemberKind =
| 'call-signature'
@@ -22,15 +25,17 @@ type NonCallableMemberKind = Exclude;
type MemberScope = 'static' | 'instance' | 'abstract';
+type Accessibility = TSESTree.Accessibility | '#private';
+
type BaseMemberType =
| MemberKind
- | `${TSESTree.Accessibility}-${Exclude<
+ | `${Accessibility}-${Exclude<
MemberKind,
'signature' | 'static-initialization'
>}`
- | `${TSESTree.Accessibility}-decorated-${DecoratedMemberKind}`
+ | `${Accessibility}-decorated-${DecoratedMemberKind}`
| `decorated-${DecoratedMemberKind}`
- | `${TSESTree.Accessibility}-${MemberScope}-${NonCallableMemberKind}`
+ | `${Accessibility}-${MemberScope}-${NonCallableMemberKind}`
| `${MemberScope}-${NonCallableMemberKind}`;
type MemberType = BaseMemberType | BaseMemberType[];
@@ -45,12 +50,15 @@ type Order = AlphabeticalOrder | 'as-written';
interface SortedOrderConfig {
memberTypes?: MemberType[] | 'never';
+ optionalityOrder?: OptionalityOrder;
order: Order;
}
type OrderConfig = MemberType[] | SortedOrderConfig | 'never';
type Member = TSESTree.ClassElement | TSESTree.TypeElement;
+type OptionalityOrder = 'optional-first' | 'required-first';
+
export type Options = [
{
default?: OrderConfig;
@@ -99,6 +107,10 @@ const objectConfig = (memberTypes: MemberType[]): JSONSchema.JSONSchema4 => ({
'natural-case-insensitive',
],
},
+ optionalityOrder: {
+ type: 'string',
+ enum: ['optional-first', 'required-first'],
+ },
},
additionalProperties: false,
});
@@ -112,6 +124,7 @@ export const defaultOrder: MemberType[] = [
'public-static-field',
'protected-static-field',
'private-static-field',
+ '#private-static-field',
'public-decorated-field',
'protected-decorated-field',
@@ -120,14 +133,15 @@ export const defaultOrder: MemberType[] = [
'public-instance-field',
'protected-instance-field',
'private-instance-field',
+ '#private-instance-field',
'public-abstract-field',
'protected-abstract-field',
- 'private-abstract-field',
'public-field',
'protected-field',
'private-field',
+ '#private-field',
'static-field',
'instance-field',
@@ -151,6 +165,7 @@ export const defaultOrder: MemberType[] = [
'public-static-get',
'protected-static-get',
'private-static-get',
+ '#private-static-get',
'public-decorated-get',
'protected-decorated-get',
@@ -159,14 +174,15 @@ export const defaultOrder: MemberType[] = [
'public-instance-get',
'protected-instance-get',
'private-instance-get',
+ '#private-instance-get',
'public-abstract-get',
'protected-abstract-get',
- 'private-abstract-get',
'public-get',
'protected-get',
'private-get',
+ '#private-get',
'static-get',
'instance-get',
@@ -180,6 +196,7 @@ export const defaultOrder: MemberType[] = [
'public-static-set',
'protected-static-set',
'private-static-set',
+ '#private-static-set',
'public-decorated-set',
'protected-decorated-set',
@@ -188,14 +205,15 @@ export const defaultOrder: MemberType[] = [
'public-instance-set',
'protected-instance-set',
'private-instance-set',
+ '#private-instance-set',
'public-abstract-set',
'protected-abstract-set',
- 'private-abstract-set',
'public-set',
'protected-set',
'private-set',
+ '#private-set',
'static-set',
'instance-set',
@@ -209,6 +227,7 @@ export const defaultOrder: MemberType[] = [
'public-static-method',
'protected-static-method',
'private-static-method',
+ '#private-static-method',
'public-decorated-method',
'protected-decorated-method',
@@ -217,14 +236,15 @@ export const defaultOrder: MemberType[] = [
'public-instance-method',
'protected-instance-method',
'private-instance-method',
+ '#private-instance-method',
'public-abstract-method',
'protected-abstract-method',
- 'private-abstract-method',
'public-method',
'protected-method',
'private-method',
+ '#private-method',
'static-method',
'instance-method',
@@ -250,30 +270,49 @@ const allMemberTypes = Array.from(
).reduce>((all, type) => {
all.add(type);
- (['public', 'protected', 'private'] as const).forEach(accessibility => {
- if (type !== 'signature' && type !== 'static-initialization') {
- all.add(`${accessibility}-${type}`); // e.g. `public-field`
- }
+ (['public', 'protected', 'private', '#private'] as const).forEach(
+ accessibility => {
+ if (
+ type !== 'signature' &&
+ type !== 'static-initialization' &&
+ type !== 'call-signature' &&
+ !(type === 'constructor' && accessibility === '#private')
+ ) {
+ all.add(`${accessibility}-${type}`); // e.g. `public-field`
+ }
- // Only class instance fields, methods, get and set can have decorators attached to them
- if (
- type === 'field' ||
- type === 'method' ||
- type === 'get' ||
- type === 'set'
- ) {
- all.add(`${accessibility}-decorated-${type}`);
- all.add(`decorated-${type}`);
- }
+ // Only class instance fields, methods, get and set can have decorators attached to them
+ if (
+ accessibility !== '#private' &&
+ (type === 'field' ||
+ type === 'method' ||
+ type === 'get' ||
+ type === 'set')
+ ) {
+ all.add(`${accessibility}-decorated-${type}`);
+ all.add(`decorated-${type}`);
+ }
- if (type !== 'constructor' && type !== 'signature') {
- // There is no `static-constructor` or `instance-constructor` or `abstract-constructor`
- (['static', 'instance', 'abstract'] as const).forEach(scope => {
- all.add(`${scope}-${type}`);
- all.add(`${accessibility}-${scope}-${type}`);
- });
- }
- });
+ if (
+ type !== 'constructor' &&
+ type !== 'signature' &&
+ type !== 'call-signature'
+ ) {
+ // There is no `static-constructor` or `instance-constructor` or `abstract-constructor`
+ if (accessibility === '#private' || accessibility === 'private') {
+ (['static', 'instance'] as const).forEach(scope => {
+ all.add(`${scope}-${type}`);
+ all.add(`${accessibility}-${scope}-${type}`);
+ });
+ } else {
+ (['static', 'instance', 'abstract'] as const).forEach(scope => {
+ all.add(`${scope}-${type}`);
+ all.add(`${accessibility}-${scope}-${type}`);
+ });
+ }
+ }
+ },
+ );
return all;
}, new Set()),
@@ -376,6 +415,26 @@ function getMemberName(
}
}
+/**
+ * Returns true if the member is optional based on the member type.
+ *
+ * @param node the node to be evaluated.
+ *
+ * @returns Whether the member is optional, or false if it cannot be optional at all.
+ */
+function isMemberOptional(node: Member): boolean {
+ switch (node.type) {
+ case AST_NODE_TYPES.TSPropertySignature:
+ case AST_NODE_TYPES.TSMethodSignature:
+ case AST_NODE_TYPES.TSAbstractPropertyDefinition:
+ case AST_NODE_TYPES.PropertyDefinition:
+ case AST_NODE_TYPES.TSAbstractMethodDefinition:
+ case AST_NODE_TYPES.MethodDefinition:
+ return !!node.optional;
+ }
+ return false;
+}
+
/**
* Gets the calculated rank using the provided method definition.
* The algorithm is as follows:
@@ -407,6 +466,16 @@ function getRankOrder(
return rank;
}
+function getAccessibility(node: Member): Accessibility {
+ if ('accessibility' in node && node.accessibility) {
+ return node.accessibility;
+ }
+ if ('key' in node && node.key?.type === AST_NODE_TYPES.PrivateIdentifier) {
+ return '#private';
+ }
+ return 'public';
+}
+
/**
* Gets the rank of the node given the order.
* @param node the node to be evaluated.
@@ -435,10 +504,7 @@ function getRank(
: abstract
? 'abstract'
: 'instance';
- const accessibility =
- 'accessibility' in node && node.accessibility
- ? node.accessibility
- : 'public';
+ const accessibility = getAccessibility(node);
// Collect all existing member groups that apply to this node...
// (e.g. 'public-instance-field', 'instance-field', 'public-field', 'constructor' etc.)
@@ -525,6 +591,7 @@ export default util.createRule({
'Member {{member}} should be declared before member {{beforeMember}}.',
incorrectGroupOrder:
'Member {{name}} should be declared before all {{rank}} definitions.',
+ incorrectRequiredMembersOrder: `Member {{member}} should be declared after all {{optionalOrRequired}} members.`,
},
schema: [
{
@@ -689,6 +756,59 @@ export default util.createRule({
}
}
+ /**
+ * Checks if the order of optional and required members is correct based
+ * on the given 'required' parameter.
+ *
+ * @param members Members to be validated.
+ * @param optionalityOrder Where to place optional members, if not intermixed.
+ *
+ * @return True if all required and optional members are correctly sorted.
+ */
+ function checkRequiredOrder(
+ members: Member[],
+ optionalityOrder: OptionalityOrder | undefined,
+ ): boolean {
+ const switchIndex = members.findIndex(
+ (member, i) =>
+ i && isMemberOptional(member) !== isMemberOptional(members[i - 1]),
+ );
+
+ const report = (member: Member): void =>
+ context.report({
+ messageId: 'incorrectRequiredMembersOrder',
+ loc: member.loc,
+ data: {
+ member: getMemberName(member, context.getSourceCode()),
+ optionalOrRequired:
+ optionalityOrder === 'optional-first' ? 'required' : 'optional',
+ },
+ });
+
+ // if the optionality of the first item is correct (based on optionalityOrder)
+ // then the first 0 inclusive to switchIndex exclusive members all
+ // have the correct optionality
+ if (
+ isMemberOptional(members[0]) !==
+ (optionalityOrder === 'required-first')
+ ) {
+ report(members[0]);
+ return false;
+ }
+
+ for (let i = switchIndex + 1; i < members.length; i++) {
+ if (
+ isMemberOptional(members[i]) !==
+ isMemberOptional(members[switchIndex])
+ ) {
+ report(members[switchIndex]);
+ return false;
+ }
+ }
+
+ return true;
+ }
+
/**
* Validates if all members are correctly sorted.
*
@@ -707,33 +827,62 @@ export default util.createRule({
// Standardize config
let order: Order | undefined;
- let memberTypes;
+ let memberTypes: string | MemberType[] | undefined;
+ let optionalityOrder: OptionalityOrder | undefined;
+
+ // returns true if everything is good and false if an error was reported
+ const checkOrder = (memberSet: Member[]): boolean => {
+ const hasAlphaSort = !!(order && order !== 'as-written');
+
+ // Check order
+ if (Array.isArray(memberTypes)) {
+ const grouped = checkGroupSort(
+ memberSet,
+ memberTypes,
+ supportsModifiers,
+ );
+
+ if (grouped === null) {
+ return false;
+ }
+
+ if (hasAlphaSort) {
+ return !grouped.some(
+ groupMember =>
+ !checkAlphaSort(groupMember, order as AlphabeticalOrder),
+ );
+ }
+ } else if (hasAlphaSort) {
+ return checkAlphaSort(memberSet, order as AlphabeticalOrder);
+ }
+
+ return true;
+ };
if (Array.isArray(orderConfig)) {
memberTypes = orderConfig;
} else {
order = orderConfig.order;
memberTypes = orderConfig.memberTypes;
+ optionalityOrder = orderConfig.optionalityOrder;
}
- const hasAlphaSort = !!(order && order !== 'as-written');
+ if (!optionalityOrder) {
+ checkOrder(members);
+ return;
+ }
- // Check order
- if (Array.isArray(memberTypes)) {
- const grouped = checkGroupSort(members, memberTypes, supportsModifiers);
+ const switchIndex = members.findIndex(
+ (member, i) =>
+ i && isMemberOptional(member) !== isMemberOptional(members[i - 1]),
+ );
- if (grouped === null) {
+ if (switchIndex !== -1) {
+ if (!checkRequiredOrder(members, optionalityOrder)) {
return;
}
-
- if (hasAlphaSort) {
- grouped.some(
- groupMember =>
- !checkAlphaSort(groupMember, order as AlphabeticalOrder),
- );
- }
- } else if (hasAlphaSort) {
- checkAlphaSort(members, order as AlphabeticalOrder);
+ checkOrder(members.slice(0, switchIndex));
+ checkOrder(members.slice(switchIndex));
}
}
diff --git a/packages/eslint-plugin/src/rules/no-unused-vars.ts b/packages/eslint-plugin/src/rules/no-unused-vars.ts
index 5fcde1986676..77da885048d7 100644
--- a/packages/eslint-plugin/src/rules/no-unused-vars.ts
+++ b/packages/eslint-plugin/src/rules/no-unused-vars.ts
@@ -84,7 +84,7 @@ export default util.createRule({
},
},
defaultOptions: [{}],
- create(context) {
+ create(context, [firstOption]) {
const filename = context.getFilename();
const sourceCode = context.getSourceCode();
const MODULE_DECL_CACHE = new Map();
@@ -97,8 +97,6 @@ export default util.createRule({
caughtErrors: 'none',
};
- const [firstOption] = context.options;
-
if (firstOption) {
if (typeof firstOption === 'string') {
options.vars = firstOption;
diff --git a/packages/eslint-plugin/src/rules/object-curly-spacing.ts b/packages/eslint-plugin/src/rules/object-curly-spacing.ts
index 5c188bb2c07b..1c1c737c8425 100644
--- a/packages/eslint-plugin/src/rules/object-curly-spacing.ts
+++ b/packages/eslint-plugin/src/rules/object-curly-spacing.ts
@@ -31,6 +31,7 @@ export default createRule({
},
defaultOptions: ['never'],
create(context) {
+ // eslint-disable-next-line no-restricted-syntax -- Use raw options for extended rules.
const [firstOption, secondOption] = context.options;
const spaced = firstOption === 'always';
const sourceCode = context.getSourceCode();
diff --git a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts
index a3c354ea737b..f9b97096afc8 100644
--- a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts
+++ b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts
@@ -634,6 +634,7 @@ export default util.createRule({
defaultOptions: [],
create(context) {
const sourceCode = context.getSourceCode();
+ // eslint-disable-next-line no-restricted-syntax -- We need all raw options.
const configureList = context.options || [];
type Scope = null | {
diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts
index 3a1cd3f42f62..3a9e6cdca660 100644
--- a/packages/eslint-plugin/src/rules/prefer-readonly.ts
+++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts
@@ -119,7 +119,10 @@ export default util.createRule({
ts.isArrayLiteralExpression(parent.parent))
) {
current = parent;
- } else if (ts.isBinaryExpression(parent)) {
+ } else if (
+ ts.isBinaryExpression(parent) &&
+ !ts.isPropertyAccessExpression(current)
+ ) {
return (
parent.left === current &&
parent.operatorToken.kind === ts.SyntaxKind.EqualsToken
diff --git a/packages/eslint-plugin/src/rules/space-before-blocks.ts b/packages/eslint-plugin/src/rules/space-before-blocks.ts
index 569be350cd74..5f16929aa52e 100644
--- a/packages/eslint-plugin/src/rules/space-before-blocks.ts
+++ b/packages/eslint-plugin/src/rules/space-before-blocks.ts
@@ -29,9 +29,8 @@ export default util.createRule({
},
},
defaultOptions: ['always'],
- create(context) {
+ create(context, [config]) {
const rules = baseRule.create(context);
- const config = context.options[0];
const sourceCode = context.getSourceCode();
let requireSpace = true;
diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts
index 2bdc8ee0f591..351c94a6361f 100644
--- a/packages/eslint-plugin/src/util/misc.ts
+++ b/packages/eslint-plugin/src/util/misc.ts
@@ -180,6 +180,29 @@ function formatWordList(words: string[]): string {
return [words.slice(0, -1).join(', '), words.slice(-1)[0]].join(' and ');
}
+/**
+ * Iterates the array in reverse and returns the index of the first element it
+ * finds which passes the predicate function.
+ *
+ * @returns Returns the index of the element if it finds it or -1 otherwise.
+ */
+function findLastIndex(
+ members: T[],
+ predicate: (member: T) => boolean | undefined | null,
+): number {
+ let idx = members.length - 1;
+
+ while (idx >= 0) {
+ const valid = predicate(members[idx]);
+ if (valid) {
+ return idx;
+ }
+ idx--;
+ }
+
+ return -1;
+}
+
export {
arrayGroupByToMap,
arraysAreEqual,
@@ -194,4 +217,5 @@ export {
MemberNameType,
RequireKeys,
upperCaseFirst,
+ findLastIndex,
};
diff --git a/packages/eslint-plugin/tests/rules/array-type.test.ts b/packages/eslint-plugin/tests/rules/array-type.test.ts
index c32da51cc08a..04ab47d0b8a0 100644
--- a/packages/eslint-plugin/tests/rules/array-type.test.ts
+++ b/packages/eslint-plugin/tests/rules/array-type.test.ts
@@ -1982,6 +1982,61 @@ class Foo extends Bar implements Baz {
}
`,
);
+ testOutput(
+ 'array',
+ `
+interface WorkingArray {
+ outerProperty: Array<
+ { innerPropertyOne: string } & { innerPropertyTwo: string }
+ >;
+}
+
+interface BrokenArray {
+ outerProperty: Array<
+ ({ innerPropertyOne: string } & { innerPropertyTwo: string })
+ >;
+}
+ `,
+ `
+interface WorkingArray {
+ outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[];
+}
+
+interface BrokenArray {
+ outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[];
+}
+ `,
+ );
+ testOutput(
+ 'array',
+ `
+type WorkingArray = {
+ outerProperty: Array<
+ { innerPropertyOne: string } & { innerPropertyTwo: string }
+ >;
+}
+
+type BrokenArray = {
+ outerProperty: Array<
+ ({ innerPropertyOne: string } & { innerPropertyTwo: string })
+ >;
+}
+ `,
+ `
+type WorkingArray = {
+ outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[];
+}
+
+type BrokenArray = {
+ outerProperty: ({ innerPropertyOne: string } & { innerPropertyTwo: string })[];
+}
+ `,
+ );
+ testOutput(
+ 'array',
+ 'const a: Array<(string|number)>;',
+ 'const a: (string|number)[];',
+ );
testOutput(
'array-simple',
'let xx: Array> = [[1, 2], [3]];',
diff --git a/packages/eslint-plugin/tests/rules/member-ordering.test.ts b/packages/eslint-plugin/tests/rules/member-ordering.test.ts
index cfff36914760..3305bebfa8cd 100644
--- a/packages/eslint-plugin/tests/rules/member-ordering.test.ts
+++ b/packages/eslint-plugin/tests/rules/member-ordering.test.ts
@@ -425,16 +425,20 @@ class Foo {
public static A: string;
protected static B: string = '';
private static C: string = '';
+ static #C: string = '';
public D: string = '';
protected E: string = '';
private F: string = '';
+ #F: string = '';
constructor() {}
public static G() {}
protected static H() {}
private static I() {}
+ static #I() {}
public J() {}
protected K() {}
private L() {}
+ #L() {}
}
`,
{
@@ -444,16 +448,20 @@ class Foo {
public static A: string;
protected static B: string = '';
private static C: string = '';
+ static #C: string = '';
public D: string = '';
protected E: string = '';
private F: string = '';
+ #F: string = '';
constructor() {}
public static G() {}
protected static H() {}
private static I() {}
+ static #I() {}
public J() {}
protected K() {}
private L() {}
+ #L() {}
}
`,
options: [{ default: 'never' }],
@@ -465,16 +473,20 @@ class Foo {
public static A: string;
protected static B: string = '';
private static C: string = '';
+ static #C: string = '';
public D: string = '';
protected E: string = '';
private F: string = '';
+ #F: string = '';
constructor() {}
public static G() {}
protected static H() {}
private static I() {}
+ static #I() {}
public J() {}
protected K() {}
private L() {}
+ #L() {}
}
`,
options: [{ default: ['signature', 'field', 'constructor', 'method'] }],
@@ -487,15 +499,19 @@ class Foo {
public static A: string;
protected static B: string = '';
private static C: string = '';
+ static #C: string = '';
public D: string = '';
protected E: string = '';
private F: string = '';
+ #F: string = '';
public static G() {}
protected static H() {}
private static I() {}
+ static #I() {}
public J() {}
protected K() {}
private L() {}
+ #L() {}
}
`,
options: [{ default: ['field', 'method'] }],
@@ -527,16 +543,20 @@ class Foo {
public static G() {}
protected static H() {}
private static I() {}
+ static #I() {}
public J() {}
protected K() {}
private L() {}
+ #L() {}
[Z: string]: any;
public static A: string;
protected static B: string = '';
private static C: string = '';
+ static #C: string = '';
public D: string = '';
protected E: string = '';
private F: string = '';
+ #F: string = '';
constructor() {}
}
`,
@@ -619,6 +639,8 @@ class Foo {
public static A: string;
private static C: string = '';
private F: string = '';
+ static #M: string = '';
+ #N: string = '';
protected static B: string = '';
protected E: string = '';
}
@@ -631,6 +653,7 @@ class Foo {
'constructor',
'public-field',
'private-field',
+ '#private-field',
'protected-field',
],
},
@@ -653,6 +676,7 @@ class Foo {
protected E: string = '';
private static C: string = '';
private F: string = '';
+ #M: string = '';
}
`,
options: [
@@ -667,6 +691,7 @@ class Foo {
'public-field',
'protected-field',
'private-field',
+ '#private-field',
],
},
],
@@ -681,12 +706,16 @@ class Foo {
constructor() {}
protected K() {}
private L() {}
+ #P() {}
protected static H() {}
private static I() {}
+ static #O() {}
protected static B: string = '';
private static C: string = '';
+ static #N: string = '';
protected E: string = '';
private F: string = '';
+ #M: string = '';
[Z: string]: any;
}
`,
@@ -710,15 +739,19 @@ class Foo {
public static G() {}
protected static H() {}
private static I() {}
+ static #I() {}
protected K() {}
private L() {}
+ #L() {}
constructor() {}
[Z: string]: any;
public static A: string;
private F: string = '';
+ #F: string = '';
protected static B: string = '';
public D: string = '';
private static C: string = '';
+ static #C: string = '';
protected E: string = '';
}
`,
@@ -727,9 +760,10 @@ class Foo {
classes: [
'public-method',
'protected-static-method',
- 'private-static-method',
+ '#private-static-method',
'protected-instance-method',
'private-instance-method',
+ '#private-instance-method',
'constructor',
'signature',
'field',
@@ -764,6 +798,31 @@ class Foo {
},
{
code: `
+class Foo {
+ private L() {}
+ private static I() {}
+ static #H() {}
+ static #B: string = '';
+ public static G() {}
+ public J() {}
+ #K() {}
+ private static C: string = '';
+ private F: string = '';
+ #E: string = '';
+ public static A: string;
+ public D: string = '';
+ constructor() {}
+ [Z: string]: any;
+}
+ `,
+ options: [
+ {
+ classes: ['private-instance-method', 'protected-static-field'],
+ },
+ ],
+ },
+ {
+ code: `
class Foo {
private L() {}
private static I() {}
@@ -1535,6 +1594,60 @@ class Foo {
},
],
},
+ {
+ name: 'with private identifier',
+ code: `
+// no accessibility === public
+class Foo {
+ imPublic() {}
+ #imPrivate() {}
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: ['public-method', '#private-method'],
+ order: 'alphabetically-case-insensitive',
+ },
+ },
+ ],
+ },
+ {
+ name: 'private and #private member order',
+ code: `
+// no accessibility === public
+class Foo {
+ private imPrivate() {}
+ #imPrivate() {}
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: ['private-method', '#private-method'],
+ order: 'alphabetically-case-insensitive',
+ },
+ },
+ ],
+ },
+ {
+ name: '#private and private member order',
+ code: `
+// no accessibility === public
+class Foo {
+ #imPrivate() {}
+ private imPrivate() {}
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: ['#private-method', 'private-method'],
+ order: 'alphabetically-case-insensitive',
+ },
+ },
+ ],
+ },
],
invalid: [
{
@@ -2356,16 +2469,20 @@ class Foo {
public static A: string = '';
protected static B: string = '';
private static C: string = '';
+ static #C: string = '';
public D: string = '';
protected E: string = '';
private F: string = '';
+ #F: string = '';
constructor() {}
public J() {}
protected K() {}
private L() {}
+ #L() {}
public static G() {}
protected static H() {}
private static I() {}
+ static #I() {}
}
`,
errors: [
@@ -2375,7 +2492,7 @@ class Foo {
name: 'G',
rank: 'public instance method',
},
- line: 14,
+ line: 17,
column: 3,
},
{
@@ -2384,7 +2501,7 @@ class Foo {
name: 'H',
rank: 'public instance method',
},
- line: 15,
+ line: 18,
column: 3,
},
{
@@ -2393,7 +2510,16 @@ class Foo {
name: 'I',
rank: 'public instance method',
},
- line: 16,
+ line: 19,
+ column: 3,
+ },
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'I',
+ rank: 'public instance method',
+ },
+ line: 20,
column: 3,
},
],
@@ -2405,15 +2531,19 @@ class Foo {
public static A: string = '';
protected static B: string = '';
private static C: string = '';
+ static #C: string = '';
public D: string = '';
protected E: string = '';
private F: string = '';
+ #F: string = '';
public J() {}
protected K() {}
private L() {}
+ #L() {}
public static G() {}
protected static H() {}
private static I() {}
+ static #I() {}
[Z: string]: any;
}
`,
@@ -2449,7 +2579,7 @@ class Foo {
{
messageId: 'incorrectGroupOrder',
data: {
- name: 'D',
+ name: 'C',
rank: 'constructor',
},
line: 7,
@@ -2458,7 +2588,7 @@ class Foo {
{
messageId: 'incorrectGroupOrder',
data: {
- name: 'E',
+ name: 'D',
rank: 'constructor',
},
line: 8,
@@ -2467,12 +2597,30 @@ class Foo {
{
messageId: 'incorrectGroupOrder',
data: {
- name: 'F',
+ name: 'E',
rank: 'constructor',
},
line: 9,
column: 3,
},
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'F',
+ rank: 'constructor',
+ },
+ line: 10,
+ column: 3,
+ },
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'F',
+ rank: 'constructor',
+ },
+ line: 11,
+ column: 3,
+ },
],
},
{
@@ -4175,6 +4323,93 @@ class Foo {
},
],
},
+ {
+ name: 'with private identifier',
+ code: `
+// no accessibility === public
+class Foo {
+ #imPrivate() {}
+ imPublic() {}
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: ['public-method', '#private-method'],
+ order: 'alphabetically-case-insensitive',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'imPublic',
+ rank: '#private method',
+ },
+ line: 5,
+ column: 3,
+ },
+ ],
+ },
+ {
+ name: 'private and #private member order',
+ code: `
+// no accessibility === public
+class Foo {
+ #imPrivate() {}
+ private imPrivate() {}
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: ['private-method', '#private-method'],
+ order: 'alphabetically-case-insensitive',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'imPrivate',
+ rank: '#private method',
+ },
+ line: 5,
+ column: 3,
+ },
+ ],
+ },
+ {
+ name: '#private and private member order',
+ code: `
+// no accessibility === public
+class Foo {
+ private imPrivate() {}
+ #imPrivate() {}
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: ['#private-method', 'private-method'],
+ order: 'alphabetically-case-insensitive',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'imPrivate',
+ rank: 'private method',
+ },
+ line: 5,
+ column: 3,
+ },
+ ],
+ },
],
};
diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts
new file mode 100644
index 000000000000..9c72fc7322a9
--- /dev/null
+++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts
@@ -0,0 +1,458 @@
+import type { TSESLint } from '@typescript-eslint/utils';
+
+import type { MessageIds, Options } from '../../../src/rules/member-ordering';
+import rule from '../../../src/rules/member-ordering';
+import { RuleTester } from '../../RuleTester';
+
+const ruleTester = new RuleTester({
+ parser: '@typescript-eslint/parser',
+});
+
+const grouped: TSESLint.RunTests = {
+ valid: [
+ // optionalityOrder - optional-first
+ {
+ code: `
+interface X {
+ c: string;
+ b?: string;
+ d?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+interface X {
+ b?: string;
+ c?: string;
+ d?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'as-written',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+interface X {
+ b: string;
+ c: string;
+ d: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'as-written',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+class X {
+ c: string;
+ d: string;
+ ['a']?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+class X {
+ c: string;
+ public static d: string;
+ public static ['a']?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+class X {
+ a: string;
+ static {}
+ b: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+class X {
+ a: string;
+ [i: number]: string;
+ b?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+interface X {
+ a: string;
+ [i?: number]: string;
+ b?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+interface X {
+ a: string;
+ (a: number): string;
+ new (i: number): string;
+ b?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ },
+ // optionalityOrder - required-first
+ {
+ code: `
+interface X {
+ b?: string;
+ d?: string;
+ c: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'required-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+interface X {
+ b?: string;
+ c?: string;
+ d?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'as-written',
+ optionalityOrder: 'required-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+interface X {
+ b: string;
+ c: string;
+ d: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'as-written',
+ optionalityOrder: 'required-first',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+class X {
+ ['c']?: string;
+ a: string;
+ b: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'required-first',
+ },
+ },
+ ],
+ },
+ ],
+ // optionalityOrder - optional-first
+ invalid: [
+ {
+ code: `
+interface X {
+ m: string;
+ d?: string;
+ b?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectOrder',
+ line: 5,
+ column: 3,
+ },
+ ],
+ },
+ {
+ code: `
+interface X {
+ a: string;
+ b?: string;
+ c: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: ['call-signature', 'field', 'method'],
+ order: 'as-written',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectRequiredMembersOrder',
+ line: 4,
+ column: 3,
+ data: {
+ member: 'b',
+ optionalOrRequired: 'required',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+class X {
+ a?: string;
+ static {}
+ b?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'as-written',
+ optionalityOrder: 'optional-first',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectRequiredMembersOrder',
+ line: 3,
+ column: 3,
+ data: {
+ member: 'a',
+ optionalOrRequired: 'required',
+ },
+ },
+ ],
+ },
+ // optionalityOrder - required-first
+ {
+ code: `
+interface X {
+ d?: string;
+ b?: string;
+ m: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'alphabetically',
+ optionalityOrder: 'required-first',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectOrder',
+ line: 4,
+ column: 3,
+ },
+ ],
+ },
+ {
+ code: `
+interface X {
+ a?: string;
+ b: string;
+ c?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: ['call-signature', 'field', 'method'],
+ order: 'as-written',
+ optionalityOrder: 'required-first',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectRequiredMembersOrder',
+ line: 4,
+ column: 3,
+ data: {
+ member: 'b',
+ optionalOrRequired: 'optional',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+class Test {
+ a?: string;
+ b?: string;
+ f: string;
+ c?: string;
+ d?: string;
+ g: string;
+ h: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'as-written',
+ optionalityOrder: 'required-first',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectRequiredMembersOrder',
+ line: 5,
+ column: 3,
+ data: {
+ member: 'f',
+ optionalOrRequired: 'optional',
+ },
+ },
+ ],
+ },
+ {
+ code: `
+class Test {
+ a: string;
+ b: string;
+ f?: string;
+ c?: string;
+ d?: string;
+}
+ `,
+ options: [
+ {
+ default: {
+ memberTypes: 'never',
+ order: 'as-written',
+ optionalityOrder: 'required-first',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectRequiredMembersOrder',
+ line: 3,
+ column: 3,
+ data: {
+ member: 'a',
+ optionalOrRequired: 'optional',
+ },
+ },
+ ],
+ },
+ ],
+};
+
+ruleTester.run('member-ordering-required', rule, grouped);
diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts
index 333ffc9b5ff7..10f2e3d1e072 100644
--- a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts
+++ b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts
@@ -339,6 +339,34 @@ class Foo {
}
`,
},
+ {
+ code: `
+ class Test {
+ private testObj = {
+ prop: '',
+ };
+
+ public test(): void {
+ this.testObj = '';
+ }
+ }
+ `,
+ },
+ {
+ code: `
+ class TestObject {
+ public prop: number;
+ }
+
+ class Test {
+ private testObj = new TestObject();
+
+ public test(): void {
+ this.testObj = new TestObject();
+ }
+ }
+ `,
+ },
],
invalid: [
{
@@ -742,5 +770,322 @@ function ClassWithName {}>(Base: TBase) {
},
],
},
+ {
+ code: `
+ class Test {
+ private testObj = {
+ prop: '',
+ };
+
+ public test(): void {
+ this.testObj.prop = '';
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {
+ prop: '',
+ };
+
+ public test(): void {
+ this.testObj.prop = '';
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class TestObject {
+ public prop: number;
+ }
+
+ class Test {
+ private testObj = new TestObject();
+
+ public test(): void {
+ this.testObj.prop = 10;
+ }
+ }
+ `,
+ output: `
+ class TestObject {
+ public prop: number;
+ }
+
+ class Test {
+ private readonly testObj = new TestObject();
+
+ public test(): void {
+ this.testObj.prop = 10;
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 7,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class Test {
+ private testObj = {
+ prop: '',
+ };
+ public test(): void {
+ this.testObj.prop;
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {
+ prop: '',
+ };
+ public test(): void {
+ this.testObj.prop;
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class Test {
+ private testObj = {};
+ public test(): void {
+ this.testObj?.prop;
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {};
+ public test(): void {
+ this.testObj?.prop;
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class Test {
+ private testObj = {};
+ public test(): void {
+ this.testObj!.prop;
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {};
+ public test(): void {
+ this.testObj!.prop;
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class Test {
+ private testObj = {};
+ public test(): void {
+ this.testObj.prop.prop = '';
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {};
+ public test(): void {
+ this.testObj.prop.prop = '';
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class Test {
+ private testObj = {};
+ public test(): void {
+ this.testObj.prop.doesSomething();
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {};
+ public test(): void {
+ this.testObj.prop.doesSomething();
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class Test {
+ private testObj = {};
+ public test(): void {
+ this.testObj?.prop.prop;
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {};
+ public test(): void {
+ this.testObj?.prop.prop;
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class Test {
+ private testObj = {};
+ public test(): void {
+ this.testObj?.prop?.prop;
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {};
+ public test(): void {
+ this.testObj?.prop?.prop;
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class Test {
+ private testObj = {};
+ public test(): void {
+ this.testObj.prop?.prop;
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {};
+ public test(): void {
+ this.testObj.prop?.prop;
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
+ {
+ code: `
+ class Test {
+ private testObj = {};
+ public test(): void {
+ this.testObj!.prop?.prop;
+ }
+ }
+ `,
+ output: `
+ class Test {
+ private readonly testObj = {};
+ public test(): void {
+ this.testObj!.prop?.prop;
+ }
+ }
+ `,
+ errors: [
+ {
+ data: {
+ name: 'testObj',
+ },
+ line: 3,
+ messageId: 'preferReadonly',
+ },
+ ],
+ },
],
});
diff --git a/packages/eslint-plugin/tests/util/misc.test.ts b/packages/eslint-plugin/tests/util/misc.test.ts
index c4291f00d9f4..6eae810eb627 100644
--- a/packages/eslint-plugin/tests/util/misc.test.ts
+++ b/packages/eslint-plugin/tests/util/misc.test.ts
@@ -23,3 +23,17 @@ describe('formatWordList', () => {
);
});
});
+
+describe('findLastIndex', () => {
+ it('returns -1 if there are no elements to iterate over', () => {
+ expect(misc.findLastIndex([], () => true)).toBe(-1);
+ });
+
+ it('returns the index of the last element if predicate just returns true for all values', () => {
+ expect(misc.findLastIndex([1, 2, 3], () => true)).toBe(2);
+ });
+
+ it('returns the index of the last occurance of a duplicate element', () => {
+ expect(misc.findLastIndex([1, 2, 3, 3, 5], n => n === 3)).toBe(3);
+ });
+});
diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md
index 4d40a307fdf4..f441dd8da408 100644
--- a/packages/experimental-utils/CHANGELOG.md
+++ b/packages/experimental-utils/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package @typescript-eslint/experimental-utils
+
# [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
diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json
index 890423ff65c7..37ea291a0344 100644
--- a/packages/experimental-utils/package.json
+++ b/packages/experimental-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/experimental-utils",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "(Experimental) Utilities for working with TypeScript + ESLint together",
"keywords": [
"eslint",
@@ -38,7 +38,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/utils": "5.44.0"
+ "@typescript-eslint/utils": "5.45.0"
},
"peerDependencies": {
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md
index 52366c066773..eba0fcd3c106 100644
--- a/packages/parser/CHANGELOG.md
+++ b/packages/parser/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package @typescript-eslint/parser
+
# [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
diff --git a/packages/parser/package.json b/packages/parser/package.json
index 11e72b179031..2c5846e634b9 100644
--- a/packages/parser/package.json
+++ b/packages/parser/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/parser",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "An ESLint custom parser which leverages TypeScript ESTree",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -45,9 +45,9 @@
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
},
"dependencies": {
- "@typescript-eslint/scope-manager": "5.44.0",
- "@typescript-eslint/types": "5.44.0",
- "@typescript-eslint/typescript-estree": "5.44.0",
+ "@typescript-eslint/scope-manager": "5.45.0",
+ "@typescript-eslint/types": "5.45.0",
+ "@typescript-eslint/typescript-estree": "5.45.0",
"debug": "^4.3.4"
},
"devDependencies": {
diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md
index 6c427dbabce9..7625e49c7f6e 100644
--- a/packages/scope-manager/CHANGELOG.md
+++ b/packages/scope-manager/CHANGELOG.md
@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+### Bug Fixes
+
+- **scope-manager:** add support for TS4.9 satisfies expression ([#6059](https://github.com/typescript-eslint/typescript-eslint/issues/6059)) ([44027db](https://github.com/typescript-eslint/typescript-eslint/commit/44027db379e6e074a16cda2755ef554c2b0a4c5a))
+
+### Features
+
+- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a))
+
# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21)
### Features
diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json
index f58510fe87f5..ab38deddf68c 100644
--- a/packages/scope-manager/package.json
+++ b/packages/scope-manager/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/scope-manager",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "TypeScript scope analyser for ESLint",
"keywords": [
"eslint",
@@ -38,12 +38,12 @@
"typecheck": "nx typecheck"
},
"dependencies": {
- "@typescript-eslint/types": "5.44.0",
- "@typescript-eslint/visitor-keys": "5.44.0"
+ "@typescript-eslint/types": "5.45.0",
+ "@typescript-eslint/visitor-keys": "5.45.0"
},
"devDependencies": {
"@types/glob": "*",
- "@typescript-eslint/typescript-estree": "5.44.0",
+ "@typescript-eslint/typescript-estree": "5.45.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",
diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts
index 3aced282e445..5f84e37404f3 100644
--- a/packages/scope-manager/src/referencer/ClassVisitor.ts
+++ b/packages/scope-manager/src/referencer/ClassVisitor.ts
@@ -83,9 +83,13 @@ class ClassVisitor extends Visitor {
}
protected visitPropertyDefinition(
- node: TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition,
+ node:
+ | TSESTree.AccessorProperty
+ | TSESTree.PropertyDefinition
+ | TSESTree.TSAbstractAccessorProperty
+ | TSESTree.TSAbstractPropertyDefinition,
): void {
- this.visitProperty(node);
+ this.visitPropertyBase(node);
/**
* class A {
* @meta // <--- check this
@@ -229,9 +233,11 @@ class ClassVisitor extends Visitor {
this.#referencer.close(node);
}
- protected visitProperty(
+ protected visitPropertyBase(
node:
+ | TSESTree.AccessorProperty
| TSESTree.PropertyDefinition
+ | TSESTree.TSAbstractAccessorProperty
| TSESTree.TSAbstractPropertyDefinition
| TSESTree.TSAbstractMethodDefinition,
): void {
@@ -240,7 +246,10 @@ class ClassVisitor extends Visitor {
}
if (node.value) {
- if (node.type === AST_NODE_TYPES.PropertyDefinition) {
+ if (
+ node.type === AST_NODE_TYPES.PropertyDefinition ||
+ node.type === AST_NODE_TYPES.AccessorProperty
+ ) {
this.#referencer.scopeManager.nestClassFieldInitializerScope(
node.value,
);
@@ -248,7 +257,10 @@ class ClassVisitor extends Visitor {
this.#referencer.visit(node.value);
- if (node.type === AST_NODE_TYPES.PropertyDefinition) {
+ if (
+ node.type === AST_NODE_TYPES.PropertyDefinition ||
+ node.type === AST_NODE_TYPES.AccessorProperty
+ ) {
this.#referencer.close(node.value);
}
}
@@ -328,6 +340,10 @@ class ClassVisitor extends Visitor {
// Visit selectors //
/////////////////////
+ protected AccessorProperty(node: TSESTree.AccessorProperty): void {
+ this.visitPropertyDefinition(node);
+ }
+
protected ClassBody(node: TSESTree.ClassBody): void {
// this is here on purpose so that this visitor explicitly declares visitors
// for all nodes it cares about (see the instance visit method above)
@@ -342,6 +358,12 @@ class ClassVisitor extends Visitor {
this.visitMethod(node);
}
+ protected TSAbstractAccessorProperty(
+ node: TSESTree.TSAbstractAccessorProperty,
+ ): void {
+ this.visitPropertyDefinition(node);
+ }
+
protected TSAbstractPropertyDefinition(
node: TSESTree.TSAbstractPropertyDefinition,
): void {
@@ -351,7 +373,7 @@ class ClassVisitor extends Visitor {
protected TSAbstractMethodDefinition(
node: TSESTree.TSAbstractMethodDefinition,
): void {
- this.visitProperty(node);
+ this.visitPropertyBase(node);
}
protected Identifier(node: TSESTree.Identifier): void {
diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts
index 93b0270ebfba..e7b41127ba46 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);
@@ -724,6 +727,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/class/declaration/abstract-accessor-property.ts b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts
new file mode 100644
index 000000000000..b84caed0b392
--- /dev/null
+++ b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts
@@ -0,0 +1,5 @@
+type T = 1;
+
+abstract class Foo {
+ abstract prop: T;
+}
diff --git a/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot
new file mode 100644
index 000000000000..c895afba9043
--- /dev/null
+++ b/packages/scope-manager/tests/fixtures/class/declaration/abstract-accessor-property.ts.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`class declaration abstract-accessor-property 1`] = `
+ScopeManager {
+ variables: Array [
+ ImplicitGlobalConstTypeVariable,
+ Variable$2 {
+ defs: Array [
+ TypeDefinition$1 {
+ name: Identifier<"T">,
+ node: TSTypeAliasDeclaration$1,
+ },
+ ],
+ name: "T",
+ references: Array [
+ Reference$1 {
+ identifier: Identifier<"T">,
+ isRead: true,
+ isTypeReference: true,
+ isValueReference: false,
+ isWrite: false,
+ resolved: Variable$2,
+ },
+ ],
+ isValueVariable: false,
+ isTypeVariable: true,
+ },
+ Variable$3 {
+ defs: Array [
+ ClassNameDefinition$2 {
+ name: Identifier<"Foo">,
+ node: ClassDeclaration$2,
+ },
+ ],
+ name: "Foo",
+ references: Array [],
+ isValueVariable: true,
+ isTypeVariable: true,
+ },
+ Variable$4 {
+ defs: Array [
+ ClassNameDefinition$3 {
+ name: Identifier<"Foo">,
+ node: ClassDeclaration$2,
+ },
+ ],
+ name: "Foo",
+ references: Array [],
+ isValueVariable: true,
+ isTypeVariable: true,
+ },
+ ],
+ scopes: Array [
+ GlobalScope$1 {
+ block: Program$3,
+ isStrict: false,
+ references: Array [],
+ set: Map {
+ "const" => ImplicitGlobalConstTypeVariable,
+ "T" => Variable$2,
+ "Foo" => Variable$3,
+ },
+ type: "global",
+ upper: null,
+ variables: Array [
+ ImplicitGlobalConstTypeVariable,
+ Variable$2,
+ Variable$3,
+ ],
+ },
+ ClassScope$2 {
+ block: ClassDeclaration$2,
+ isStrict: true,
+ references: Array [
+ Reference$1,
+ ],
+ set: Map {
+ "Foo" => Variable$4,
+ },
+ type: "class",
+ upper: GlobalScope$1,
+ variables: Array [
+ Variable$4,
+ ],
+ },
+ ],
+}
+`;
diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts
new file mode 100644
index 000000000000..824821d682e7
--- /dev/null
+++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts
@@ -0,0 +1,4 @@
+type T = 1;
+class A {
+ prop: T;
+}
diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot
new file mode 100644
index 000000000000..fb8248edefe5
--- /dev/null
+++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property-type-annotation.ts.shot
@@ -0,0 +1,88 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`class declaration accessor-property-type-annotation 1`] = `
+ScopeManager {
+ variables: Array [
+ ImplicitGlobalConstTypeVariable,
+ Variable$2 {
+ defs: Array [
+ TypeDefinition$1 {
+ name: Identifier<"T">,
+ node: TSTypeAliasDeclaration$1,
+ },
+ ],
+ name: "T",
+ references: Array [
+ Reference$1 {
+ identifier: Identifier<"T">,
+ isRead: true,
+ isTypeReference: true,
+ isValueReference: false,
+ isWrite: false,
+ resolved: Variable$2,
+ },
+ ],
+ isValueVariable: false,
+ isTypeVariable: true,
+ },
+ Variable$3 {
+ defs: Array [
+ ClassNameDefinition$2 {
+ name: Identifier<"A">,
+ node: ClassDeclaration$2,
+ },
+ ],
+ name: "A",
+ references: Array [],
+ isValueVariable: true,
+ isTypeVariable: true,
+ },
+ Variable$4 {
+ defs: Array [
+ ClassNameDefinition$3 {
+ name: Identifier<"A">,
+ node: ClassDeclaration$2,
+ },
+ ],
+ name: "A",
+ references: Array [],
+ isValueVariable: true,
+ isTypeVariable: true,
+ },
+ ],
+ scopes: Array [
+ GlobalScope$1 {
+ block: Program$3,
+ isStrict: false,
+ references: Array [],
+ set: Map {
+ "const" => ImplicitGlobalConstTypeVariable,
+ "T" => Variable$2,
+ "A" => Variable$3,
+ },
+ type: "global",
+ upper: null,
+ variables: Array [
+ ImplicitGlobalConstTypeVariable,
+ Variable$2,
+ Variable$3,
+ ],
+ },
+ ClassScope$2 {
+ block: ClassDeclaration$2,
+ isStrict: true,
+ references: Array [
+ Reference$1,
+ ],
+ set: Map {
+ "A" => Variable$4,
+ },
+ type: "class",
+ upper: GlobalScope$1,
+ variables: Array [
+ Variable$4,
+ ],
+ },
+ ],
+}
+`;
diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts
new file mode 100644
index 000000000000..e75d9def3e96
--- /dev/null
+++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts
@@ -0,0 +1,7 @@
+const x = 1;
+class A {
+ prop1 = 1;
+ prop2 = x;
+}
+
+const unresolved = prop1;
diff --git a/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot
new file mode 100644
index 000000000000..88914131b5c1
--- /dev/null
+++ b/packages/scope-manager/tests/fixtures/class/declaration/accessor-property.ts.shot
@@ -0,0 +1,152 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`class declaration accessor-property 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 [
+ ClassNameDefinition$2 {
+ name: Identifier<"A">,
+ node: ClassDeclaration$3,
+ },
+ ],
+ name: "A",
+ references: Array [],
+ isValueVariable: true,
+ isTypeVariable: true,
+ },
+ Variable$4 {
+ defs: Array [
+ ClassNameDefinition$3 {
+ name: Identifier<"A">,
+ node: ClassDeclaration$3,
+ },
+ ],
+ name: "A",
+ references: Array [],
+ isValueVariable: true,
+ isTypeVariable: true,
+ },
+ Variable$5 {
+ defs: Array [
+ VariableDefinition$4 {
+ name: Identifier<"unresolved">,
+ node: VariableDeclarator$4,
+ },
+ ],
+ name: "unresolved",
+ references: Array [
+ Reference$3 {
+ identifier: Identifier<"unresolved">,
+ init: true,
+ isRead: false,
+ isTypeReference: false,
+ isValueReference: true,
+ isWrite: true,
+ resolved: Variable$5,
+ writeExpr: Identifier<"prop1">,
+ },
+ ],
+ isValueVariable: true,
+ isTypeVariable: false,
+ },
+ ],
+ scopes: Array [
+ GlobalScope$1 {
+ block: Program$5,
+ isStrict: false,
+ references: Array [
+ Reference$1,
+ Reference$3,
+ Reference$4 {
+ identifier: Identifier<"prop1">,
+ isRead: true,
+ isTypeReference: false,
+ isValueReference: true,
+ isWrite: false,
+ resolved: null,
+ },
+ ],
+ set: Map {
+ "const" => ImplicitGlobalConstTypeVariable,
+ "x" => Variable$2,
+ "A" => Variable$3,
+ "unresolved" => Variable$5,
+ },
+ type: "global",
+ upper: null,
+ variables: Array [
+ ImplicitGlobalConstTypeVariable,
+ Variable$2,
+ Variable$3,
+ Variable$5,
+ ],
+ },
+ ClassScope$2 {
+ block: ClassDeclaration$3,
+ isStrict: true,
+ references: Array [],
+ set: Map {
+ "A" => Variable$4,
+ },
+ type: "class",
+ upper: GlobalScope$1,
+ variables: Array [
+ Variable$4,
+ ],
+ },
+ ClassFieldInitializerScope$3 {
+ block: Literal$6,
+ isStrict: true,
+ references: Array [],
+ set: Map {},
+ type: "class-field-initializer",
+ upper: ClassScope$2,
+ variables: Array [],
+ },
+ ClassFieldInitializerScope$4 {
+ block: Identifier<"x">,
+ isStrict: true,
+ references: Array [
+ Reference$2,
+ ],
+ set: Map {},
+ type: "class-field-initializer",
+ upper: ClassScope$2,
+ variables: Array [],
+ },
+ ],
+}
+`;
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 000000000000..69dae24ecf27
--- /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 000000000000..9d6dcc03ce1a
--- /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 b50beb1e1a78..ebb26c9c7238 100644
--- a/packages/shared-fixtures/CHANGELOG.md
+++ b/packages/shared-fixtures/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package @typescript-eslint/shared-fixtures
+
# [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
diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json
index 539146e0b43e..54f9b423115e 100644
--- a/packages/shared-fixtures/package.json
+++ b/packages/shared-fixtures/package.json
@@ -1,5 +1,5 @@
{
"name": "@typescript-eslint/shared-fixtures",
- "version": "5.44.0",
+ "version": "5.45.0",
"private": true
}
diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md
index 974d40d5d777..5d305078ff02 100644
--- a/packages/type-utils/CHANGELOG.md
+++ b/packages/type-utils/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package @typescript-eslint/type-utils
+
# [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
diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json
index be4ef3f95ed0..e48a5edbae3b 100644
--- a/packages/type-utils/package.json
+++ b/packages/type-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/type-utils",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "Type utilities for working with TypeScript + ESLint together",
"keywords": [
"eslint",
@@ -39,13 +39,13 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/typescript-estree": "5.44.0",
- "@typescript-eslint/utils": "5.44.0",
+ "@typescript-eslint/typescript-estree": "5.45.0",
+ "@typescript-eslint/utils": "5.45.0",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
"devDependencies": {
- "@typescript-eslint/parser": "5.44.0",
+ "@typescript-eslint/parser": "5.45.0",
"typescript": "*"
},
"peerDependencies": {
diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md
index e721c00a5ce2..1a3881e1d3b3 100644
--- a/packages/types/CHANGELOG.md
+++ b/packages/types/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package @typescript-eslint/types
+
# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21)
### Features
diff --git a/packages/types/package.json b/packages/types/package.json
index 0cc513232d4e..caf58ad26184 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/types",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "Types for the TypeScript-ESTree AST spec",
"keywords": [
"eslint",
diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md
index f6309d7faeff..acf4c9b023d0 100644
--- a/packages/typescript-estree/CHANGELOG.md
+++ b/packages/typescript-estree/CHANGELOG.md
@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+### Bug Fixes
+
+- **typescript-estree:** stub out `ts.SatisfiesExpression` on old TS versions ([#6076](https://github.com/typescript-eslint/typescript-eslint/issues/6076)) ([1302b30](https://github.com/typescript-eslint/typescript-eslint/commit/1302b30ecad9eb55aa9f1daa5068d9fb72c3688e))
+
+### Features
+
+- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a))
+
# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21)
### Bug Fixes
diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json
index b16ecb687b79..93b61acfe11d 100644
--- a/packages/typescript-estree/package.json
+++ b/packages/typescript-estree/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/typescript-estree",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
"main": "dist/index.js",
"types": "dist/index.d.ts",
@@ -42,8 +42,8 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/types": "5.44.0",
- "@typescript-eslint/visitor-keys": "5.44.0",
+ "@typescript-eslint/types": "5.45.0",
+ "@typescript-eslint/visitor-keys": "5.45.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.44.0",
+ "@typescript-eslint/shared-fixtures": "5.45.0",
"glob": "*",
"jest-specific-snapshot": "*",
"make-dir": "*",
diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts
index ca53cc45a44f..b21a42614dae 100644
--- a/packages/typescript-estree/src/convert.ts
+++ b/packages/typescript-estree/src/convert.ts
@@ -1167,12 +1167,30 @@ export class Converter {
case SyntaxKind.PropertyDeclaration: {
const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node);
+ const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node);
+
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option
+ const type = (() => {
+ if (isAccessor) {
+ if (isAbstract) {
+ return AST_NODE_TYPES.TSAbstractAccessorProperty;
+ }
+ return AST_NODE_TYPES.AccessorProperty;
+ }
+
+ if (isAbstract) {
+ return AST_NODE_TYPES.TSAbstractPropertyDefinition;
+ }
+ return AST_NODE_TYPES.PropertyDefinition;
+ })();
+
const result = this.createNode<
- TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition
+ | TSESTree.TSAbstractAccessorProperty
+ | TSESTree.TSAbstractPropertyDefinition
+ | TSESTree.PropertyDefinition
+ | TSESTree.AccessorProperty
>(node, {
- type: isAbstract
- ? AST_NODE_TYPES.TSAbstractPropertyDefinition
- : AST_NODE_TYPES.PropertyDefinition,
+ type,
key: this.convertChild(node.name),
value: isAbstract ? null : this.convertChild(node.initializer),
computed: isComputedProperty(node.name),
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 12ff9392cb0b..c080a83559ba 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
@@ -4,6 +4,7 @@ import type * as ts from 'typescript';
import type { TSNode } from './ts-nodes';
export interface EstreeToTsNodeTypes {
+ [AST_NODE_TYPES.AccessorProperty]: ts.PropertyDeclaration;
[AST_NODE_TYPES.ArrayExpression]: ts.ArrayLiteralExpression;
[AST_NODE_TYPES.ArrayPattern]:
| ts.ArrayLiteralExpression
@@ -156,6 +157,7 @@ export interface EstreeToTsNodeTypes {
| ts.Identifier;
[AST_NODE_TYPES.ThrowStatement]: ts.ThrowStatement;
[AST_NODE_TYPES.TryStatement]: ts.TryStatement;
+ [AST_NODE_TYPES.TSAbstractAccessorProperty]: ts.PropertyDeclaration;
[AST_NODE_TYPES.TSAbstractPropertyDefinition]: ts.PropertyDeclaration;
[AST_NODE_TYPES.TSAbstractMethodDefinition]:
| ts.GetAccessorDeclaration
diff --git a/packages/typescript-estree/src/ts-estree/ts-nodes.ts b/packages/typescript-estree/src/ts-estree/ts-nodes.ts
index 873f98e5a152..0ba5414e1376 100644
--- a/packages/typescript-estree/src/ts-estree/ts-nodes.ts
+++ b/packages/typescript-estree/src/ts-estree/ts-nodes.ts
@@ -4,12 +4,18 @@ import type * as ts from 'typescript';
// Eg: https://github.com/typescript-eslint/typescript-eslint/issues/2388, https://github.com/typescript-eslint/typescript-eslint/issues/2784
declare module 'typescript' {
/* eslint-disable @typescript-eslint/no-empty-interface */
+ // added in TS 4.0
export interface NamedTupleMember extends ts.Node {}
+ // added in TS 4.1
export interface TemplateLiteralTypeNode extends ts.Node {}
+ // added in TS 4.3
export interface PrivateIdentifier extends ts.Node {}
export interface ClassStaticBlockDeclaration extends ts.Node {}
+ // added in TS 4.5
export interface AssertClause extends ts.Node {}
export interface AssertEntry extends ts.Node {}
+ // added in TS 4.9
+ export interface SatisfiesExpression extends ts.Node {}
/* eslint-enable @typescript-eslint/no-empty-interface */
}
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md
index 0fbb0378b1b3..81eee28e5465 100644
--- a/packages/utils/CHANGELOG.md
+++ b/packages/utils/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package @typescript-eslint/utils
+
# [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
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 8064fe758bd7..80a37b641f62 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/utils",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "Utilities for working with TypeScript + ESLint together",
"keywords": [
"eslint",
@@ -41,9 +41,9 @@
"dependencies": {
"@types/json-schema": "^7.0.9",
"@types/semver": "^7.3.12",
- "@typescript-eslint/scope-manager": "5.44.0",
- "@typescript-eslint/types": "5.44.0",
- "@typescript-eslint/typescript-estree": "5.44.0",
+ "@typescript-eslint/scope-manager": "5.45.0",
+ "@typescript-eslint/types": "5.45.0",
+ "@typescript-eslint/typescript-estree": "5.45.0",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0",
"semver": "^7.3.7"
@@ -52,7 +52,7 @@
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
},
"devDependencies": {
- "@typescript-eslint/parser": "5.44.0",
+ "@typescript-eslint/parser": "5.45.0",
"typescript": "*"
},
"funding": {
diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md
index 65c9d29a574b..e040c42f8090 100644
--- a/packages/visitor-keys/CHANGELOG.md
+++ b/packages/visitor-keys/CHANGELOG.md
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+### Features
+
+- support Auto Accessor syntax ([#5926](https://github.com/typescript-eslint/typescript-eslint/issues/5926)) ([becd1f8](https://github.com/typescript-eslint/typescript-eslint/commit/becd1f8581c0013399dfe71be6c265e96cedb57a))
+
# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21)
### Features
diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json
index 39da7ca66332..a1637e76adb9 100644
--- a/packages/visitor-keys/package.json
+++ b/packages/visitor-keys/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/visitor-keys",
- "version": "5.44.0",
+ "version": "5.45.0",
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
"keywords": [
"eslint",
@@ -39,7 +39,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
- "@typescript-eslint/types": "5.44.0",
+ "@typescript-eslint/types": "5.45.0",
"eslint-visitor-keys": "^3.3.0"
},
"devDependencies": {
diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts
index cb3e614df535..80a8b8c9c782 100644
--- a/packages/visitor-keys/src/visitor-keys.ts
+++ b/packages/visitor-keys/src/visitor-keys.ts
@@ -10,91 +10,197 @@ type GetNodeTypeKeys = Exclude<
'type' | 'loc' | 'range' | 'parent'
>;
+type KeysDefinedInESLintVisitorKeysCore =
+ | AST_NODE_TYPES.AssignmentExpression
+ | AST_NODE_TYPES.AssignmentPattern
+ | AST_NODE_TYPES.ArrayExpression
+ | AST_NODE_TYPES.ArrayPattern
+ | AST_NODE_TYPES.ArrowFunctionExpression
+ | AST_NODE_TYPES.AwaitExpression
+ | AST_NODE_TYPES.BlockStatement
+ | AST_NODE_TYPES.BinaryExpression
+ | AST_NODE_TYPES.BreakStatement
+ | AST_NODE_TYPES.CallExpression
+ | AST_NODE_TYPES.CatchClause
+ | AST_NODE_TYPES.ChainExpression
+ | AST_NODE_TYPES.ClassBody
+ | AST_NODE_TYPES.ClassDeclaration
+ | AST_NODE_TYPES.ClassExpression
+ | AST_NODE_TYPES.ConditionalExpression
+ | AST_NODE_TYPES.ContinueStatement
+ | AST_NODE_TYPES.DebuggerStatement
+ | AST_NODE_TYPES.DoWhileStatement
+ | AST_NODE_TYPES.EmptyStatement
+ | AST_NODE_TYPES.ExportAllDeclaration
+ | AST_NODE_TYPES.ExportDefaultDeclaration
+ | AST_NODE_TYPES.ExportNamedDeclaration
+ | AST_NODE_TYPES.ExportSpecifier
+ | AST_NODE_TYPES.ExpressionStatement
+ // | AST_NODE_TYPES.ExperimentalRestProperty
+ // | AST_NODE_TYPES.ExperimentalSpreadProperty
+ | AST_NODE_TYPES.ForStatement
+ | AST_NODE_TYPES.ForInStatement
+ | AST_NODE_TYPES.ForOfStatement
+ | AST_NODE_TYPES.FunctionDeclaration
+ | AST_NODE_TYPES.FunctionExpression
+ | AST_NODE_TYPES.Identifier
+ | AST_NODE_TYPES.IfStatement
+ | AST_NODE_TYPES.ImportDeclaration
+ | AST_NODE_TYPES.ImportDefaultSpecifier
+ | AST_NODE_TYPES.ImportExpression
+ | AST_NODE_TYPES.ImportNamespaceSpecifier
+ | AST_NODE_TYPES.ImportSpecifier
+ | AST_NODE_TYPES.JSXAttribute
+ | AST_NODE_TYPES.JSXClosingElement
+ | AST_NODE_TYPES.JSXElement
+ | AST_NODE_TYPES.JSXEmptyExpression
+ | AST_NODE_TYPES.JSXExpressionContainer
+ | AST_NODE_TYPES.JSXIdentifier
+ | AST_NODE_TYPES.JSXMemberExpression
+ | AST_NODE_TYPES.JSXNamespacedName
+ | AST_NODE_TYPES.JSXOpeningElement
+ | AST_NODE_TYPES.JSXSpreadAttribute
+ | AST_NODE_TYPES.JSXText
+ | AST_NODE_TYPES.JSXFragment
+ | AST_NODE_TYPES.JSXClosingFragment
+ | AST_NODE_TYPES.JSXOpeningFragment
+ | AST_NODE_TYPES.Literal
+ | AST_NODE_TYPES.LabeledStatement
+ | AST_NODE_TYPES.LogicalExpression
+ | AST_NODE_TYPES.MemberExpression
+ | AST_NODE_TYPES.MetaProperty
+ | AST_NODE_TYPES.MethodDefinition
+ | AST_NODE_TYPES.NewExpression
+ | AST_NODE_TYPES.ObjectExpression
+ | AST_NODE_TYPES.ObjectPattern
+ | AST_NODE_TYPES.PrivateIdentifier
+ | AST_NODE_TYPES.Program
+ | AST_NODE_TYPES.Property
+ | AST_NODE_TYPES.PropertyDefinition
+ | AST_NODE_TYPES.RestElement
+ | AST_NODE_TYPES.ReturnStatement
+ | AST_NODE_TYPES.SequenceExpression
+ | AST_NODE_TYPES.SpreadElement
+ | AST_NODE_TYPES.StaticBlock
+ | AST_NODE_TYPES.Super
+ | AST_NODE_TYPES.SwitchStatement
+ | AST_NODE_TYPES.SwitchCase
+ | AST_NODE_TYPES.TaggedTemplateExpression
+ | AST_NODE_TYPES.TemplateElement
+ | AST_NODE_TYPES.TemplateLiteral
+ | AST_NODE_TYPES.ThisExpression
+ | AST_NODE_TYPES.ThrowStatement
+ | AST_NODE_TYPES.TryStatement
+ | AST_NODE_TYPES.UnaryExpression
+ | AST_NODE_TYPES.UpdateExpression
+ | AST_NODE_TYPES.VariableDeclaration
+ | AST_NODE_TYPES.VariableDeclarator
+ | AST_NODE_TYPES.WhileStatement
+ | AST_NODE_TYPES.WithStatement
+ | AST_NODE_TYPES.YieldExpression;
+
// strictly type the arrays of keys provided to make sure we keep this config in sync with the type defs
type AdditionalKeys = {
- readonly [T in AST_NODE_TYPES]?: readonly GetNodeTypeKeys[];
+ readonly // require keys for all nodes NOT defined in `eslint-visitor-keys`
+ [T in Exclude<
+ AST_NODE_TYPES,
+ KeysDefinedInESLintVisitorKeysCore
+ >]: readonly GetNodeTypeKeys[];
+} & {
+ readonly // optionally allow keys for all nodes defined in `eslint-visitor-keys`
+ [T in KeysDefinedInESLintVisitorKeysCore]?: readonly GetNodeTypeKeys[];
};
-const additionalKeys: AdditionalKeys = {
- // Stage 3 Import Assertions
- ImportAttribute: ['key', 'value'],
+/**
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ *
+ * The key arrays should be sorted in the order in which you would want to visit
+ * the child keys - don't just sort them alphabetically.
+ */
+
+// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option
+const SharedVisitorKeys = (() => {
+ const FunctionType = ['typeParameters', 'params', 'returnType'] as const;
+ const AnonymousFunction = [...FunctionType, 'body'] as const;
+ const AbstractPropertyDefinition = [
+ 'decorators',
+ 'key',
+ 'typeAnnotation',
+ ] as const;
+
+ return {
+ AnonymousFunction,
+ Function: ['id', ...AnonymousFunction],
+ FunctionType,
+
+ ClassDeclaration: [
+ 'decorators',
+ 'id',
+ 'typeParameters',
+ 'superClass',
+ 'superTypeParameters',
+ 'implements',
+ 'body',
+ ],
+
+ AbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'],
+ PropertyDefinition: [...AbstractPropertyDefinition, 'value'],
+ TypeAssertion: ['expression', 'typeAnnotation'],
+ } as const;
+})();
- // Additional Properties.
+const additionalKeys: AdditionalKeys = {
+ AccessorProperty: SharedVisitorKeys.PropertyDefinition,
ArrayPattern: ['decorators', 'elements', 'typeAnnotation'],
- ArrowFunctionExpression: ['typeParameters', 'params', 'returnType', 'body'],
+ ArrowFunctionExpression: SharedVisitorKeys.AnonymousFunction,
AssignmentPattern: ['decorators', 'left', 'right', 'typeAnnotation'],
CallExpression: ['callee', 'typeParameters', 'arguments'],
- ClassDeclaration: [
- 'decorators',
- 'id',
- 'typeParameters',
- 'superClass',
- 'superTypeParameters',
- 'implements',
- 'body',
- ],
- ClassExpression: [
- 'decorators',
- 'id',
- 'typeParameters',
- 'superClass',
- 'superTypeParameters',
- 'implements',
- 'body',
- ],
+ ClassDeclaration: SharedVisitorKeys.ClassDeclaration,
+ ClassExpression: SharedVisitorKeys.ClassDeclaration,
+ Decorator: ['expression'],
ExportAllDeclaration: ['exported', 'source', 'assertions'],
ExportNamedDeclaration: ['declaration', 'specifiers', 'source', 'assertions'],
- FunctionDeclaration: ['id', 'typeParameters', 'params', 'returnType', 'body'],
- FunctionExpression: ['id', 'typeParameters', 'params', 'returnType', 'body'],
+ FunctionDeclaration: SharedVisitorKeys.Function,
+ FunctionExpression: SharedVisitorKeys.Function,
Identifier: ['decorators', 'typeAnnotation'],
+ ImportAttribute: ['key', 'value'],
ImportDeclaration: ['specifiers', 'source', 'assertions'],
ImportExpression: ['source', 'attributes'],
+ JSXClosingFragment: [],
+ JSXOpeningElement: ['name', 'typeParameters', 'attributes'],
+ JSXOpeningFragment: [],
+ JSXSpreadChild: ['expression'],
MethodDefinition: ['decorators', 'key', 'value', 'typeParameters'],
NewExpression: ['callee', 'typeParameters', 'arguments'],
ObjectPattern: ['decorators', 'properties', 'typeAnnotation'],
- PropertyDefinition: ['decorators', 'key', 'typeAnnotation', 'value'],
+ PropertyDefinition: SharedVisitorKeys.PropertyDefinition,
RestElement: ['decorators', 'argument', 'typeAnnotation'],
- TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'],
StaticBlock: ['body'],
-
- // JSX
- JSXOpeningElement: ['name', 'typeParameters', 'attributes'],
- JSXClosingFragment: [],
- JSXOpeningFragment: [],
- JSXSpreadChild: ['expression'],
-
- // Additional Nodes.
- Decorator: ['expression'],
-
- // TS-prefixed nodes
+ TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'],
+ TSAbstractAccessorProperty: SharedVisitorKeys.AbstractPropertyDefinition,
TSAbstractKeyword: [],
TSAbstractMethodDefinition: ['key', 'value'],
- TSAbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'],
+ TSAbstractPropertyDefinition: SharedVisitorKeys.AbstractPropertyDefinition,
TSAnyKeyword: [],
TSArrayType: ['elementType'],
- TSAsExpression: ['expression', 'typeAnnotation'],
+ TSAsExpression: SharedVisitorKeys.TypeAssertion,
TSAsyncKeyword: [],
TSBigIntKeyword: [],
TSBooleanKeyword: [],
- TSCallSignatureDeclaration: ['typeParameters', 'params', 'returnType'],
+ TSCallSignatureDeclaration: SharedVisitorKeys.FunctionType,
TSClassImplements: ['expression', 'typeParameters'],
TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'],
- TSConstructorType: ['typeParameters', 'params', 'returnType'],
- TSConstructSignatureDeclaration: ['typeParameters', 'params', 'returnType'],
- TSDeclareFunction: ['id', 'typeParameters', 'params', 'returnType', 'body'],
+ TSConstructorType: SharedVisitorKeys.FunctionType,
+ TSConstructSignatureDeclaration: SharedVisitorKeys.FunctionType,
+ TSDeclareFunction: SharedVisitorKeys.Function,
TSDeclareKeyword: [],
- TSEmptyBodyFunctionExpression: [
- 'id',
- 'typeParameters',
- 'params',
- 'returnType',
- ],
+ TSEmptyBodyFunctionExpression: ['id', ...SharedVisitorKeys.FunctionType],
TSEnumDeclaration: ['id', 'members'],
TSEnumMember: ['id', 'initializer'],
TSExportAssignment: ['expression'],
TSExportKeyword: [],
TSExternalModuleReference: ['expression'],
- TSFunctionType: ['typeParameters', 'params', 'returnType'],
+ TSFunctionType: SharedVisitorKeys.FunctionType,
TSImportEqualsDeclaration: ['id', 'moduleReference'],
TSImportType: ['parameter', 'qualifier', 'typeParameters'],
TSIndexedAccessType: ['indexType', 'objectType'],
@@ -127,7 +233,12 @@ const additionalKeys: AdditionalKeys = {
TSQualifiedName: ['left', 'right'],
TSReadonlyKeyword: [],
TSRestType: ['typeAnnotation'],
- TSSatisfiesExpression: ['typeAnnotation', 'expression'],
+ TSSatisfiesExpression: [
+ // this is intentionally different to SharedVisitorKeys.TypeAssertion because
+ // the type annotation comes first in the source code
+ 'typeAnnotation',
+ 'expression',
+ ],
TSStaticKeyword: [],
TSStringKeyword: [],
TSSymbolKeyword: [],
@@ -136,7 +247,7 @@ const additionalKeys: AdditionalKeys = {
TSTupleType: ['elementTypes'],
TSTypeAliasDeclaration: ['id', 'typeParameters', 'typeAnnotation'],
TSTypeAnnotation: ['typeAnnotation'],
- TSTypeAssertion: ['typeAnnotation', 'expression'],
+ TSTypeAssertion: SharedVisitorKeys.TypeAssertion,
TSTypeLiteral: ['members'],
TSTypeOperator: ['typeAnnotation'],
TSTypeParameter: ['name', 'constraint', 'default'],
@@ -149,7 +260,7 @@ const additionalKeys: AdditionalKeys = {
TSUnionType: ['types'],
TSUnknownKeyword: [],
TSVoidKeyword: [],
-} as const;
+};
const visitorKeys: VisitorKeys = eslintVisitorKeys.unionWith(additionalKeys);
diff --git a/packages/website-eslint/CHANGELOG.md b/packages/website-eslint/CHANGELOG.md
index f5490b2af6ad..1e9c3506cc98 100644
--- a/packages/website-eslint/CHANGELOG.md
+++ b/packages/website-eslint/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package @typescript-eslint/website-eslint
+
# [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
diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json
index 59d872c683b1..2922dc49fbab 100644
--- a/packages/website-eslint/package.json
+++ b/packages/website-eslint/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/website-eslint",
- "version": "5.44.0",
+ "version": "5.45.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.44.0",
- "@typescript-eslint/utils": "5.44.0"
+ "@typescript-eslint/types": "5.45.0",
+ "@typescript-eslint/utils": "5.45.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.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",
+ "@typescript-eslint/eslint-plugin": "5.45.0",
+ "@typescript-eslint/parser": "5.45.0",
+ "@typescript-eslint/scope-manager": "5.45.0",
+ "@typescript-eslint/typescript-estree": "5.45.0",
+ "@typescript-eslint/visitor-keys": "5.45.0",
"eslint": "*",
"rollup": "^2.75.4",
"rollup-plugin-terser": "^7.0.2",
diff --git a/packages/website/CHANGELOG.md b/packages/website/CHANGELOG.md
index 76a67a305610..2bf6057010dd 100644
--- a/packages/website/CHANGELOG.md
+++ b/packages/website/CHANGELOG.md
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28)
+
+**Note:** Version bump only for package website
+
# [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
diff --git a/packages/website/README.md b/packages/website/README.md
index fd7bb57cb428..7f4c12e23722 100644
--- a/packages/website/README.md
+++ b/packages/website/README.md
@@ -1,5 +1,7 @@
# Website
+[](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/docusaurusConfig.ts b/packages/website/docusaurusConfig.ts
index 0ef589b005a2..7ac111820f2c 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 fb681231463e..d98523269042 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -1,6 +1,6 @@
{
"name": "website",
- "version": "5.44.0",
+ "version": "5.45.0",
"private": true,
"scripts": {
"build": "docusaurus build",
@@ -21,8 +21,8 @@
"@docusaurus/remark-plugin-npm2yarn": "~2.2.0",
"@docusaurus/theme-common": "~2.2.0",
"@mdx-js/react": "1.6.22",
- "@typescript-eslint/parser": "5.44.0",
- "@typescript-eslint/website-eslint": "5.44.0",
+ "@typescript-eslint/parser": "5.45.0",
+ "@typescript-eslint/website-eslint": "5.45.0",
"clsx": "^1.1.1",
"eslint": "*",
"json-schema": "^0.4.0",
@@ -48,7 +48,7 @@
"@types/react": "^18.0.9",
"@types/react-helmet": "^6.1.5",
"@types/react-router-dom": "^5.3.3",
- "@typescript-eslint/eslint-plugin": "5.44.0",
+ "@typescript-eslint/eslint-plugin": "5.45.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/playwright.config.ts b/packages/website/playwright.config.ts
index ba1f9df5617a..ad85c7391d99 100644
--- a/packages/website/playwright.config.ts
+++ b/packages/website/playwright.config.ts
@@ -22,6 +22,7 @@ const config: PlaywrightTestConfig = {
webServer: {
command: 'yarn start',
port: 3000,
+ reuseExistingServer: !process.env.CI,
},
workers: process.env.CI ? 1 : undefined,
};
diff --git a/packages/website/src/components/config/ConfigEditor.tsx b/packages/website/src/components/config/ConfigEditor.tsx
index 1d6e9346e0b1..0d4915d281b6 100644
--- a/packages/website/src/components/config/ConfigEditor.tsx
+++ b/packages/website/src/components/config/ConfigEditor.tsx
@@ -129,8 +129,12 @@ function ConfigEditor(props: ConfigEditorProps): JSX.Element {