Skip to content

Commit

Permalink
feat(eslint-plugin): move opinionated rules between configs (#595)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: both 'eslint-recommended' and 'recommended' have changed.
  • Loading branch information
borekb authored and JamesHenry committed Jul 24, 2019
1 parent e32c7ad commit 4893aec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
20 changes: 2 additions & 18 deletions packages/eslint-plugin/src/configs/eslint-recommended.ts
@@ -1,19 +1,12 @@
/**
* The goal of this ruleset is to update the eslint:recommended config to better
* suit Typescript. There are two main reasons to change the configuration:
* 1. The Typescript compiler natively checks some things that therefore don't
* need extra rules anymore.
* 2. Typescript allows for more modern Javascript code that can thus be
* enabled.
* This is a compatibility ruleset that disables rules from eslint:recommended
* which are already handled by TypeScript.
*/
export default {
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
/**
* 1. Disable things that are checked by Typescript
*/
//Checked by Typescript - ts(2378)
'getter-return': 'off',
// Checked by Typescript - ts(2300)
Expand All @@ -36,15 +29,6 @@ export default {
'no-dupe-class-members': 'off',
// This is already checked by Typescript.
'no-redeclare': 'off',
/**
* 2. Enable more ideomatic code
*/
// Typescript allows const and let instead of var.
'no-var': 'error',
'prefer-const': 'error',
// The spread operator/rest parameters should be prefered in Typescript.
'prefer-rest-params': 'error',
'prefer-spread': 'error',
},
},
],
Expand Down
4 changes: 4 additions & 0 deletions packages/eslint-plugin/src/configs/recommended.json
@@ -1,6 +1,10 @@
{
"extends": "./configs/base.json",
"rules": {
"no-var": "error",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/ban-types": "error",
Expand Down

0 comments on commit 4893aec

Please sign in to comment.