From d60d46e65025ef7f735707613992c6e385390f7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Lundga=CC=8Ard?= Date: Tue, 20 Dec 2022 21:48:25 +0100 Subject: [PATCH] feat!: validate `emitDeclarationOnly` compiler option BREAKING CHANGE: `emitDeclarationOnly` is now a required compiler option. Run `plugin-kit verify-package` to get hints about how to apply required changes. --- src/actions/verify/validations.ts | 1 + tap-snapshots/test/verify-package.test.ts.test.cjs | 3 ++- test/fixtures/inject/valid/tsconfig.json | 3 ++- test/fixtures/verify-package/invalid-eslint/tsconfig.json | 3 ++- test/fixtures/verify-package/valid/tsconfig.json | 3 ++- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/actions/verify/validations.ts b/src/actions/verify/validations.ts index 964a4047..d56964ee 100644 --- a/src/actions/verify/validations.ts +++ b/src/actions/verify/validations.ts @@ -125,6 +125,7 @@ export async function validateTsConfig( moduleResolution: 'node', target: 'esnext', module: 'esnext', + emitDeclarationOnly: true, esModuleInterop: true, skipLibCheck: true, isolatedModules: true, diff --git a/tap-snapshots/test/verify-package.test.ts.test.cjs b/tap-snapshots/test/verify-package.test.ts.test.cjs index a6dc717a..8274c4ef 100644 --- a/tap-snapshots/test/verify-package.test.ts.test.cjs +++ b/tap-snapshots/test/verify-package.test.ts.test.cjs @@ -125,12 +125,13 @@ 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, esModuleInterop, skipLibCheck, isolatedModules, downlevelIteration, declaration, allowSyntheticDefaultImports, rootDir, outDir] +The following fields had unexpected values: [jsx, 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", +"emitDeclarationOnly": true, "esModuleInterop": true, "skipLibCheck": true, "isolatedModules": true, diff --git a/test/fixtures/inject/valid/tsconfig.json b/test/fixtures/inject/valid/tsconfig.json index 936acf2d..e0937952 100644 --- a/test/fixtures/inject/valid/tsconfig.json +++ b/test/fixtures/inject/valid/tsconfig.json @@ -18,7 +18,8 @@ "skipLibCheck": true, "isolatedModules": true, "checkJs": false, - "rootDir": "." + "rootDir": ".", + "emitDeclarationOnly": true }, "include": ["src/**/*"] } diff --git a/test/fixtures/verify-package/invalid-eslint/tsconfig.json b/test/fixtures/verify-package/invalid-eslint/tsconfig.json index f12bcda3..36b93731 100644 --- a/test/fixtures/verify-package/invalid-eslint/tsconfig.json +++ b/test/fixtures/verify-package/invalid-eslint/tsconfig.json @@ -17,7 +17,8 @@ "outDir": "dist", "skipLibCheck": true, "isolatedModules": true, - "checkJs": false + "checkJs": false, + "emitDeclarationOnly": true }, "include": ["src/**/*"] } diff --git a/test/fixtures/verify-package/valid/tsconfig.json b/test/fixtures/verify-package/valid/tsconfig.json index 936acf2d..e0937952 100644 --- a/test/fixtures/verify-package/valid/tsconfig.json +++ b/test/fixtures/verify-package/valid/tsconfig.json @@ -18,7 +18,8 @@ "skipLibCheck": true, "isolatedModules": true, "checkJs": false, - "rootDir": "." + "rootDir": ".", + "emitDeclarationOnly": true }, "include": ["src/**/*"] }