Commit 0625d0d
authored
[ts-next-plugin] test: add metadata warn no type test (#78505)
### Why?
This PR initiates the migration of manual testing of the Next.js TypeScript plugin to an automated language service plugin test. It replaced the existing metadata `missing-type-warning` fixture with the `warn-no-type` test (naming for consistency, such as future `error-on-client`).
### Testing Plan
This PR adds the tests and fixtures for the metadata plugin to **warn when no type is provided** for metadata config exports (`metadata` and `generateMetadata`).
1. The fixtures are tested into two categories: 1) "**has type**": expects no warning, and 2) "**no type**": expects a warning.
2. For "has type", the types are from `next` or custom.
3. Each section consists of inline exports and separate exports (`export { ... }`).
4. For the fixtures of `generateMetadata`, it is divided into a function, an arrow function, and a function expression divided with sync and async.
<details><summary>Structure Details</summary>
<p>
#### `metadata`
```
.
├── has-type/
│ ├── export-inline/
│ │ ├── from-next
│ │ └── from-others
│ └── export-separate/
│ ├── from-next
│ └── from-others
└── no-type/
├── export-inline
└── export-separate
```
#### `gerenateMetadata`
```
.
├── has-type/
│ ├── export-inline/
│ │ ├── from-next/
│ │ │ ├── async/
│ │ │ │ ├── arrow-function
│ │ │ │ ├── function-declaration
│ │ │ │ └── function-expression
│ │ │ └── sync/
│ │ │ ├── arrow-function
│ │ │ ├── function-declaration
│ │ │ └── function-expression
│ │ └── from-others/
│ │ ├── async/
│ │ │ └── ...
│ │ └── sync/
│ │ └── ...
│ └── export-separate/
│ ├── from-next/
│ │ ├── async/
│ │ │ └── ...
│ │ └── sync/
│ │ └── ...
│ └── from-others/
│ ├── async/
│ │ └── ...
│ └── sync/
│ └── ...
└── no-type/
├── export-inline/
│ ├── async/
│ │ └── ...
│ └── sync/
│ └── ...
└── export-separate/
├── async/
│ └── ...
└── sync/
└── ...
```
</p>
</details>
### Follow Up
The metadata currently has one more feature: an error when using metadata exports within Client Components.1 parent 34c5d41 commit 0625d0d
File tree
89 files changed
+1335
-16
lines changed- packages/next/src/server/typescript/rules
- test/development/typescript-plugin
- metadata
- app/warn-no-type
- generate-metadata
- has-type
- export-inline-from-next-async-arrow-function
- export-inline-from-next-async-function-expression
- export-inline-from-next-async-function
- export-inline-from-next-sync-arrow-function
- export-inline-from-next-sync-function-expression
- export-inline-from-next-sync-function
- export-inline-from-other-async-arrow-function
- export-inline-from-other-async-function-expression
- export-inline-from-other-async-function
- export-inline-from-other-sync-arrow-function
- export-inline-from-other-sync-function-expression
- export-inline-from-other-sync-function
- export-separate-from-next-async-arrow-function
- export-separate-from-next-async-function-expression
- export-separate-from-next-async-function
- export-separate-from-next-sync-arrow-function
- export-separate-from-next-sync-function-expression
- export-separate-from-next-sync-function
- export-separate-from-other-async-arrow-function
- export-separate-from-other-async-function-expression
- export-separate-from-other-async-function
- export-separate-from-other-sync-arrow-function
- export-separate-from-other-sync-function-expression
- export-separate-from-other-sync-function
- no-type
- export-inline-async-arrow-function
- export-inline-async-function-expression
- export-inline-async-function
- export-inline-sync-arrow-function
- export-inline-sync-function-expression
- export-inline-sync-function
- export-separate-async-arrow-function
- export-separate-async-function-expression
- export-separate-async-function
- export-separate-sync-arrow-function
- export-separate-sync-function-expression
- export-separate-sync-function
- metadata
- has-type
- export-inline-from-next
- export-inline-from-other
- export-separate-from-next
- export-separate-from-other
- no-type
- export-inline
- export-separate
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
89 files changed
+1335
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments