forked from react-native-webview/react-native-webview
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typescript): Source code rewrite using typescript (react-native-…
…webview#425) Rewrote the whole repository into typescript. This will provide way better and up to date documentation. This should also add some safety for people contributing 😄 . Flow types were not working until now which is why this PR doesn't have them but feel free to PR. This also fixes react-native-webview#384 react-native-webview#435 react-native-webview#206 react-native-webview#171 react-native-webview#168.
- Loading branch information
Showing
24 changed files
with
2,799 additions
and
2,187 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 |
---|---|---|
|
@@ -35,7 +35,7 @@ jobs: | |
|
||
- run: | ||
name: Run Tests | ||
command: yarn ci:test | ||
command: yarn ci | ||
|
||
publish: | ||
<<: *defaults | ||
|
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 @@ | ||
lib/ |
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,75 @@ | ||
module.exports = { | ||
// Airbnb is the base, prettier is here so that eslint doesn't conflict with prettier | ||
extends: ['airbnb', 'prettier', 'prettier/react'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react', 'react-native', 'import', '@typescript-eslint'], | ||
rules: { | ||
'no-console': 'off', | ||
// Lines will be broken before binary operators | ||
'operator-linebreak': ['error', 'before'], | ||
// Allow imports from dev and peer dependencies | ||
'import/no-extraneous-dependencies': [ | ||
'error', | ||
{ devDependencies: true, peerDependencies: true }, | ||
], | ||
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }], | ||
// This rule doesn't play nice with Prettier | ||
'react/jsx-one-expression-per-line': 'off', | ||
// This rule doesn't play nice with Prettier | ||
'react/jsx-wrap-multilines': 'off', | ||
// Remove this rule because we only destructure props, but never state | ||
'react/destructuring-assignment': 'off', | ||
'react/prop-types': 'off', | ||
'@typescript-eslint/adjacent-overload-signatures': 'error', | ||
'@typescript-eslint/array-type': ['error', 'array'], | ||
'@typescript-eslint/generic-type-naming': ['error', '^[a-zA-Z]+$'], | ||
'@typescript-eslint/no-angle-bracket-type-assertion': 'error', | ||
'@typescript-eslint/no-array-constructor': 'error', | ||
'@typescript-eslint/no-empty-interface': 'error', | ||
'@typescript-eslint/no-explicit-any': 'error', | ||
'@typescript-eslint/no-extraneous-class': 'error', | ||
'@typescript-eslint/no-inferrable-types': 'error', | ||
'@typescript-eslint/no-misused-new': 'error', | ||
'@typescript-eslint/no-namespace': 'error', | ||
'@typescript-eslint/no-non-null-assertion': 'error', | ||
'@typescript-eslint/no-object-literal-type-assertion': 'error', | ||
'@typescript-eslint/no-parameter-properties': 'error', | ||
'@typescript-eslint/no-this-alias': 'error', | ||
'@typescript-eslint/no-triple-slash-reference': 'error', | ||
'@typescript-eslint/no-type-alias': [ | ||
'error', | ||
{ | ||
allowAliases: 'always', | ||
allowCallbacks: 'always', | ||
allowMappedTypes: 'always', | ||
}, | ||
], | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ ignoreRestSiblings: true }, | ||
], | ||
'@typescript-eslint/prefer-interface': 'error', | ||
'@typescript-eslint/prefer-namespace-keyword': 'error', | ||
'@typescript-eslint/type-annotation-spacing': 'error', | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: [ | ||
'.js', | ||
'.android.js', | ||
'.ios.js', | ||
'.jsx', | ||
'.android.jsx', | ||
'.ios.jsx', | ||
'.tsx', | ||
'.ts', | ||
'.android.tsx', | ||
'.android.ts', | ||
'.ios.tsx', | ||
'.ios.ts', | ||
], | ||
}, | ||
}, | ||
}, | ||
}; |
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 |
---|---|---|
|
@@ -51,4 +51,6 @@ bundles/ | |
|
||
android/gradle | ||
android/gradlew | ||
android/gradlew.bat | ||
android/gradlew.bat | ||
|
||
lib/ |
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,10 @@ | ||
// https://prettier.io/docs/en/options.html | ||
|
||
module.exports = { | ||
// Enables semicolons at the end of statements | ||
semi: true, | ||
// Formats strings with single quotes ('') instead of quotes ("") | ||
singleQuote: true, | ||
// Adds a trailing comma at the end of all lists (including function arguments) | ||
trailingComma: 'all', | ||
}; |
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,9 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact" | ||
] | ||
} |
Oops, something went wrong.