这是indexloc提供的服务,不要输入任何密码
Skip to content

Warn on not-yet-supported import.meta usage #2397

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

Merged
merged 3 commits into from
Oct 27, 2022

Conversation

wbinnssmith
Copy link
Member

@wbinnssmith wbinnssmith commented Oct 27, 2022

This implements a warning when import.meta is referenced, both as a standalone expression (import.meta) and as a member expression (import.meta.url, import.meta.foo, etc.).

To do:

  • This expression covers both import.meta as well as new.target. Investigate how this usage is impacted and handle it.

Test Plan:

  • Added a import.meta expression and import.meta.url member expression in a test app and verified both were flagged (see below)
  • In the same test app, verified using new.target was not flagged.
path/to/testapp/src/index.jsx:1:12  error TP1106 import.meta is not yet supported
       1 > console.log(import.meta);
       2   console.log(import.meta.url);
       3   
       4   function Foo() {
       5     new.target;

path/to/testapp/src/index.jsx:2:12  error TP1106 import.meta is not yet supported
       1   console.log(import.meta);
       2 > console.log(import.meta.url);
       3   
       4   function Foo() {
       5     new.target;
       6   }

@vercel
Copy link

vercel bot commented Oct 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

6 Ignored Deployments
Name Status Preview Comments Updated
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Oct 27, 2022 at 1:20AM (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Oct 27, 2022 at 1:20AM (UTC)
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Oct 27, 2022 at 1:20AM (UTC)
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Oct 27, 2022 at 1:20AM (UTC)
examples-svelte-web ⬜️ Ignored (Inspect) Oct 27, 2022 at 1:20AM (UTC)
turbo-site ⬜️ Ignored (Inspect) Visit Preview Oct 27, 2022 at 1:20AM (UTC)

@wbinnssmith wbinnssmith added the pr: automerge Kodiak will merge these automatically after checks pass label Oct 27, 2022
@kodiakhq kodiakhq bot merged commit 75479b0 into main Oct 27, 2022
@kodiakhq kodiakhq bot deleted the wbinnssmith/warn-import-meta branch October 27, 2022 01:34
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
This implements a warning when `import.meta` is referenced, both as a standalone expression (`import.meta`) and as a member expression (`import.meta.url`, `import.meta.foo`, etc.).

To do: 
* [x] This expression covers both `import.meta` as well as `new.target`. Investigate how this usage is impacted and handle it.

Test Plan: 
* Added a `import.meta` expression and `import.meta.url` member expression in a test app and verified both were flagged (see below)
* In the same test app, verified using `new.target` was not flagged.

```
path/to/testapp/src/index.jsx:1:12  error TP1106 import.meta is not yet supported
       1 > console.log(import.meta);
       2   console.log(import.meta.url);
       3   
       4   function Foo() {
       5     new.target;

path/to/testapp/src/index.jsx:2:12  error TP1106 import.meta is not yet supported
       1   console.log(import.meta);
       2 > console.log(import.meta.url);
       3   
       4   function Foo() {
       5     new.target;
       6   }
```
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
This implements a warning when `import.meta` is referenced, both as a standalone expression (`import.meta`) and as a member expression (`import.meta.url`, `import.meta.foo`, etc.).

To do: 
* [x] This expression covers both `import.meta` as well as `new.target`. Investigate how this usage is impacted and handle it.

Test Plan: 
* Added a `import.meta` expression and `import.meta.url` member expression in a test app and verified both were flagged (see below)
* In the same test app, verified using `new.target` was not flagged.

```
path/to/testapp/src/index.jsx:1:12  error TP1106 import.meta is not yet supported
       1 > console.log(import.meta);
       2   console.log(import.meta.url);
       3   
       4   function Foo() {
       5     new.target;

path/to/testapp/src/index.jsx:2:12  error TP1106 import.meta is not yet supported
       1   console.log(import.meta);
       2 > console.log(import.meta.url);
       3   
       4   function Foo() {
       5     new.target;
       6   }
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: automerge Kodiak will merge these automatically after checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants