From b549e39cd245cc073db88df74d8e957f59d51c52 Mon Sep 17 00:00:00 2001 From: Krasimir Nedelchev Date: Fri, 24 May 2019 23:05:34 +0300 Subject: [PATCH] Extract TS specific rules to overrides MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🎉 eslint/eslint#11554 --- .eslintrc.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2943b94..514526b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,11 +19,19 @@ module.exports = { }, overrides: [ { - files: ['*.js'], + // TypeScript-specific rules + files: ['*.{ts,tsx}'], + extends: [ + 'plugin:@typescript-eslint/recommended', + 'prettier/@typescript-eslint', + ], rules: { - // This is a workaround for ESLint not supporting extending overrides - // See https://github.com/eslint/eslint/issues/8813 - '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/no-use-before-define': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/explicit-member-accessibility': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-empty-interface': 'off', }, }, { @@ -35,11 +43,9 @@ module.exports = { ], extends: [ 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', 'plugin:react/recommended', 'plugin:jsx-a11y/recommended', 'plugin:prettier/recommended', - 'prettier/@typescript-eslint', 'prettier/react', ], rules: { @@ -51,12 +57,6 @@ module.exports = { // Restricted globals rule 'no-restricted-globals': ['error'].concat(restrictedGlobals), // Disabled rules from presets - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/no-use-before-define': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/explicit-member-accessibility': 'off', - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-empty-interface': 'off', 'react/prop-types': 'off', 'no-console': 'off', // Other rules