Skip to content

Commit 0923ff2

Browse files
authored
chore(dev): replace deprecated TSLint with ESLint + Prettier (PR #1374 Fixes #625 )
Many small individual changes, but merge conflicts (if any) should be easy to resolve in PRs and forks. Note: Prettier formatting is NOT applied for the time being, as this would greatly disrupt the codebase (causing significant code conflicts).
1 parent e813ccc commit 0923ff2

File tree

180 files changed

+1299
-458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+1299
-458
lines changed

.eslintignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.vscode/*
2+
.history/*
3+
.github/*
4+
.git/*
5+
dist/*
6+
docs/*
7+
img/*
8+
node_modules/*
9+
resources/*
10+
external-assets/*
11+
scripts/*
12+
src/typings/*
13+
src/resources/*
14+
src/renderer/assets/*
15+
src/renderer/reader/pdf/*

.eslintrc.js

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
module.exports = {
2+
parser: "@typescript-eslint/parser",
3+
env: {
4+
node: true,
5+
browser: true,
6+
es6: true,
7+
es2020: true,
8+
},
9+
parserOptions: {
10+
ecmaVersion: 2020,
11+
sourceType: "module",
12+
ecmaFeatures: {
13+
jsx: true,
14+
},
15+
},
16+
settings: {
17+
react: {
18+
version: "detect",
19+
},
20+
},
21+
extends: [
22+
"plugin:react/recommended",
23+
"plugin:@typescript-eslint/recommended",
24+
"prettier/@typescript-eslint",
25+
"plugin:prettier/recommended",
26+
],
27+
plugins: ["unused-imports", "prettier"],
28+
rules: {
29+
quotes: ["error", "double"],
30+
"comma-dangle": ["error", "always-multiline"],
31+
"eol-last": ["error", "always"],
32+
semi: ["error", "always"],
33+
34+
"no-unused-vars": 0,
35+
"@typescript-eslint/no-unused-vars": 0,
36+
// "@typescript-eslint/no-unused-vars": [
37+
// "error",
38+
// {
39+
// vars: "all",
40+
// args: "all",
41+
// argsIgnorePattern: "^_",
42+
// varsIgnorePattern: "^_",
43+
// caughtErrorsIgnorePattern: "^_",
44+
// caughtErrors: "all",
45+
// },
46+
// ],
47+
"unused-imports/no-unused-imports": "error",
48+
"unused-imports/no-unused-vars": [
49+
"error",
50+
{
51+
vars: "all",
52+
args: "all",
53+
argsIgnorePattern: "^_",
54+
varsIgnorePattern: "^_",
55+
caughtErrorsIgnorePattern: "^_",
56+
caughtErrors: "all",
57+
},
58+
],
59+
60+
// react/jsx-uses-react
61+
// react/jsx-uses-vars
62+
63+
// TODO?
64+
"react/prop-types": 0,
65+
66+
// TODO! (deprecated and fobidden in strict mode)
67+
"react/no-find-dom-node": 0,
68+
69+
// TODO ({} used as anonymous / generic object type)
70+
"@typescript-eslint/ban-types": 0,
71+
72+
// TODO (many any!!)
73+
"@typescript-eslint/no-explicit-any": 0,
74+
75+
// TODO (missing return types on functions)
76+
"@typescript-eslint/explicit-module-boundary-types": 0,
77+
// "@typescript-eslint/explicit-module-boundary-types": [
78+
// "error",
79+
// {
80+
// allowArgumentsExplicitlyTypedAsAny: true,
81+
// allowDirectConstAssertionInArrowFunctions: true,
82+
// allowedNames: [],
83+
// allowHigherOrderFunctions: true,
84+
// allowTypedFunctionExpressions: true,
85+
// },
86+
// ],
87+
88+
// "@typescript-eslint/explicit-function-return-type": 0,
89+
// "@typescript-eslint/explicit-function-return-type": [
90+
// "error",
91+
// {
92+
// allowExpressions: true,
93+
// allowTypedFunctionExpressions: true,
94+
// },
95+
// ],
96+
97+
"prettier/prettier": "error",
98+
},
99+
// overrides: [
100+
// {
101+
// files: ["*.ts", "*.tsx"],
102+
// rules: {
103+
// "@typescript-eslint/explicit-function-return-type": [
104+
// "error",
105+
// {
106+
// allowExpressions: true,
107+
// },
108+
// ],
109+
// },
110+
// },
111+
// ],
112+
};

.prettierignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.vscode/*
2+
.history/*
3+
.github/*
4+
.git/*
5+
dist/*
6+
docs/*
7+
img/*
8+
node_modules/*
9+
resources/*
10+
external-assets/*
11+
scripts/*
12+
src/typings/*
13+
src/resources/*
14+
src/renderer/assets/*
15+
src/renderer/reader/pdf/*
16+
17+
src/*

.prettierrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
semi: true,
3+
trailingComma: "all",
4+
singleQuote: false,
5+
printWidth: 120,
6+
tabWidth: 4,
7+
};

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"typescript.surveys.enabled": false,
1919
"editor.tabSize": 4,
2020
"editor.insertSpaces": true,
21-
"tslint.jsEnable": false,
2221
"typescript.extension.sortImports.quoteStyle": "double",
2322
"importSorter.importStringConfiguration.quoteMark": "double",
2423
"importSorter.importStringConfiguration.trailingComma": "multiLine",

0 commit comments

Comments
 (0)