Skip to content

Commit

Permalink
fix: disable typescript check for generated i18n.options.mjs (#2402)
Browse files Browse the repository at this point in the history
* fix: disable typescript checking for generated i18n.options.mjs

* test: update snapshots
  • Loading branch information
BobbieGoede committed Sep 14, 2023
1 parent 1512f7a commit fbea0d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function generateLoaderOptions(
})
}

let genCode = ''
let genCode = '// @ts-nocheck\n'
const localeInfo = options.localeInfo || []
const syncLocaleFiles = new Set<LocaleInfo>()
const asyncLocaleFiles = new Set<LocaleInfo>()
Expand Down
24 changes: 16 additions & 8 deletions test/__snapshots__/gen.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`basic 1`] = `
"import locale_en_json_en from \\"../en.json\\" assert { type: \\"json\\" };
"// @ts-nocheck
import locale_en_json_en from \\"../en.json\\" assert { type: \\"json\\" };
import locale_ja_json_ja from \\"../ja.json\\" assert { type: \\"json\\" };
import locale_fr_json_fr from \\"../fr.json\\" assert { type: \\"json\\" };
export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
Expand All @@ -28,7 +29,8 @@ export const parallelPlugin = false
`;

exports[`files with cache configuration 1`] = `
"export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\",\\"es\\",\\"es-AR\\"]
"// @ts-nocheck
export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\",\\"es\\",\\"es-AR\\"]
export const localeMessages = {
\\"en\\": [{ key: \\"../en.json\\", load: () => import(\\"../en.json\\" /* webpackChunkName: \\"lang_en_json_en_json\\" */), cache: true }],
Expand All @@ -52,7 +54,8 @@ export const parallelPlugin = false
`;

exports[`lazy 1`] = `
"export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
"// @ts-nocheck
export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
export const localeMessages = {
\\"en\\": [{ key: \\"../en.json\\", load: () => import(\\"../en.json\\" /* webpackChunkName: \\"lang_en_json_en_json\\" */), cache: true }],
Expand All @@ -74,7 +77,8 @@ export const parallelPlugin = false
`;

exports[`locale file in nested 1`] = `
"export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
"// @ts-nocheck
export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
export const localeMessages = {
\\"en\\": [{ key: \\"../en/main.json\\", load: () => import(\\"../en/main.json\\" /* webpackChunkName: \\"lang_en_en_main_json\\" */), cache: true }],
Expand All @@ -96,7 +100,8 @@ export const parallelPlugin = false
`;

exports[`multiple files 1`] = `
"export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\",\\"es\\",\\"es-AR\\"]
"// @ts-nocheck
export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\",\\"es\\",\\"es-AR\\"]
export const localeMessages = {
\\"en\\": [{ key: \\"../en.json\\", load: () => import(\\"../en.json\\" /* webpackChunkName: \\"lang_en_json_en_json\\" */), cache: true }],
Expand All @@ -120,7 +125,8 @@ export const parallelPlugin = false
`;

exports[`toCode: function (arrow) 1`] = `
"export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
"// @ts-nocheck
export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
export const resolveNuxtI18nOptions = async (context) => {
const nuxtI18nOptions = Object({})
Expand All @@ -145,7 +151,8 @@ export const parallelPlugin = false
`;
exports[`toCode: function (named) 1`] = `
"export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
"// @ts-nocheck
export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
export const resolveNuxtI18nOptions = async (context) => {
const nuxtI18nOptions = Object({})
Expand All @@ -170,7 +177,8 @@ export const parallelPlugin = false
`;
exports[`vueI18n option 1`] = `
"import locale_en_json_en from \\"../en.json\\" assert { type: \\"json\\" };
"// @ts-nocheck
import locale_en_json_en from \\"../en.json\\" assert { type: \\"json\\" };
import locale_ja_json_ja from \\"../ja.json\\" assert { type: \\"json\\" };
import locale_fr_json_fr from \\"../fr.json\\" assert { type: \\"json\\" };
export const localeCodes = [\\"en\\",\\"ja\\",\\"fr\\"]
Expand Down

0 comments on commit fbea0d9

Please sign in to comment.