From 1fa0e6c8c15c1516d27f02d27a054fe730af2912 Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Fri, 2 Jul 2021 14:09:34 -0500 Subject: [PATCH] Disable consistent-return lint rule in TypeScript --- .eslintrc.js | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6a74860d8a5b..a3f4c9398e46 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,14 +15,6 @@ const rules = { }, ], - // Overrides recommended by typescript-eslint - // https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0 - '@typescript-eslint/no-redeclare': 'error', - '@typescript-eslint/no-shadow': 'error', - '@typescript-eslint/no-useless-constructor': ['error'], - 'no-shadow': 'off', - 'no-useless-constructor': 'off', - // prevents us from accidentally checking in exclusive tests (`.only`): 'mocha/no-exclusive-tests': 'error', @@ -35,9 +27,6 @@ const rules = { // useful for unused or internal fields 'no-underscore-dangle': 'off', - // useful for unused parameters - '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], - // though we have a logger, we still remap console to log to disk 'no-console': 'error', @@ -93,9 +82,6 @@ const rules = { 'jsx-a11y/label-has-associated-control': ['error', { assert: 'either' }], - // Upgrade from a warning - '@typescript-eslint/explicit-module-boundary-types': 'error', - 'no-restricted-syntax': [ 'error', { @@ -128,6 +114,27 @@ const rules = { curly: 'error', }; +const typescriptRules = { + ...rules, + + // Overrides recommended by typescript-eslint + // https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0 + '@typescript-eslint/no-redeclare': 'error', + '@typescript-eslint/no-shadow': 'error', + '@typescript-eslint/no-useless-constructor': ['error'], + 'no-shadow': 'off', + 'no-useless-constructor': 'off', + + // useful for unused parameters + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + + // Upgrade from a warning + '@typescript-eslint/explicit-module-boundary-types': 'error', + + // Already enforced by TypeScript + 'consistent-return': 'off', +}; + module.exports = { root: true, settings: { @@ -160,7 +167,7 @@ module.exports = { 'plugin:react/recommended', 'airbnb-typescript-prettier', ], - rules, + rules: typescriptRules, }, { files: ['sticker-creator/**/*.ts', 'sticker-creator/**/*.tsx'], @@ -180,12 +187,12 @@ module.exports = { 'plugin:react/recommended', 'airbnb-typescript-prettier', ], - rules, + rules: typescriptRules, }, { files: ['**/*.stories.tsx', 'ts/build/**', 'ts/test-*/**'], rules: { - ...rules, + ...typescriptRules, 'import/no-extraneous-dependencies': 'off', 'react/no-array-index-key': 'off', },