From c7742b84aaa77e64b4b1389a9a34ae3722d9b48c Mon Sep 17 00:00:00 2001 From: Charlie Guan Date: Mon, 27 May 2019 23:28:59 -0700 Subject: [PATCH 1/3] :heavy_plus_sign: Add typings-for-css-modules-loader --- package.json | 3 ++- yarn.lock | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d4d9efe..4138d8b 100644 --- a/package.json +++ b/package.json @@ -126,6 +126,7 @@ "jest-resolve": "23.6.0", "jest-watch-typeahead": "^0.2.1", "react-dev-utils": "^8.0.0", - "react-test-renderer": "^16.8.6" + "react-test-renderer": "^16.8.6", + "typings-for-css-modules-loader": "^1.7.0" } } diff --git a/yarn.lock b/yarn.lock index 527f4f3..3701755 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2041,6 +2041,11 @@ bfj@6.1.1: hoopy "^0.1.2" tryer "^1.0.0" +big.js@^3.1.3: + version "3.2.0" + resolved "https://registry.yarnpkg.com/big.js/-/big.js-3.2.0.tgz#a5fc298b81b9e0dca2e458824784b65c52ba588e" + integrity sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q== + big.js@^5.2.2: version "5.2.2" resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" @@ -2614,6 +2619,11 @@ color@^3.0.0: color-convert "^1.9.1" color-string "^1.5.2" +colour@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/colour/-/colour-0.7.1.tgz#9cb169917ec5d12c0736d3e8685746df1cadf778" + integrity sha1-nLFpkX7F0SwHNtPoaFdG3xyt93g= + combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -4560,6 +4570,11 @@ globule@^1.0.0: lodash "~4.17.10" minimatch "~3.0.2" +graceful-fs@4.1.4: + version "4.1.4" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.4.tgz#ef089d2880f033b011823ce5c8fae798da775dbd" + integrity sha1-7widKIDwM7ARgjzlyPrnmNp3Xb0= + graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.1.15" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.15.tgz#ffb703e1066e8a0eeaa4c8b80ba9253eeefbfb00" @@ -6044,6 +6059,11 @@ json3@^3.3.2: resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" integrity sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE= +json5@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + integrity sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE= + json5@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" @@ -6222,6 +6242,16 @@ loader-runner@^2.3.0: resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" integrity sha512-Jsmr89RcXGIwivFY21FcRrisYZfvLMTWx5kOLc+JTxtpBOG6xML0vzbc6SEQG2FO9/4Fc3wW4LVcB5DmGflaRw== +loader-utils@0.2.16: + version "0.2.16" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d" + integrity sha1-8IYyBm7YKCg13/iN+1JwR2Wt7m0= + dependencies: + big.js "^3.1.3" + emojis-list "^2.0.0" + json5 "^0.5.0" + object-assign "^4.0.1" + loader-utils@1.2.3, loader-utils@^1.0.1, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.2.3.tgz#1ff5dc6911c9f0a062531a4c04b609406108c2c7" @@ -10080,6 +10110,15 @@ typescript@^3.4.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" integrity sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw== +typings-for-css-modules-loader@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/typings-for-css-modules-loader/-/typings-for-css-modules-loader-1.7.0.tgz#a9b5c5a0e19b719d616edfc72855ab47dedd00ae" + integrity sha512-Mp7zDrcUmbUKl3JTLamTsMX+lntMotEm5I05j2RHB5EHb0WL1dAXlynpdlGR5Ye/QTvtL5w+RGB2jP32YoUpZw== + dependencies: + colour "0.7.1" + graceful-fs "4.1.4" + loader-utils "0.2.16" + ua-parser-js@^0.7.18: version "0.7.19" resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.19.tgz#94151be4c0a7fb1d001af7022fdaca4642659e4b" From 86c1f06d87e9e09cb656c4d74953e1a7e6557414 Mon Sep 17 00:00:00 2001 From: Charlie Guan Date: Mon, 27 May 2019 23:29:14 -0700 Subject: [PATCH 2/3] :sparkles: Resolve SCSS import issue by generating typings automatically --- .prettierignore | 2 ++ config/webpack.config.js | 3 ++- src/App.module.scss.d.ts | 1 + src/components/dialog/NewTaskDialog.module.scss.d.ts | 1 + src/components/task/Task.module.scss.d.ts | 4 ++++ src/components/task/TaskLane.module.scss.d.ts | 3 +++ src/components/topbar/Topbar.module.scss.d.ts | 3 +++ src/pages/Tasks.module.scss.d.ts | 1 + 8 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .prettierignore create mode 100644 src/App.module.scss.d.ts create mode 100644 src/components/dialog/NewTaskDialog.module.scss.d.ts create mode 100644 src/components/task/Task.module.scss.d.ts create mode 100644 src/components/task/TaskLane.module.scss.d.ts create mode 100644 src/components/topbar/Topbar.module.scss.d.ts create mode 100644 src/pages/Tasks.module.scss.d.ts diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..571c718 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +config/ +scripts/ diff --git a/config/webpack.config.js b/config/webpack.config.js index 5e96785..c8418cd 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -77,7 +77,7 @@ module.exports = function(webpackEnv) { ), }, { - loader: require.resolve('css-loader'), + loader: 'typings-for-css-modules-loader', options: cssOptions, }, { @@ -440,6 +440,7 @@ module.exports = function(webpackEnv) { importLoaders: 2, sourceMap: isEnvProduction && shouldUseSourceMap, modules: true, + namedExport: true, getLocalIdent: getCSSModuleLocalIdent, }, 'sass-loader' diff --git a/src/App.module.scss.d.ts b/src/App.module.scss.d.ts new file mode 100644 index 0000000..ca7f5b8 --- /dev/null +++ b/src/App.module.scss.d.ts @@ -0,0 +1 @@ +export const container: string; diff --git a/src/components/dialog/NewTaskDialog.module.scss.d.ts b/src/components/dialog/NewTaskDialog.module.scss.d.ts new file mode 100644 index 0000000..ce1e5a3 --- /dev/null +++ b/src/components/dialog/NewTaskDialog.module.scss.d.ts @@ -0,0 +1 @@ +export const title: string; diff --git a/src/components/task/Task.module.scss.d.ts b/src/components/task/Task.module.scss.d.ts new file mode 100644 index 0000000..15f3d67 --- /dev/null +++ b/src/components/task/Task.module.scss.d.ts @@ -0,0 +1,4 @@ +export const container: string; +export const title: string; +export const buttons: string; +export const deleteButton: string; diff --git a/src/components/task/TaskLane.module.scss.d.ts b/src/components/task/TaskLane.module.scss.d.ts new file mode 100644 index 0000000..ccc4c22 --- /dev/null +++ b/src/components/task/TaskLane.module.scss.d.ts @@ -0,0 +1,3 @@ +export const container: string; +export const title: string; +export const titleLeft: string; diff --git a/src/components/topbar/Topbar.module.scss.d.ts b/src/components/topbar/Topbar.module.scss.d.ts new file mode 100644 index 0000000..22fc129 --- /dev/null +++ b/src/components/topbar/Topbar.module.scss.d.ts @@ -0,0 +1,3 @@ +export const container: string; +export const leftContainer: string; +export const appIcon: string; diff --git a/src/pages/Tasks.module.scss.d.ts b/src/pages/Tasks.module.scss.d.ts new file mode 100644 index 0000000..ca7f5b8 --- /dev/null +++ b/src/pages/Tasks.module.scss.d.ts @@ -0,0 +1 @@ +export const container: string; From c3249210439bf0b77216c7a021ed1cbd0dc8301b Mon Sep 17 00:00:00 2001 From: Charlie Guan Date: Mon, 27 May 2019 23:33:23 -0700 Subject: [PATCH 3/3] :fire: Delete unneeded files --- src/empty.ts | 1 - src/global.d.ts | 4 ---- 2 files changed, 5 deletions(-) delete mode 100644 src/empty.ts delete mode 100644 src/global.d.ts diff --git a/src/empty.ts b/src/empty.ts deleted file mode 100644 index e2ca590..0000000 --- a/src/empty.ts +++ /dev/null @@ -1 +0,0 @@ -// Need this empty TypeScript file to satisfy TypeScript compiling. diff --git a/src/global.d.ts b/src/global.d.ts deleted file mode 100644 index 568458e..0000000 --- a/src/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module "*.scss" { - const content: { [className: string]: string }; - export = content; -}