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

Commit 8679088

Browse files
author
Vott
committed
[WIP] migrate from tslint to eslint
Create-react-app does not support installing eslint. We could turn off PREFLIGHT_CHECK, but that could hide other issues. Until this issue (facebook/create-react-app#5247) is addressed, will stick with tslint for now
1 parent 80add1a commit 8679088

34 files changed

+11982
-7038
lines changed

.eslintrc.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
3+
https://github.com/typescript-eslint/tslint-to-eslint-config
4+
5+
It represents the closest reasonable ESLint configuration to this
6+
project's original TSLint configuration.
7+
8+
We recommend eventually switching this configuration to extend from
9+
the recommended rulesets in typescript-eslint.
10+
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
11+
12+
Happy linting! 💖
13+
*/
14+
module.exports = {
15+
env: {
16+
browser: true,
17+
es6: true,
18+
node: true,
19+
},
20+
extends: [
21+
// order matters
22+
"eslint:recommended",
23+
"prettier",
24+
"plugin:@typescript-eslint/recommended",
25+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
26+
"plugin:react/recommended",
27+
"prettier/@typescript-eslint",
28+
],
29+
parser: "@typescript-eslint/parser",
30+
parserOptions: {
31+
project: "tsconfig.json",
32+
sourceType: "module",
33+
},
34+
plugins: ["@typescript-eslint", "react"],
35+
rules: {
36+
// order does not matter
37+
"@typescript-eslint/await-thenable": "off",
38+
"@typescript-eslint/ban-types": "off",
39+
"@typescript-eslint/explicit-module-boundary-types": "off",
40+
"@typescript-eslint/no-empty-function": "off",
41+
"@typescript-eslint/no-explicit-any": "off",
42+
"@typescript-eslint/no-floating-promises": "off",
43+
"@typescript-eslint/no-implied-eval": "off",
44+
"@typescript-eslint/no-misused-promises": "off",
45+
"@typescript-eslint/no-non-null-assertion": "off",
46+
"@typescript-eslint/no-unnecessary-type-assertion": "off",
47+
"@typescript-eslint/no-unsafe-assignment": "off",
48+
"@typescript-eslint/no-unsafe-call": "off",
49+
"@typescript-eslint/no-unsafe-member-access": "off",
50+
"@typescript-eslint/no-unsafe-return": "off",
51+
"@typescript-eslint/no-unused-vars": "off",
52+
"@typescript-eslint/no-var-requires": "off",
53+
"@typescript-eslint/prefer-regexp-exec": "off",
54+
"@typescript-eslint/require-await": "off",
55+
"@typescript-eslint/restrict-plus-operands": "off",
56+
"@typescript-eslint/restrict-template-expressions": "off",
57+
"@typescript-eslint/unbound-method": "off",
58+
"no-async-promise-executor": "off",
59+
"no-case-declarations": "off",
60+
"no-useless-escape": "off",
61+
"prefer-const": "off",
62+
"prefer-spread": "off",
63+
"react/no-find-dom-node": "off",
64+
"react/prop-types": "off",
65+
},
66+
};

package-lock.json

Lines changed: 11700 additions & 6890 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@
7676
"release-web": "npm run build && npm run webpack:prod",
7777
"release-ci": "bash ./scripts/build.sh",
7878
"release": "npm run build && npm run webpack:prod && electron-builder",
79-
"pretest": "./node_modules/.bin/tslint 'src/**/*.ts*'",
80-
"lintfix": "./node_modules/.bin/tslint 'src/**/*.ts*' --fix",
79+
"pretest": "npm run lint",
80+
"lint": "npx eslint 'src/**/*.ts*'",
81+
"lint:fix": "npm run lint -- --fix",
8182
"test": "react-scripts test --env=jsdom --silent",
8283
"test:ci": "cross-env CI=true npm run test",
8384
"test:coverage": "npm run test -- --coverage",
@@ -111,22 +112,30 @@
111112
"@types/reactstrap": "^6.4.3",
112113
"@types/redux-logger": "^3.0.6",
113114
"@types/redux-mock-store": "^1.0.0",
115+
"@typescript-eslint/eslint-plugin": "^3.1.0",
116+
"@typescript-eslint/parser": "^3.1.0",
114117
"cross-env": "^5.2.0",
115118
"electron": "^3.0.13",
116119
"electron-builder": "^22.6.0",
117120
"enzyme": "^3.7.0",
118121
"enzyme-adapter-react-16": "^1.7.0",
122+
"eslint": "^7.1.0",
123+
"eslint-config-prettier": "^6.11.0",
124+
"eslint-plugin-import": "^2.20.2",
125+
"eslint-plugin-jsdoc": "^26.0.1",
126+
"eslint-plugin-prefer-arrow": "^1.2.1",
127+
"eslint-plugin-react": "^7.20.0",
119128
"foreman": "^3.0.1",
120129
"jest-enzyme": "^7.0.1",
121130
"jquery": "^3.3.1",
122131
"node-sass": "^4.10.0",
123132
"popper.js": "^1.14.6",
133+
"prettier": "^2.0.5",
124134
"redux-immutable-state-invariant": "^2.1.0",
125135
"redux-logger": "^3.0.6",
126136
"redux-mock-store": "^1.5.3",
127137
"ts-loader": "^5.3.0",
128-
"tslint": "^5.11.0",
129-
"typescript": "^3.1.6",
138+
"typescript": "^3.9.3",
130139
"webpack": "^4.19.1",
131140
"webpack-cli": "^3.1.2",
132141
"webpack-merge": "^4.1.5"

src/common/crypto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Guard from "./guard";
55
* Generates a random base64 encoded key to be used for encryption
66
* @param keySize The key size to use, defaults to 32bit
77
*/
8-
export function generateKey(keySize: number = 32): string {
8+
export function generateKey(keySize = 32): string {
99
return lib.WordArray.random(keySize).toString(enc.Base64);
1010
}
1111

src/common/extensions/array.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Guard from "../guard";
99
export async function forEachAsync<T>(
1010
this: T[],
1111
action: (item: T) => Promise<void>,
12-
batchSize: number = 5): Promise<void> {
12+
batchSize = 5): Promise<void> {
1313
Guard.null(this);
1414
Guard.null(action);
1515
Guard.expression(batchSize, (value) => value > 0);
@@ -37,7 +37,7 @@ export async function forEachAsync<T>(
3737
export async function mapAsync<T, R>(
3838
this: T[],
3939
action: (item: T) => Promise<R>,
40-
batchSize: number = 5): Promise<R[]> {
40+
batchSize = 5): Promise<R[]> {
4141
Guard.null(this);
4242
Guard.null(action);
4343
Guard.expression(batchSize, (value) => value > 0);

src/common/extensions/map.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe("Map Extensions", () => {
99
beforeAll(registerMixins);
1010

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

1515
const output = [];

src/common/extensions/map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Guard from "../guard";
99
export async function forEachAsync<K, V>(
1010
this: Map<K, V>,
1111
action: (value: V, key: K) => Promise<void>,
12-
batchSize: number = 5): Promise<void> {
12+
batchSize = 5): Promise<void> {
1313
Guard.null(this);
1414
Guard.null(action);
1515
Guard.expression(batchSize, (value) => value > 0);

src/common/htmlFileReader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export default class HtmlFileReader {
149149

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

165165
private static readImageAttributes(url: string): Promise<{ width: number, height: number }> {
166166
return new Promise((resolve, reject) => {
167-
const image = document.createElement("img") as HTMLImageElement;
167+
const image = document.createElement("img");
168168
image.onload = () => {
169169
resolve({
170170
width: image.naturalWidth,

src/common/ipcRendererProxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ export class IpcRendererProxy {
4949
return deferred.promise;
5050
}
5151
private static ipcRenderer;
52-
private static initialized: boolean = false;
52+
private static initialized = false;
5353
}

0 commit comments

Comments
 (0)