Skip to content

feat(ast-spec): change type of UnaryExpression.prefix to always true#12372

Merged
kirkwaiblinger merged 3 commits into
typescript-eslint:mainfrom
kirkwaiblinger:prefix-true
Jun 3, 2026
Merged

feat(ast-spec): change type of UnaryExpression.prefix to always true#12372
kirkwaiblinger merged 3 commits into
typescript-eslint:mainfrom
kirkwaiblinger:prefix-true

Conversation

@kirkwaiblinger

Copy link
Copy Markdown
Member

PR Checklist

Overview

Slight restructuring of the type hierarchy in ast-spec...

Right now, UpdateExpression and UnaryExpressions have a common base interface UnaryExpressionBase, in which prefix is given as boolean. I'm 90% sure that UnaryExpressionBase is not user-visible, and therefore, it is safe to remove it as a common base. If anyone knows, please let me know if that's not true! I've assumed this to be true in this PR, and removed the common base (there's now a base interface for the UnaryExpressions only, that's called UnaryExpressionBase, but it's still internal).

If that assumption is incorrect, I can easily change this PR to keep UnaryExpressionBase as is, remaining a common base for the UnaryExpressions and UpdateExpression, but still update the exported UnaryExpression union slightly differently to have prefix: true.

Deprecated prefix

I figured it made sense to add /** @deprecated */ to UnaryExpression's prefix property to discourage reading it and explain that it's always true, even though it will never be removed. But lmk if that isn't the right move 🤷

Other

otherwise there's just minor downstream changes

@typescript-eslint

Copy link
Copy Markdown
Contributor

Thanks for the PR, @kirkwaiblinger!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify

netlify Bot commented May 28, 2026

Copy link
Copy Markdown

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 7c649e0
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/6a1fdf15326f3000086444e2
😎 Deploy Preview https://deploy-preview-12372--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 99 (no change from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 90 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud

nx-cloud Bot commented May 28, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 7c649e0

Command Status Duration Result
nx run-many -t lint --projects=eslint-plugin --... ✅ Succeeded 52s View ↗
nx run-many -t lint --projects=parser,type-util... ✅ Succeeded 29s View ↗
nx run types:build ✅ Succeeded 1s View ↗
nx run generate-configs ✅ Succeeded 8s View ↗
nx run-many -t typecheck:tsgo ✅ Succeeded 1m 37s View ↗
nx run-many -t typecheck ✅ Succeeded 43s View ↗
nx run-many -t lint --projects=typescript-estre... ✅ Succeeded 55s View ↗
nx run-many -t lint --projects=ast-spec,utils,s... ✅ Succeeded 27s View ↗
Additional runs (38) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-06-03 08:06:50 UTC

@kirkwaiblinger kirkwaiblinger changed the title feat(ast-spec): prefix is always true for UnaryExpression feat(ast-spec): change type of UnaryExpression.prefix to always true May 28, 2026
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.97%. Comparing base (c4b5d10) to head (7c649e0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/typescript-estree/src/convert.ts 0.00% 3 Missing ⚠️

❌ Your patch status has failed because the patch coverage (25.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12372      +/-   ##
==========================================
- Coverage   86.99%   86.97%   -0.02%     
==========================================
  Files         513      513              
  Lines       16546    16549       +3     
  Branches     5165     5166       +1     
==========================================
  Hits        14394    14394              
- Misses       1461     1464       +3     
  Partials      691      691              
Flag Coverage Δ
unittest 86.97% <25.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rc/rules/no-unnecessary-boolean-literal-compare.ts 97.56% <100.00%> (ø)
packages/typescript-estree/src/convert.ts 38.40% <0.00%> (-0.18%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense to me!

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label May 28, 2026
@kirkwaiblinger kirkwaiblinger enabled auto-merge (squash) June 3, 2026 08:00
@kirkwaiblinger kirkwaiblinger merged commit ef1fd28 into typescript-eslint:main Jun 3, 2026
64 of 65 checks passed
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Jun 12, 2026
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.60.0 | 8.61.0 |
| npm        | @typescript-eslint/parser        | 8.60.0 | 8.61.0 |


## [v8.61.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8610-2026-06-08)

##### 🚀 Features

- **ast-spec:** change type of `UnaryExpression.prefix` to always `true` ([#12372](typescript-eslint/typescript-eslint#12372))

##### ❤️ Thank You

- Kirk Waiblinger [@kirkwaiblinger](https://github.com/kirkwaiblinger)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.61.0) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.


## [v8.60.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8601-2026-06-01)

##### 🩹 Fixes

- **eslint-plugin:** \[no-shadow] correct rule to match ESLint v10 handling ([#12182](typescript-eslint/typescript-eslint#12182))
- **eslint-plugin:** respect ECMAScript line terminators in ts-comment rules ([#12352](typescript-eslint/typescript-eslint#12352))

##### ❤️ Thank You

- lumir
- Nevette Bailey [@nevette-bailey](https://github.com/nevette-bailey)

See [GitHub Releases](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v8.60.1) for more information.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants