-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: integrate
typescript-eslint-plugin
(#252)
## 馃摐 Description <!-- Describe your changes in detail --> added @typescript-eslint/eslint-plugin to support importing and exporting types with eslint to avoid adding some types file in the final build. Also, it would be useful to have a more strict eslint in the project 馃檪 . ## 馃挕 Motivation and Context <!-- Why is this change required? What problem does it solve? --> <!-- If it fixes an open issue, please link to the issue here. --> code base improvement ## 馃摙 Changelog - Created .eslintrc.cjs with eslint configuration. - Added @typescript-eslint/eslint-plugin, @typescript-eslint/parser and eslint-plugin-jest ## 馃 How Has This Been Tested? <!-- Please describe in detail how you tested your changes. --> <!-- Include details of your testing environment, and the tests you ran to --> <!-- see how your change affects other areas of the code, etc. --> Tested with the `yarn lint` command 馃檪 . ## 馃摑 Checklist - [x] CI successfully passed
- Loading branch information
1 parent
6586760
commit 235fc9d
Showing
17 changed files
with
676 additions
and
63 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,102 @@ | ||
module.exports = { | ||
root: true, | ||
plugins: ['@typescript-eslint', 'react', 'react-native', 'jest', 'import'], | ||
extends: [ | ||
'@react-native', | ||
'prettier', | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:jest/recommended', | ||
'plugin:import/typescript', | ||
], | ||
settings: { | ||
'import/parsers': { | ||
'@typescript-eslint/parser': ['.ts', '.tsx'], | ||
}, | ||
'import/resolver': { | ||
typescript: { | ||
alwaysTryTypes: true, | ||
project: '<root>/tsconfig.json', | ||
}, | ||
}, | ||
}, | ||
rules: { | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
quoteProps: 'consistent', | ||
singleQuote: true, | ||
tabWidth: 2, | ||
trailingComma: 'es5', | ||
useTabs: false, | ||
}, | ||
], | ||
// react | ||
'react-hooks/exhaustive-deps': 'warn', | ||
// typescript | ||
'@typescript-eslint/consistent-type-imports': [ | ||
'error', | ||
{ prefer: 'type-imports' }, | ||
], | ||
'@typescript-eslint/no-var-requires': 'warn', | ||
// import | ||
'sort-imports': [ | ||
'error', | ||
{ | ||
// sort destructure imports | ||
ignoreCase: false, | ||
ignoreDeclarationSort: true, | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ['none', 'all', 'single', 'multiple'], | ||
allowSeparatedGroups: true, | ||
}, | ||
], | ||
'import/order': [ | ||
'error', | ||
{ | ||
'groups': [ | ||
'builtin', | ||
'external', | ||
'internal', | ||
'parent', | ||
'sibling', | ||
'index', | ||
'type', | ||
], | ||
'alphabetize': { | ||
order: 'asc', | ||
caseInsensitive: true, | ||
}, | ||
'newlines-between': 'always', | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['src/specs/**'], | ||
rules: { | ||
'@typescript-eslint/ban-types': [ | ||
'error', | ||
{ | ||
extendDefaults: true, | ||
types: { | ||
'{}': false, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
env: { | ||
'react-native/react-native': true, | ||
'jest/globals': true, | ||
}, | ||
ignorePatterns: [ | ||
'node_modules/**', | ||
'lib/**', | ||
'example/**', | ||
'FabricExample/**', | ||
'docs/**', | ||
'scripts/**', | ||
], | ||
}; |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.