Implemented strict mode for the project (broken tests, hundreds of @ts-ignore and new errors are included) [skip ci]

This commit is contained in:
ErickSkrauch
2020-01-17 23:37:52 +03:00
committed by SleepWalker
parent 10e8b77acf
commit 96049ad4ad
151 changed files with 2470 additions and 1869 deletions

View File

@@ -2,21 +2,22 @@
/* eslint-env node */
/* eslint-disable no-console */
const fs = require('fs');
const webpack = require('webpack');
const chalk = require('chalk');
import fs, { Stats } from 'fs';
import webpack, { MultiCompiler } from 'webpack';
import chalk from 'chalk';
const webpackConfig = require('../../webpack.dll.config');
import webpackConfig from './../../webpack.dll.config';
const compiler = webpack(webpackConfig);
// @ts-ignore
const compiler: MultiCompiler = webpack(webpackConfig);
Promise.all([
stat(`${__dirname}/../../yarn.lock`),
stat(`${__dirname}/../../dll/vendor.json`),
])
.then(stats => {
const lockFile = new Date(stats[0].mtime);
const dll = new Date(stats[1].mtime);
.then(([lockFileStats, dllFileStats]) => {
const lockFile = new Date(lockFileStats.mtime);
const dll = new Date(dllFileStats.mtime);
if (dll < lockFile) {
return Promise.reject({
@@ -41,7 +42,7 @@ Promise.all([
logResult(
chalk.green('Dll was successfully build in %s ms'),
stats.endTime - stats.startTime,
stats.endTime! - stats.startTime!,
);
resolve();
@@ -53,13 +54,13 @@ Promise.all([
process.exit(1);
});
function logResult(...args) {
function logResult(...args: any[]): void {
console.log('\n');
console.log(...args);
console.log('\n');
}
function stat(path) {
function stat(path: string): Promise<Stats> {
return new Promise((resolve, reject) => {
fs.stat(path, (err, stats) => {
err ? reject(err) : resolve(stats);

View File

@@ -21,5 +21,8 @@
"multi-progress": "^2.0.0",
"prompt": "^1.0.0",
"utility-types": "^3.10.0"
},
"devDependencies": {
"@types/webpack": "^4.41.12"
}
}