This repository has been archived by the owner on Jul 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add workaround for facebook/create-react-app#9929
- Loading branch information
1 parent
53ccb62
commit 108a2cc
Showing
3 changed files
with
54 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const realConfig = { | ||
extends: [ | ||
'airbnb-typescript', | ||
'airbnb/hooks', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'prettier/react', | ||
'prettier/@typescript-eslint', | ||
], | ||
env: { | ||
node: true, | ||
browser: true, | ||
jest: true, | ||
}, | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
rules: { | ||
'@typescript-eslint/explicit-function-return-type': [ | ||
'error', | ||
{ allowExpressions: true, allowTypedFunctionExpressions: true }, | ||
], | ||
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '_' }], | ||
'@typescript-eslint/ban-types': 'off', | ||
'@typescript-eslint/naming-convention': 'off', | ||
'arrow-body-style': 'off', | ||
'no-underscore-dangle': 'off', | ||
'no-console': ['error', { allow: ['warn', 'error'] }], | ||
'react/no-unescaped-entities': 'off', | ||
'import/prefer-default-export': 'off', | ||
'import/no-default-export': 'error', | ||
'react/prop-types': 'off', | ||
'no-nested-ternary': 'off', | ||
}, | ||
}; | ||
|
||
const nopConfig = { | ||
/* | ||
This config is meant to do nothing. | ||
It exists because there's no good way to disable ESLint in Create React App: | ||
https://github.com/facebook/create-react-app/issues/9929 | ||
So the workaround here is to craft a config that does as little as possible, | ||
and then conditionally use it. | ||
*/ | ||
|
||
ignorePatterns: ['**/*.ts', '**/*.tsx', './*.js', 'config/*.js'], | ||
}; | ||
|
||
module.exports = process.env.DISABLE_ESLINT ? nopConfig : realConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters