From d647138de0ae95803bde71f1e4c568dd9da323c5 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Mon, 2 Nov 2020 14:59:26 -0500 Subject: [PATCH] Add a shape to the TS config files (#1466) * Add a shape to the TS config files * Use the jsdoc comment for typing the snowpack config everywhere * Fix tests --- create-snowpack-app/app-template-11ty/snowpack.config.js | 1 + .../app-template-blank-typescript/snowpack.config.js | 1 + create-snowpack-app/app-template-blank/snowpack.config.js | 1 + .../app-template-lit-element-typescript/snowpack.config.js | 1 + .../app-template-lit-element/snowpack.config.js | 1 + create-snowpack-app/app-template-minimal/snowpack.config.js | 1 + .../app-template-preact-typescript/snowpack.config.js | 1 + create-snowpack-app/app-template-preact/snowpack.config.js | 1 + .../app-template-react-typescript/snowpack.config.js | 1 + create-snowpack-app/app-template-react/snowpack.config.js | 1 + .../app-template-svelte-typescript/snowpack.config.js | 1 + create-snowpack-app/app-template-svelte/snowpack.config.js | 1 + .../app-template-vue-typescript/snowpack.config.js | 1 + create-snowpack-app/app-template-vue/snowpack.config.js | 1 + .../__snapshots__/create-snowpack-app.test.js.snap | 3 ++- 15 files changed, 16 insertions(+), 1 deletion(-) diff --git a/create-snowpack-app/app-template-11ty/snowpack.config.js b/create-snowpack-app/app-template-11ty/snowpack.config.js index d721617eaf..2f18364923 100644 --- a/create-snowpack-app/app-template-11ty/snowpack.config.js +++ b/create-snowpack-app/app-template-11ty/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { _output: '/', diff --git a/create-snowpack-app/app-template-blank-typescript/snowpack.config.js b/create-snowpack-app/app-template-blank-typescript/snowpack.config.js index 24da985930..5de35aa41b 100644 --- a/create-snowpack-app/app-template-blank-typescript/snowpack.config.js +++ b/create-snowpack-app/app-template-blank-typescript/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-blank/snowpack.config.js b/create-snowpack-app/app-template-blank/snowpack.config.js index 55aea8aff7..49526ee086 100644 --- a/create-snowpack-app/app-template-blank/snowpack.config.js +++ b/create-snowpack-app/app-template-blank/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.js b/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.js index bd630a492c..812f5a01d6 100644 --- a/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.js +++ b/create-snowpack-app/app-template-lit-element-typescript/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-lit-element/snowpack.config.js b/create-snowpack-app/app-template-lit-element/snowpack.config.js index acb4e2fb8a..be648b0143 100644 --- a/create-snowpack-app/app-template-lit-element/snowpack.config.js +++ b/create-snowpack-app/app-template-lit-element/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-minimal/snowpack.config.js b/create-snowpack-app/app-template-minimal/snowpack.config.js index 2c3042853e..9c6336b304 100644 --- a/create-snowpack-app/app-template-minimal/snowpack.config.js +++ b/create-snowpack-app/app-template-minimal/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { /* ... */ diff --git a/create-snowpack-app/app-template-preact-typescript/snowpack.config.js b/create-snowpack-app/app-template-preact-typescript/snowpack.config.js index 4600f8d238..0a3799f66d 100644 --- a/create-snowpack-app/app-template-preact-typescript/snowpack.config.js +++ b/create-snowpack-app/app-template-preact-typescript/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-preact/snowpack.config.js b/create-snowpack-app/app-template-preact/snowpack.config.js index e010aab7dd..409566ee27 100644 --- a/create-snowpack-app/app-template-preact/snowpack.config.js +++ b/create-snowpack-app/app-template-preact/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-react-typescript/snowpack.config.js b/create-snowpack-app/app-template-react-typescript/snowpack.config.js index a603949874..796a492f1d 100644 --- a/create-snowpack-app/app-template-react-typescript/snowpack.config.js +++ b/create-snowpack-app/app-template-react-typescript/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-react/snowpack.config.js b/create-snowpack-app/app-template-react/snowpack.config.js index 2cd13d2814..426315b638 100644 --- a/create-snowpack-app/app-template-react/snowpack.config.js +++ b/create-snowpack-app/app-template-react/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-svelte-typescript/snowpack.config.js b/create-snowpack-app/app-template-svelte-typescript/snowpack.config.js index 25f066f96c..8c27b7053c 100644 --- a/create-snowpack-app/app-template-svelte-typescript/snowpack.config.js +++ b/create-snowpack-app/app-template-svelte-typescript/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-svelte/snowpack.config.js b/create-snowpack-app/app-template-svelte/snowpack.config.js index 0951fe842b..41a243768d 100644 --- a/create-snowpack-app/app-template-svelte/snowpack.config.js +++ b/create-snowpack-app/app-template-svelte/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-vue-typescript/snowpack.config.js b/create-snowpack-app/app-template-vue-typescript/snowpack.config.js index e76de5c0f0..8659af095c 100644 --- a/create-snowpack-app/app-template-vue-typescript/snowpack.config.js +++ b/create-snowpack-app/app-template-vue-typescript/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/create-snowpack-app/app-template-vue/snowpack.config.js b/create-snowpack-app/app-template-vue/snowpack.config.js index 89a114a71f..2e8d80754c 100644 --- a/create-snowpack-app/app-template-vue/snowpack.config.js +++ b/create-snowpack-app/app-template-vue/snowpack.config.js @@ -1,3 +1,4 @@ +/** @type {import("snowpack").SnowpackUserConfig } */ module.exports = { mount: { public: '/', diff --git a/test/create-snowpack-app/__snapshots__/create-snowpack-app.test.js.snap b/test/create-snowpack-app/__snapshots__/create-snowpack-app.test.js.snap index 75ea5f4a6f..dddbc6bb24 100644 --- a/test/create-snowpack-app/__snapshots__/create-snowpack-app.test.js.snap +++ b/test/create-snowpack-app/__snapshots__/create-snowpack-app.test.js.snap @@ -7384,7 +7384,8 @@ exports[`create-snowpack-app app-template-minimal > build: package.json 1`] = ` `; exports[`create-snowpack-app app-template-minimal > build: snowpack.config.js 1`] = ` -"module.exports = { +"/** @type {import(\\"snowpack\\").SnowpackUserConfig } */ +module.exports = { mount: { }, plugins: [