Disable consistent-return lint rule in TypeScript

This commit is contained in:
Evan Hahn 2021-07-02 14:09:34 -05:00 committed by GitHub
parent 615ae1ccf7
commit 1fa0e6c8c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 17 deletions

View File

@ -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',
},