Skip to content

Commit e0d37b0

Browse files
authored
fix: move prettier-ignore statement so it works (unplugin#729)
1 parent c0e66f3 commit e0d37b0

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

src/core/declaration.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,14 @@ export function getDeclaration(ctx: Context, filepath: string, originalImports?:
114114
directive: stringifyDeclarationImports({ ...originalImports?.directive, ...imports.directive }),
115115
}
116116

117-
const head = ctx.options.version === 2.7
118-
? `export {}
119-
120-
declare module 'vue' {`
121-
: `export {}
122-
123-
declare module 'vue' {`
124-
125117
let code = `/* eslint-disable */
126-
/* prettier-ignore */
127118
// @ts-nocheck
128119
// Generated by unplugin-vue-components
129120
// Read more: https://github.com/vuejs/core/pull/3399
130-
${head}`
121+
export {}
122+
123+
/* prettier-ignore */
124+
declare module 'vue' {`
131125

132126
if (Object.keys(declarations.component).length > 0) {
133127
code += `

test/__snapshots__/dts.test.ts.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
exports[`dts > components only 1`] = `
44
"/* eslint-disable */
5-
/* prettier-ignore */
65
// @ts-nocheck
76
// Generated by unplugin-vue-components
87
// Read more: https://github.com/vuejs/core/pull/3399
98
export {}
109
10+
/* prettier-ignore */
1111
declare module 'vue' {
1212
export interface GlobalComponents {
1313
RouterLink: typeof import('vue-router')['RouterLink']
@@ -20,12 +20,12 @@ declare module 'vue' {
2020

2121
exports[`dts > directive only 1`] = `
2222
"/* eslint-disable */
23-
/* prettier-ignore */
2423
// @ts-nocheck
2524
// Generated by unplugin-vue-components
2625
// Read more: https://github.com/vuejs/core/pull/3399
2726
export {}
2827
28+
/* prettier-ignore */
2929
declare module 'vue' {
3030
export interface ComponentCustomProperties {
3131
vLoading: typeof import('test/directive/Loading')['default']
@@ -36,12 +36,12 @@ declare module 'vue' {
3636

3737
exports[`dts > getDeclaration 1`] = `
3838
"/* eslint-disable */
39-
/* prettier-ignore */
4039
// @ts-nocheck
4140
// Generated by unplugin-vue-components
4241
// Read more: https://github.com/vuejs/core/pull/3399
4342
export {}
4443
44+
/* prettier-ignore */
4545
declare module 'vue' {
4646
export interface GlobalComponents {
4747
RouterLink: typeof import('vue-router')['RouterLink']
@@ -94,12 +94,12 @@ exports[`dts > parseDeclaration 1`] = `
9494

9595
exports[`dts > vue 2.7 components only 1`] = `
9696
"/* eslint-disable */
97-
/* prettier-ignore */
9897
// @ts-nocheck
9998
// Generated by unplugin-vue-components
10099
// Read more: https://github.com/vuejs/core/pull/3399
101100
export {}
102101
102+
/* prettier-ignore */
103103
declare module 'vue' {
104104
export interface GlobalComponents {
105105
RouterLink: typeof import('vue-router')['RouterLink']
@@ -112,12 +112,12 @@ declare module 'vue' {
112112

113113
exports[`dts > writeDeclaration - keep unused 1`] = `
114114
"/* eslint-disable */
115-
/* prettier-ignore */
116115
// @ts-nocheck
117116
// Generated by unplugin-vue-components
118117
// Read more: https://github.com/vuejs/core/pull/3399
119118
export {}
120119
120+
/* prettier-ignore */
121121
declare module 'vue' {
122122
export interface GlobalComponents {
123123
RouterLink: typeof import('vue-router')['RouterLink']
@@ -136,12 +136,12 @@ declare module 'vue' {
136136

137137
exports[`dts > writeDeclaration 1`] = `
138138
"/* eslint-disable */
139-
/* prettier-ignore */
140139
// @ts-nocheck
141140
// Generated by unplugin-vue-components
142141
// Read more: https://github.com/vuejs/core/pull/3399
143142
export {}
144143
144+
/* prettier-ignore */
145145
declare module 'vue' {
146146
export interface GlobalComponents {
147147
RouterLink: typeof import('vue-router')['RouterLink']

test/dts.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ const _directive_loading = _resolveDirective("loading")`
124124
test('parseDeclaration', async () => {
125125
const code = `
126126
/* eslint-disable */
127-
/* prettier-ignore */
128127
// generated by unplugin-vue-components
129128
// We suggest you to commit this file into source control
130129
// Read more: https://github.com/vuejs/core/pull/3399
131130
export {}
132131
132+
/* prettier-ignore */
133133
declare module 'vue' {
134134
export interface GlobalComponents {
135135
ComponentA: typeof import('./src/components/ComponentA.vue')['default']
@@ -145,12 +145,12 @@ declare module 'vue' {
145145
test('parseDeclaration - has icon component like <IMdi:diceD12>', async () => {
146146
const code = `
147147
/* eslint-disable */
148-
/* prettier-ignore */
149148
// generated by unplugin-vue-components
150149
// We suggest you to commit this file into source control
151150
// Read more: https://github.com/vuejs/core/pull/3399
152151
export {}
153152
153+
/* prettier-ignore */
154154
declare module 'vue' {
155155
export interface GlobalComponents {
156156
ComponentA: typeof import('./src/components/ComponentA.vue')['default']
@@ -166,12 +166,12 @@ declare module 'vue' {
166166
test('parseDeclaration - with directives', async () => {
167167
const code = `
168168
/* eslint-disable */
169-
/* prettier-ignore */
170169
// generated by unplugin-vue-components
171170
// We suggest you to commit this file into source control
172171
// Read more: https://github.com/vuejs/core/pull/3399
173172
export {}
174173
174+
/* prettier-ignore */
175175
declare module 'vue' {
176176
export interface GlobalComponents {
177177
ComponentA: typeof import('./src/components/ComponentA.vue')['default']

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy