Skip to content

Commit 0f960d1

Browse files
committed
Revert "feat(typegen): sanity typegen Whitespace Handling in Query Output (#8648)"
This reverts commit df7bf58.
1 parent 0ecb3d6 commit 0f960d1

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

packages/@sanity/codegen/src/typescript/__tests__/findQueriesInSource.test.ts

+2-19
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ describe('findQueries with the groq template', () => {
188188
expect(queries.length).toBe(0)
189189
})
190190

191-
test('will ignore declarations if any of the leading comments are ignore tags', () => {
191+
test('will ignore declerations if any of the leading comments are ignore tags', () => {
192192
const source = `
193193
import { groq } from "groq";
194194
@@ -200,23 +200,6 @@ describe('findQueries with the groq template', () => {
200200
const queries = findQueriesInSource(source, __filename, undefined)
201201
expect(queries.length).toBe(0)
202202
})
203-
204-
test('should remove unnecessary whitespace in queries', () => {
205-
const source = `
206-
import { groq } from "groq";
207-
const messyQuery = groq\`
208-
209-
*[_type == "author"]
210-
211-
\`
212-
const res = sanity.fetch(messyQuery);
213-
`
214-
215-
const queries = findQueriesInSource(source, 'test.ts')
216-
const queryResult = queries[0]
217-
218-
expect(queryResult?.result).toEqual('*[_type == "author"]')
219-
})
220203
})
221204

222205
describe('findQueries with defineQuery', () => {
@@ -385,7 +368,7 @@ describe('findQueries with defineQuery', () => {
385368
expect(queries.length).toBe(0)
386369
})
387370

388-
test('will ignore declarations if any of the leading comments are ignore tags', () => {
371+
test('will ignore declerations if any of the leading comments are ignore tags', () => {
389372
const source = `
390373
import {defineQuery} from "groq";
391374

packages/@sanity/codegen/src/typescript/findQueriesInSource.ts

-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ export function findQueriesInSource(
7272
filename,
7373
resolver,
7474
})
75-
.replace(/\s+/g, ' ')
76-
.trim()
7775

7876
const location = node.loc
7977
? {

packages/@sanity/codegen/src/typescript/typeGenerator.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ export class TypeGenerator {
152152
}
153153

154154
/**
155-
* Since we are sanitizing identifiers we might end up with collisions. Ie there might be a type mux.video and muxVideo, both these
156-
* types would be sanitized into MuxVideo. To avoid this we keep track of the generated type names and add a index to the name.
155+
* Since we are sanitizing identifiers we migt end up with collisions. Ie there might be a type mux.video and muxVideo, both these
156+
* types would be sanityized into MuxVideo. To avoid this we keep track of the generated type names and add a index to the name.
157157
* When we reference a type we also keep track of the original name so we can reference the correct type later.
158158
*/
159159
private getTypeName(

0 commit comments

Comments
 (0)