fix: Fix TypeScript relative imports (#358)

* fix: Fix TypeScript relative imports

* Decouple `example` from tsconfig

* fix ESLint config

* add lint-ci script

* move example running to workflow

* test ts

* test eslint

* test ts

* fix ESLint formatter

* Revert "fix ESLint formatter"

This reverts commit 21aca0dcdb54d4ce98b33d2b4f1decc18bc82e85.

* Revert "test ts"

This reverts commit becc346ad3d097b7d3570ebc8b5bf80390aadf87.

* Revert "test eslint"

This reverts commit 9c9f0b81bf3aa57188f550a34b2a8151e364f3b0.

* Revert "test ts"

This reverts commit 3cbe7200608910087b43e0d9cdae0917b0b4215e.
This commit is contained in:
Marc Rousavy
2021-08-16 10:45:41 +02:00
committed by GitHub
parent b5452ac406
commit a2293e858d
12 changed files with 56 additions and 18 deletions

16
example/.eslintrc.js Normal file
View File

@@ -0,0 +1,16 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
ignorePatterns: ['babel.config.js', 'metro.config.js', '.eslintrc.js', 'index.js'],
plugins: ['@typescript-eslint'],
extends: ['plugin:@typescript-eslint/recommended', '@react-native-community', '../.eslintrc.js'],
};

View File

@@ -9,7 +9,9 @@
"start": "react-native start",
"setup": "cd ios && bundle install",
"pods": "cd ios && bundle exec pod install",
"lint": "eslint ."
"lint": "eslint .",
"lint-ci": "yarn lint -f ../node_modules/@firmnav/eslint-github-actions-formatter/dist/formatter.js",
"typescript": "tsc --noEmit"
},
"dependencies": {
"@react-native-community/blur": "^3.6.0",

View File

@@ -1,6 +1,8 @@
/* global _WORKLET __example_plugin __example_plugin_swift */
/* global __example_plugin __example_plugin_swift */
import type { Frame } from 'react-native-vision-camera';
declare let _WORKLET: true | undefined;
export function examplePluginSwift(frame: Frame): string[] {
'worklet';
if (!_WORKLET) throw new Error('examplePluginSwift must be called from a frame processor!');

15
example/tsconfig.json Normal file
View File

@@ -0,0 +1,15 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"paths": {
"react-native-vision-camera": ["../src/index"]
},
},
"include": [
"src"
],
"exclude": [
"node_modules"
]
}