Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

[WIP] migrate from tslint to eslint #971

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config

It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.

We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md

Happy linting! 💖
*/
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: [
// order matters
"eslint:recommended",
"prettier",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:react/recommended",
"prettier/@typescript-eslint",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
sourceType: "module",
},
plugins: ["@typescript-eslint", "react"],
rules: {
// order does not matter
"@typescript-eslint/await-thenable": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-implied-eval": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/unbound-method": "off",
"no-async-promise-executor": "off",
"no-case-declarations": "off",
"no-useless-escape": "off",
"prefer-const": "off",
"prefer-spread": "off",
"react/no-find-dom-node": "off",
"react/prop-types": "off",
},
};
18,590 changes: 11,700 additions & 6,890 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@
"release-web": "npm run build && npm run webpack:prod",
"release-ci": "bash ./scripts/build.sh",
"release": "npm run build && npm run webpack:prod && electron-builder",
"pretest": "./node_modules/.bin/tslint 'src/**/*.ts*'",
"lintfix": "./node_modules/.bin/tslint 'src/**/*.ts*' --fix",
"pretest": "npm run lint",
"lint": "npx eslint 'src/**/*.ts*'",
"lint:fix": "npm run lint -- --fix",
"test": "react-scripts test --env=jsdom --silent",
"test:ci": "cross-env CI=true npm run test",
"test:coverage": "npm run test -- --coverage",
Expand Down Expand Up @@ -111,22 +112,30 @@
"@types/reactstrap": "^6.4.3",
"@types/redux-logger": "^3.0.6",
"@types/redux-mock-store": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^3.1.0",
"@typescript-eslint/parser": "^3.1.0",
"cross-env": "^5.2.0",
"electron": "^3.0.13",
"electron-builder": "^22.6.0",
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.7.0",
"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsdoc": "^26.0.1",
"eslint-plugin-prefer-arrow": "^1.2.1",
"eslint-plugin-react": "^7.20.0",
"foreman": "^3.0.1",
"jest-enzyme": "^7.0.1",
"jquery": "^3.3.1",
"node-sass": "^4.10.0",
"popper.js": "^1.14.6",
"prettier": "^2.0.5",
"redux-immutable-state-invariant": "^2.1.0",
"redux-logger": "^3.0.6",
"redux-mock-store": "^1.5.3",
"ts-loader": "^5.3.0",
"tslint": "^5.11.0",
"typescript": "^3.1.6",
"typescript": "^3.9.3",
"webpack": "^4.19.1",
"webpack-cli": "^3.1.2",
"webpack-merge": "^4.1.5"
Expand Down
2 changes: 1 addition & 1 deletion src/common/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Guard from "./guard";
* Generates a random base64 encoded key to be used for encryption
* @param keySize The key size to use, defaults to 32bit
*/
export function generateKey(keySize: number = 32): string {
export function generateKey(keySize = 32): string {
return lib.WordArray.random(keySize).toString(enc.Base64);
}

Expand Down
4 changes: 2 additions & 2 deletions src/common/extensions/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Guard from "../guard";
export async function forEachAsync<T>(
this: T[],
action: (item: T) => Promise<void>,
batchSize: number = 5): Promise<void> {
batchSize = 5): Promise<void> {
Guard.null(this);
Guard.null(action);
Guard.expression(batchSize, (value) => value > 0);
Expand Down Expand Up @@ -37,7 +37,7 @@ export async function forEachAsync<T>(
export async function mapAsync<T, R>(
this: T[],
action: (item: T) => Promise<R>,
batchSize: number = 5): Promise<R[]> {
batchSize = 5): Promise<R[]> {
Guard.null(this);
Guard.null(action);
Guard.expression(batchSize, (value) => value > 0);
Expand Down
2 changes: 1 addition & 1 deletion src/common/extensions/map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("Map Extensions", () => {
beforeAll(registerMixins);

describe("forEachAsync", () => {
const map = testArray.map((asset) => [asset.id, asset]) as Array<[string, IAsset]>;
const map = testArray.map((asset) => [asset.id, asset]);
const testMap = new Map<string, IAsset>(map);

const output = [];
Expand Down
2 changes: 1 addition & 1 deletion src/common/extensions/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Guard from "../guard";
export async function forEachAsync<K, V>(
this: Map<K, V>,
action: (value: V, key: K) => Promise<void>,
batchSize: number = 5): Promise<void> {
batchSize = 5): Promise<void> {
Guard.null(this);
Guard.null(action);
Guard.expression(batchSize, (value) => value > 0);
Expand Down
4 changes: 2 additions & 2 deletions src/common/htmlFileReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default class HtmlFileReader {

private static readVideoAttributes(url: string): Promise<{ width: number, height: number, duration: number }> {
return new Promise((resolve, reject) => {
const video = document.createElement("video") as HTMLVideoElement;
const video = document.createElement("video");
video.onloadedmetadata = () => {
resolve({
width: video.videoWidth,
Expand All @@ -164,7 +164,7 @@ export default class HtmlFileReader {

private static readImageAttributes(url: string): Promise<{ width: number, height: number }> {
return new Promise((resolve, reject) => {
const image = document.createElement("img") as HTMLImageElement;
const image = document.createElement("img");
image.onload = () => {
resolve({
width: image.naturalWidth,
Expand Down
2 changes: 1 addition & 1 deletion src/common/ipcRendererProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ export class IpcRendererProxy {
return deferred.promise;
}
private static ipcRenderer;
private static initialized: boolean = false;
private static initialized = false;
}
Loading