typescript: Do final cleanup of issues.

Using `import * as` import syntax causes some problem if the
module exports a class or function. Because the whole point of
star import is to import every property the module exports. It turns
out we have been using it incorrectly in many places which this commit
fixes.

Then we fix a linting error by adding a eslint disable rule to solve
it along with a TODO because the way we currently do it is wrong.

Finally, to conclude this cleanup, we merge all the .gitignore paths
into once now that we can.
This commit is contained in:
vsvipul
2019-06-28 00:47:13 +05:30
committed by Akash Nimare
parent 00a925e39e
commit e4ef0e195a
34 changed files with 195 additions and 174 deletions

View File

@@ -1,7 +1,7 @@
'use strict';
import path from 'path';
import { ipcRenderer, remote, WebviewTag, NativeImage } from 'electron';
import path = require('path');
import ConfigUtil = require('./utils/config-util.js');
const { Tray, Menu, nativeImage, BrowserWindow } = remote;
@@ -97,6 +97,11 @@ const renderNativeImage = function (arg: number): Promise<NativeImage> {
.then(() => renderCanvas(arg))
.then(canvas => {
const pngData = nativeImage.createFromDataURL(canvas.toDataURL('image/png')).toPNG();
// TODO: Fix the function to correctly use Promise correctly.
// the Promise.resolve().then(...) above is useless we should
// start with renderCanvas(arg).then
// eslint-disable-next-line promise/no-return-wrap
return Promise.resolve(nativeImage.createFromBuffer(pngData, {
scaleFactor: config.pixelRatio
}));