Skip to content

Commit

Permalink
update: run type check and lint on build
Browse files Browse the repository at this point in the history
  • Loading branch information
yamadashy committed May 20, 2020
1 parent ef0366a commit 8fa01a2
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 7 deletions.
45 changes: 45 additions & 0 deletions .yarnclean
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# test directories
__tests__
test
tests
powered-test

# asset directories
docs
doc
website
images
assets

# examples
example
examples

# code coverage directories
coverage
.nyc_output

# build scripts
Makefile
Gulpfile.js
Gruntfile.js

# configs
appveyor.yml
circle.yml
codeship-services.yml
codeship-steps.yml
wercker.yml
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.travis.yml

# misc
*.md
10 changes: 5 additions & 5 deletions app/scripts/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const GRID_BOTTOM_BAR_ID = 'grid-bottom-bar';
const EDITOR_CONTAINER_ID = 'docs-editor-container';

class SheetTabsMover {
waitRenderTabs() {
waitRenderTabs(): Promise<void> {
return new Promise((resolve) => {
const loopStartTime = Date.now();

const checkTabsLoop = () => {
const checkTabsLoop = (): void => {
if (document.getElementById(GRID_BOTTOM_BAR_ID)) {
resolve();
return;
Expand All @@ -19,21 +19,21 @@ class SheetTabsMover {
}

setTimeout(checkTabsLoop, 50);
}
};

checkTabsLoop();
});
}

moveToTop() {
moveToTop(): void {
const gridBottomBar = document.getElementById(GRID_BOTTOM_BAR_ID);
const editorContainer = document.getElementById(EDITOR_CONTAINER_ID);
gridBottomBar.style.zIndex = '0';
document.body.insertBefore(gridBottomBar, editorContainer);
}
}

(async () => {
(async (): Promise<void> => {
const sheetTabsMover = new SheetTabsMover();
await sheetTabsMover.waitRenderTabs();
sheetTabsMover.moveToTop();
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@typescript-eslint/parser": "^2.0.0",
"babel-loader": "^8.0.6",
"eslint": "^6.3.0",
"fork-ts-checker-webpack-plugin": "^4.1.4",
"typescript": "^3.7.5",
"webextension-toolbox": "^3.0.0",
"webpack-bundle-analyzer": "^3.4.1"
Expand Down
14 changes: 13 additions & 1 deletion webextension-toolbox-config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

const path = require('path');
const GlobEntriesPlugin = require('webpack-watched-glob-entries-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');

module.exports = {
webpack: (config, { dev, vendor }) => {
Expand All @@ -14,11 +17,20 @@ module.exports = {
path.resolve('app', '?(scripts)/*.{js,mjs,jsx,ts}')
]
);

// Loader
config.module.rules.push({
test: /\.ts$/,
loader: 'babel-loader',
loader: 'babel-loader?cacheDirectory',
});

// Runs typescript type checker on a separate process.
config.plugins.push(new ForkTsCheckerWebpackPlugin({
checkSyntacticErrors: true,
eslint: true,
tsconfig: path.resolve(__dirname, 'tsconfig.json')
}));

// BundleAnalyzer
config.plugins.push(new BundleAnalyzerPlugin({
openAnalyzer: false,
Expand Down
27 changes: 26 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
optionalDependencies:
chokidar "^2.1.8"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.8.3":
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e"
integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==
Expand Down Expand Up @@ -2690,6 +2690,19 @@ for-in@^1.0.2:
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=

fork-ts-checker-webpack-plugin@^4.1.4:
version "4.1.4"
resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-4.1.4.tgz#f0dc3ece19ec5b792d7b8ecd2a7f43509a5285ce"
integrity sha512-R0nTlZSyV0uCCzYe1kgR7Ve8mXyDvMm1pJwUFb6zzRVF5rTNb24G6gn2DFQy+W5aJYp2eq8aexpCOO+1SCyCSA==
dependencies:
"@babel/code-frame" "^7.5.5"
chalk "^2.4.1"
micromatch "^3.1.10"
minimatch "^3.0.4"
semver "^5.6.0"
tapable "^1.0.0"
worker-rpc "^0.1.0"

forwarded@~0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84"
Expand Down Expand Up @@ -3505,6 +3518,11 @@ methods@~1.1.2:
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=

microevent.ts@~0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/microevent.ts/-/microevent.ts-0.1.1.tgz#70b09b83f43df5172d0205a63025bce0f7357fa0"
integrity sha512-jo1OfR4TaEwd5HOrt5+tAZ9mqT4jmpNAusXtyfNzqVm9uiSYFZlKM1wYL4oU7azZW/PxQW53wM0S6OR1JHNa2g==

micromatch@^3.1.10, micromatch@^3.1.4:
version "3.1.10"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
Expand Down Expand Up @@ -5297,6 +5315,13 @@ worker-farm@^1.7.0:
dependencies:
errno "~0.1.7"

worker-rpc@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/worker-rpc/-/worker-rpc-0.1.1.tgz#cb565bd6d7071a8f16660686051e969ad32f54d5"
integrity sha512-P1WjMrUB3qgJNI9jfmpZ/htmBEjFh//6l/5y8SD9hg1Ef5zTTVVoRjTrTEzPrNBQvmhMxkoTsjOXN10GWU7aCg==
dependencies:
microevent.ts "~0.1.1"

wrap-ansi@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-3.0.1.tgz#288a04d87eda5c286e060dfe8f135ce8d007f8ba"
Expand Down

0 comments on commit 8fa01a2

Please sign in to comment.