Skip to content

Commit c164919

Browse files
committed
Change linter from TSLint to ESlint
microsoft/TypeScript#29288 (comment) According to the official TypeScript roadmap from Microsoft, the team is focusing on ESLint over TSLint due to better performance. I also added the `singleQuote` and `trailingComma` rules to the Prettier configuration, mainly due to personal preference.
1 parent f563fc7 commit c164919

10 files changed

+907
-120
lines changed

.eslintrc.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
extends: [
4+
'plugin:react/recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
'prettier/@typescript-eslint',
7+
'plugin:prettier/recommended', // This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
8+
],
9+
parserOptions: {
10+
ecmaVersion: 2018,
11+
sourceType: 'module',
12+
ecmaFeatures: {
13+
jsx: true,
14+
},
15+
},
16+
rules: {
17+
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
18+
},
19+
overrides: [
20+
{
21+
files: ['webpack.config.js'],
22+
rules: {
23+
'@typescript-eslint/no-var-requires': 'off',
24+
},
25+
},
26+
],
27+
settings: {
28+
react: {
29+
version: 'detect',
30+
},
31+
},
32+
};

.prettierrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
singleQuote: true,
3+
trailingComma: 'all',
4+
};

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ Boilerplate starter for a React project using TypeScript, an amalgamation of the
55
- https://webpack.js.org/guides/getting-started/
66
- https://www.typescriptlang.org/docs/handbook/react-&-webpack.html
77

8-
Includes recommended TSLint configuration and Prettier for formatting.
8+
Includes recommended ESLint configuration and Prettier for formatting, mostly based on the following article:
9+
10+
- https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "3"
1+
version: '3'
22
services:
33
web:
44
build: .

0 commit comments

Comments
 (0)