Skip to content

Commit

Permalink
Change linter from TSLint to ESlint
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
colinthornton committed Nov 19, 2019
1 parent f563fc7 commit c164919
Show file tree
Hide file tree
Showing 10 changed files with 907 additions and 120 deletions.
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended', // This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
rules: {
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
},
overrides: [
{
files: ['webpack.config.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
],
settings: {
react: {
version: 'detect',
},
},
};
4 changes: 4 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
singleQuote: true,
trailingComma: 'all',
};
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ Boilerplate starter for a React project using TypeScript, an amalgamation of the
- https://webpack.js.org/guides/getting-started/
- https://www.typescriptlang.org/docs/handbook/react-&-webpack.html

Includes recommended TSLint configuration and Prettier for formatting.
Includes recommended ESLint configuration and Prettier for formatting, mostly based on the following article:

- https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
version: '3'
services:
web:
build: .
Expand Down
Loading

0 comments on commit c164919

Please sign in to comment.