Skip to content

Commit

Permalink
fix: remove jsx validation
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard committed Jan 2, 2023
1 parent 446bf14 commit 6617a04
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 12 deletions.
5 changes: 0 additions & 5 deletions src/actions/verify/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export async function validateTsConfig(
const errors: string[] = []

const expectedCompilerOptions = {
jsx: 'preserve',
moduleResolution: 'node',
target: 'esnext',
module: 'esnext',
Expand All @@ -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'
}
Expand Down
1 change: 1 addition & 0 deletions src/configs/eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}

Expand Down
4 changes: 2 additions & 2 deletions src/configs/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -43,7 +43,7 @@ export function tsconfigTemplateDist(options: {outDir: string; flags: InitFlags}
"compilerOptions": {
"rootDir": ".",
"outDir": "./${outDir}",
"jsx": "preserve",
"jsx": "react-jsx",
"emitDeclarationOnly": true
}
}
Expand Down
3 changes: 1 addition & 2 deletions tap-snapshots/test/verify-package.test.ts.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/inject/valid/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"jsx": "preserve",
"jsx": "react-jsx",
"moduleResolution": "node",
"target": "esnext",
"module": "esnext",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/verify-package/invalid-eslint/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"jsx": "preserve",
"jsx": "react-jsx",
"moduleResolution": "node",
"target": "esnext",
"module": "esnext",
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/verify-package/valid/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"jsx": "preserve",
"jsx": "react-jsx",
"moduleResolution": "node",
"target": "esnext",
"module": "esnext",
Expand Down

0 comments on commit 6617a04

Please sign in to comment.