Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4893aec

Browse files
borekbJamesHenry
authored andcommitted
feat(eslint-plugin): move opinionated rules between configs (typescript-eslint#595)
BREAKING CHANGE: both 'eslint-recommended' and 'recommended' have changed.
1 parent e32c7ad commit 4893aec

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

packages/eslint-plugin/src/configs/eslint-recommended.ts

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
/**
2-
* The goal of this ruleset is to update the eslint:recommended config to better
3-
* suit Typescript. There are two main reasons to change the configuration:
4-
* 1. The Typescript compiler natively checks some things that therefore don't
5-
* need extra rules anymore.
6-
* 2. Typescript allows for more modern Javascript code that can thus be
7-
* enabled.
2+
* This is a compatibility ruleset that disables rules from eslint:recommended
3+
* which are already handled by TypeScript.
84
*/
95
export default {
106
overrides: [
117
{
128
files: ['*.ts', '*.tsx'],
139
rules: {
14-
/**
15-
* 1. Disable things that are checked by Typescript
16-
*/
1710
//Checked by Typescript - ts(2378)
1811
'getter-return': 'off',
1912
// Checked by Typescript - ts(2300)
@@ -36,15 +29,6 @@ export default {
3629
'no-dupe-class-members': 'off',
3730
// This is already checked by Typescript.
3831
'no-redeclare': 'off',
39-
/**
40-
* 2. Enable more ideomatic code
41-
*/
42-
// Typescript allows const and let instead of var.
43-
'no-var': 'error',
44-
'prefer-const': 'error',
45-
// The spread operator/rest parameters should be prefered in Typescript.
46-
'prefer-rest-params': 'error',
47-
'prefer-spread': 'error',
4832
},
4933
},
5034
],

packages/eslint-plugin/src/configs/recommended.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"extends": "./configs/base.json",
33
"rules": {
4+
"no-var": "error",
5+
"prefer-const": "error",
6+
"prefer-rest-params": "error",
7+
"prefer-spread": "error",
48
"@typescript-eslint/adjacent-overload-signatures": "error",
59
"@typescript-eslint/array-type": "error",
610
"@typescript-eslint/ban-types": "error",

0 commit comments

Comments
 (0)