Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: disallow optional chaining #10919

Merged
merged 1 commit into from
May 29, 2024
Merged

Conversation

sxzz
Copy link
Member

@sxzz sxzz commented May 12, 2024

Disallow the use of optional chaining (a?.b, a?.()), except when running on Node.js.

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.7 kB 34.5 kB 31.1 kB
vue.global.prod.js 148 kB 53.7 kB 48 kB

Usages

Name Size Gzip Brotli
createApp 50.8 kB 19.9 kB 18.1 kB
createSSRApp 54.1 kB 21.2 kB 19.3 kB
defineCustomElement 53.1 kB 20.6 kB 18.8 kB
overall 64.5 kB 24.9 kB 22.6 kB

@haoqunjiang haoqunjiang added the 🧹 p1-chore Priority 1: this doesn't change code behavior. label May 20, 2024
@haoqunjiang
Copy link
Member

But after minification it is not that verbose: https://esbuild.github.io/try/#dAAwLjIxLjQALS10YXJnZXQ9ZXMyMDE2IC0tbWluaWZ5AGE/LmI

@sxzz
Copy link
Member Author

sxzz commented May 28, 2024

See #4882 (comment)
Additionally, in the case of a?.b?.c, it will be larger.

@haoqunjiang haoqunjiang merged commit cdb1d17 into main May 29, 2024
15 checks passed
@haoqunjiang haoqunjiang deleted the chore/eslint-optional-chaining branch May 29, 2024 07:03
wangdaoo pushed a commit to wangdaoo/core that referenced this pull request May 30, 2024
Boshen pushed a commit to oxc-project/oxc that referenced this pull request Jun 17, 2024
const root = instance?.subTree
if (
vnode === root ||
// eslint-disable-next-line no-restricted-syntax
Copy link
Member

Choose a reason for hiding this comment

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

hydration code actually runs in the browser and shouldn't have been allowed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 p1-chore Priority 1: this doesn't change code behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants