diff --git a/src/actions/verify/validations.ts b/src/actions/verify/validations.ts index d56964ee..c0db7527 100644 --- a/src/actions/verify/validations.ts +++ b/src/actions/verify/validations.ts @@ -121,7 +121,6 @@ export async function validateTsConfig( const errors: string[] = [] const expectedCompilerOptions = { - jsx: 'preserve', moduleResolution: 'node', target: 'esnext', module: 'esnext', @@ -147,10 +146,6 @@ export async function validateTsConfig( option = path.relative(basePath, option) || '.' } - if (key === 'jsx' && option === 1) { - option = 'preserve' - } - if (key === 'moduleResolution' && option === 2) { option = 'node' } diff --git a/src/configs/eslint.ts b/src/configs/eslint.ts index e9cb9945..b02ba8bf 100644 --- a/src/configs/eslint.ts +++ b/src/configs/eslint.ts @@ -16,6 +16,7 @@ export function eslintrcTemplate(options: {flags: InitFlags}): InjectTemplate { 'sanity/react', 'plugin:react-hooks/recommended', flags.prettier && 'plugin:prettier/recommended', + 'plugin:react/jsx-runtime', ].filter(Boolean), } diff --git a/src/configs/tsconfig.ts b/src/configs/tsconfig.ts index 66f04b2a..98d41d88 100644 --- a/src/configs/tsconfig.ts +++ b/src/configs/tsconfig.ts @@ -15,7 +15,7 @@ export function tsconfigTemplate(options: {flags: InitFlags}): InjectTemplate { "include": ["./src", "./package.config.ts"], "compilerOptions": { "rootDir": ".", - "jsx": "preserve", + "jsx": "react-jsx", "noEmit": true } } @@ -43,7 +43,7 @@ export function tsconfigTemplateDist(options: {outDir: string; flags: InitFlags} "compilerOptions": { "rootDir": ".", "outDir": "./${outDir}", - "jsx": "preserve", + "jsx": "react-jsx", "emitDeclarationOnly": true } } diff --git a/tap-snapshots/test/verify-package.test.ts.test.cjs b/tap-snapshots/test/verify-package.test.ts.test.cjs index 8274c4ef..20933489 100644 --- a/tap-snapshots/test/verify-package.test.ts.test.cjs +++ b/tap-snapshots/test/verify-package.test.ts.test.cjs @@ -125,9 +125,8 @@ To skip this validation add the following to your package.json: [error] Recommended tsconfig.json compilerOptions missing: -The following fields had unexpected values: [jsx, moduleResolution, target, module, emitDeclarationOnly, esModuleInterop, skipLibCheck, isolatedModules, downlevelIteration, declaration, allowSyntheticDefaultImports, rootDir, outDir] +The following fields had unexpected values: [moduleResolution, target, module, emitDeclarationOnly, esModuleInterop, skipLibCheck, isolatedModules, downlevelIteration, declaration, allowSyntheticDefaultImports, rootDir, outDir] Expected to find these values: -"jsx": "preserve", "moduleResolution": "node", "target": "esnext", "module": "esnext", diff --git a/test/fixtures/inject/valid/tsconfig.json b/test/fixtures/inject/valid/tsconfig.json index e0937952..6e93ad84 100644 --- a/test/fixtures/inject/valid/tsconfig.json +++ b/test/fixtures/inject/valid/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "jsx": "preserve", + "jsx": "react-jsx", "moduleResolution": "node", "target": "esnext", "module": "esnext", diff --git a/test/fixtures/verify-package/invalid-eslint/tsconfig.json b/test/fixtures/verify-package/invalid-eslint/tsconfig.json index 36b93731..d12ef450 100644 --- a/test/fixtures/verify-package/invalid-eslint/tsconfig.json +++ b/test/fixtures/verify-package/invalid-eslint/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "jsx": "preserve", + "jsx": "react-jsx", "moduleResolution": "node", "target": "esnext", "module": "esnext", diff --git a/test/fixtures/verify-package/valid/tsconfig.json b/test/fixtures/verify-package/valid/tsconfig.json index e0937952..6e93ad84 100644 --- a/test/fixtures/verify-package/valid/tsconfig.json +++ b/test/fixtures/verify-package/valid/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "jsx": "preserve", + "jsx": "react-jsx", "moduleResolution": "node", "target": "esnext", "module": "esnext",