forked from software-mansion/react-native-reanimated
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite examples to TS (software-mansion#1724)
## Description We want to transition smoothly into TS so we start by adding types to our examples so we can show how to use Reanimated. ### Things found while rewriting - `ExtrapolationExample` uses `interpolate` with an object as extrapolation type, it isn't typed - `useAnimatedGestureHandler` should take gesture handlers as T, not their event types - for discussion ## Changes - Added TS parser & new rules to Eslint config - Added `ts-check` yarn script - Added specific Eslint ignores to TS test file ## Test code and steps to reproduce N/A, Example app still works.
- Loading branch information
1 parent
46c8bc2
commit 35218c0
Showing
55 changed files
with
969 additions
and
293 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 |
---|---|---|
@@ -1,23 +1,38 @@ | ||
module.exports = { | ||
parser: 'babel-eslint', | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
'standard', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'prettier/flowtype', | ||
'prettier/react', | ||
'prettier/standard', | ||
'plugin:import/typescript', | ||
], | ||
plugins: ['react', 'react-native', 'import', 'jest'], | ||
plugins: ['react', 'react-native', 'import', 'jest', '@typescript-eslint'], | ||
env: { | ||
'react-native/react-native': true, | ||
'jest/globals': true, | ||
}, | ||
rules: { | ||
'import/no-unresolved': 2, | ||
'react/jsx-uses-vars': 2, | ||
'react/jsx-uses-react': 2, | ||
}, | ||
settings: { | ||
'import/core-modules': ['react-native-reanimated'], | ||
'import/resolver': { | ||
'babel-module': {}, | ||
}, | ||
}, | ||
rules: { | ||
'import/no-unresolved': 'error', | ||
'react/jsx-uses-vars': 'error', | ||
'react/jsx-uses-react': 'error', | ||
'no-use-before-define': 'off', | ||
'@typescript-eslint/no-use-before-define': 'off', // TODO consider enabling this (currently it reports styles defined at the bottom of the file) | ||
'@typescript-eslint/ban-ts-comment': [ | ||
'error', | ||
{ | ||
'ts-ignore': 'allow-with-description', | ||
'ts-expect-error': 'allow-with-description', | ||
}, | ||
], | ||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], | ||
}, | ||
}; |
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 |
---|---|---|
|
@@ -60,4 +60,4 @@ buck-out/ | |
|
||
# Expo | ||
/.expo | ||
/web-build | ||
/web-build |
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.