Devops/reviewdog typescript (#25)
* Use reviewdog for TSC * Replace all `type Readonly<T>` with `interface T` * Use --frozen-lockfile for yarn * Give all actions a name * Fix yarn example
This commit is contained in:
parent
4e5a79fbde
commit
f051481010
7
.github/workflows/build-docs.yml
vendored
7
.github/workflows/build-docs.yml
vendored
@ -52,9 +52,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: '12.x'
|
|
||||||
- name: Add key to allow access to repository
|
- name: Add key to allow access to repository
|
||||||
env:
|
env:
|
||||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||||
@ -72,7 +70,8 @@ jobs:
|
|||||||
- name: Get yarn cache directory path
|
- name: Get yarn cache directory path
|
||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
- uses: actions/cache@v2
|
- name: Restore node_modules from cache
|
||||||
|
uses: actions/cache@v2
|
||||||
id: yarn-cache
|
id: yarn-cache
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
30
.github/workflows/validate-android.yml
vendored
30
.github/workflows/validate-android.yml
vendored
@ -27,11 +27,35 @@ jobs:
|
|||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
- name: Setup node_modules
|
|
||||||
run: yarn --cwd ..
|
- name: Get yarn cache directory path
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
|
- name: Restore node_modules from cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: yarn-cache
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-yarn-
|
||||||
|
- name: Install node_modules
|
||||||
|
run: yarn install --frozen-lockfile --cwd ..
|
||||||
|
|
||||||
|
- name: Restore Gradle cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-gradle-
|
||||||
- name: Run Gradle Lint
|
- name: Run Gradle Lint
|
||||||
run: ./gradlew lint
|
run: ./gradlew lint
|
||||||
- uses: yutailang0119/action-android-lint@v1.0.2
|
|
||||||
|
- name: Parse Gradle Lint Report
|
||||||
|
uses: yutailang0119/action-android-lint@v1.0.2
|
||||||
with:
|
with:
|
||||||
xml_path: android/build/reports/lint-results.xml
|
xml_path: android/build/reports/lint-results.xml
|
||||||
ktlint:
|
ktlint:
|
||||||
|
23
.github/workflows/validate-js.yml
vendored
23
.github/workflows/validate-js.yml
vendored
@ -33,10 +33,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install reviewdog
|
||||||
|
uses: reviewdog/action-setup@v1
|
||||||
|
|
||||||
- name: Get yarn cache directory path
|
- name: Get yarn cache directory path
|
||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
- uses: actions/cache@v2
|
- name: Restore node_modules from cache
|
||||||
|
uses: actions/cache@v2
|
||||||
id: yarn-cache
|
id: yarn-cache
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
@ -44,13 +48,18 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-yarn-
|
${{ runner.os }}-yarn-
|
||||||
|
|
||||||
- name: Install modules
|
- name: Install node_modules
|
||||||
run: yarn
|
run: yarn install --frozen-lockfile
|
||||||
- name: Install modules (example/)
|
- name: Install node_modules (example/)
|
||||||
run: yarn example
|
run: yarn install --frozen-lockfile --cwd example
|
||||||
|
|
||||||
- name: Run TypeScript
|
- name: Run TypeScript
|
||||||
run: yarn typescript
|
run: yarn typescript | reviewdog -f=tsc -reporter=github-pr-review
|
||||||
|
env:
|
||||||
|
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Run ESLint
|
- name: Run ESLint
|
||||||
run: yarn lint-ci
|
uses: reviewdog/action-eslint@v1
|
||||||
|
with:
|
||||||
|
reporter: github-pr-review
|
||||||
|
eslint_flags: '--ext .js,.ts,.jsx,.tsx src'
|
||||||
|
@ -66,7 +66,6 @@
|
|||||||
"registry": "https://registry.npmjs.org/"
|
"registry": "https://registry.npmjs.org/"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@firmnav/eslint-github-actions-formatter": "^1.0.1",
|
|
||||||
"@react-native-community/eslint-config": "^2.0.0",
|
"@react-native-community/eslint-config": "^2.0.0",
|
||||||
"@react-native-community/eslint-plugin": "^1.1.0",
|
"@react-native-community/eslint-plugin": "^1.1.0",
|
||||||
"@release-it/conventional-changelog": "^2.0.0",
|
"@release-it/conventional-changelog": "^2.0.0",
|
||||||
|
@ -74,15 +74,15 @@ export type AutoFocusSystem = 'contrast-detection' | 'phase-detection' | 'none';
|
|||||||
*/
|
*/
|
||||||
export type VideoStabilizationMode = 'off' | 'standard' | 'cinematic' | 'cinematic-extended' | 'auto';
|
export type VideoStabilizationMode = 'off' | 'standard' | 'cinematic' | 'cinematic-extended' | 'auto';
|
||||||
|
|
||||||
export type FrameRateRange = Readonly<{
|
export interface FrameRateRange {
|
||||||
minFrameRate: number;
|
minFrameRate: number;
|
||||||
maxFrameRate: number;
|
maxFrameRate: number;
|
||||||
}>;
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Camera Device's video format. Do not create instances of this type yourself, only use `Camera.getAvailableCameraDevices(...)`.
|
* A Camera Device's video format. Do not create instances of this type yourself, only use `Camera.getAvailableCameraDevices(...)`.
|
||||||
*/
|
*/
|
||||||
export type CameraDeviceFormat = Readonly<{
|
export interface CameraDeviceFormat {
|
||||||
/**
|
/**
|
||||||
* The height of the highest resolution a still image (photo) can be produced in
|
* The height of the highest resolution a still image (photo) can be produced in
|
||||||
*/
|
*/
|
||||||
@ -151,12 +151,12 @@ export type CameraDeviceFormat = Readonly<{
|
|||||||
* All supported video stabilization modes
|
* All supported video stabilization modes
|
||||||
*/
|
*/
|
||||||
videoStabilizationModes: VideoStabilizationMode[];
|
videoStabilizationModes: VideoStabilizationMode[];
|
||||||
}>;
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a camera device discovered by the `Camera.getAvailableCameraDevices()` function
|
* Represents a camera device discovered by the `Camera.getAvailableCameraDevices()` function
|
||||||
*/
|
*/
|
||||||
export type CameraDevice = Readonly<{
|
export interface CameraDevice {
|
||||||
/**
|
/**
|
||||||
* The native ID of the camera device instance.
|
* The native ID of the camera device instance.
|
||||||
*/
|
*/
|
||||||
@ -230,4 +230,4 @@ export type CameraDevice = Readonly<{
|
|||||||
// * Whether this camera supports taking photos in RAW format
|
// * Whether this camera supports taking photos in RAW format
|
||||||
// */
|
// */
|
||||||
// supportsRawCapture: boolean;
|
// supportsRawCapture: boolean;
|
||||||
}>;
|
}
|
||||||
|
@ -24,7 +24,7 @@ export type CodeType =
|
|||||||
/**
|
/**
|
||||||
* Represents a Metadata Code read by the Camera. Example: QR Code
|
* Represents a Metadata Code read by the Camera. Example: QR Code
|
||||||
*/
|
*/
|
||||||
export type Code = Readonly<{
|
export interface Code {
|
||||||
/**
|
/**
|
||||||
* The decoded string representation of the code.
|
* The decoded string representation of the code.
|
||||||
*/
|
*/
|
||||||
@ -62,4 +62,4 @@ export type Code = Readonly<{
|
|||||||
*/
|
*/
|
||||||
height: number;
|
height: number;
|
||||||
};
|
};
|
||||||
}>;
|
}
|
||||||
|
132
src/PhotoFile.ts
132
src/PhotoFile.ts
@ -65,74 +65,72 @@ export interface TakePhotoOptions {
|
|||||||
/**
|
/**
|
||||||
* Represents a Photo taken by the Camera written to the local filesystem.
|
* Represents a Photo taken by the Camera written to the local filesystem.
|
||||||
*/
|
*/
|
||||||
export type PhotoFile = Readonly<
|
export interface PhotoFile extends TemporaryFile {
|
||||||
TemporaryFile & {
|
width: number;
|
||||||
width: number;
|
height: number;
|
||||||
height: number;
|
isRawPhoto: boolean;
|
||||||
isRawPhoto: boolean;
|
thumbnail?: Record<string, unknown>;
|
||||||
thumbnail?: Record<string, unknown>;
|
metadata: {
|
||||||
metadata: {
|
Orientation: number;
|
||||||
Orientation: number;
|
/**
|
||||||
|
* @platform iOS
|
||||||
|
*/
|
||||||
|
DPIHeight: number;
|
||||||
|
/**
|
||||||
|
* @platform iOS
|
||||||
|
*/
|
||||||
|
DPIWidth: number;
|
||||||
|
/**
|
||||||
|
* Represents any data Apple cameras write to the metadata
|
||||||
|
*
|
||||||
|
* @platform iOS
|
||||||
|
*/
|
||||||
|
'{MakerApple}'?: Record<string, unknown>;
|
||||||
|
'{TIFF}': {
|
||||||
|
ResolutionUnit: number;
|
||||||
|
Software: string;
|
||||||
|
Make: string;
|
||||||
|
DateTime: string;
|
||||||
|
XResolution: number;
|
||||||
/**
|
/**
|
||||||
* @platform iOS
|
* @platform iOS
|
||||||
*/
|
*/
|
||||||
DPIHeight: number;
|
HostComputer?: string;
|
||||||
/**
|
Model: string;
|
||||||
* @platform iOS
|
YResolution: number;
|
||||||
*/
|
|
||||||
DPIWidth: number;
|
|
||||||
/**
|
|
||||||
* Represents any data Apple cameras write to the metadata
|
|
||||||
*
|
|
||||||
* @platform iOS
|
|
||||||
*/
|
|
||||||
'{MakerApple}'?: Record<string, unknown>;
|
|
||||||
'{TIFF}': {
|
|
||||||
ResolutionUnit: number;
|
|
||||||
Software: string;
|
|
||||||
Make: string;
|
|
||||||
DateTime: string;
|
|
||||||
XResolution: number;
|
|
||||||
/**
|
|
||||||
* @platform iOS
|
|
||||||
*/
|
|
||||||
HostComputer?: string;
|
|
||||||
Model: string;
|
|
||||||
YResolution: number;
|
|
||||||
};
|
|
||||||
'{Exif}': {
|
|
||||||
DateTimeOriginal: string;
|
|
||||||
ExposureTime: number;
|
|
||||||
FNumber: number;
|
|
||||||
LensSpecification: number[];
|
|
||||||
ExposureBiasValue: number;
|
|
||||||
ColorSpace: number;
|
|
||||||
FocalLenIn35mmFilm: number;
|
|
||||||
BrightnessValue: number;
|
|
||||||
ExposureMode: number;
|
|
||||||
LensModel: string;
|
|
||||||
SceneType: number;
|
|
||||||
PixelXDimension: number;
|
|
||||||
ShutterSpeedValue: number;
|
|
||||||
SensingMethod: number;
|
|
||||||
SubjectArea: number[];
|
|
||||||
ApertureValue: number;
|
|
||||||
SubsecTimeDigitized: string;
|
|
||||||
FocalLength: number;
|
|
||||||
LensMake: string;
|
|
||||||
SubsecTimeOriginal: string;
|
|
||||||
OffsetTimeDigitized: string;
|
|
||||||
PixelYDimension: number;
|
|
||||||
ISOSpeedRatings: number[];
|
|
||||||
WhiteBalance: number;
|
|
||||||
DateTimeDigitized: string;
|
|
||||||
OffsetTimeOriginal: string;
|
|
||||||
ExifVersion: string;
|
|
||||||
OffsetTime: string;
|
|
||||||
Flash: number;
|
|
||||||
ExposureProgram: number;
|
|
||||||
MeteringMode: number;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
'{Exif}': {
|
||||||
>;
|
DateTimeOriginal: string;
|
||||||
|
ExposureTime: number;
|
||||||
|
FNumber: number;
|
||||||
|
LensSpecification: number[];
|
||||||
|
ExposureBiasValue: number;
|
||||||
|
ColorSpace: number;
|
||||||
|
FocalLenIn35mmFilm: number;
|
||||||
|
BrightnessValue: number;
|
||||||
|
ExposureMode: number;
|
||||||
|
LensModel: string;
|
||||||
|
SceneType: number;
|
||||||
|
PixelXDimension: number;
|
||||||
|
ShutterSpeedValue: number;
|
||||||
|
SensingMethod: number;
|
||||||
|
SubjectArea: number[];
|
||||||
|
ApertureValue: number;
|
||||||
|
SubsecTimeDigitized: string;
|
||||||
|
FocalLength: number;
|
||||||
|
LensMake: string;
|
||||||
|
SubsecTimeOriginal: string;
|
||||||
|
OffsetTimeDigitized: string;
|
||||||
|
PixelYDimension: number;
|
||||||
|
ISOSpeedRatings: number[];
|
||||||
|
WhiteBalance: number;
|
||||||
|
DateTimeDigitized: string;
|
||||||
|
OffsetTimeOriginal: string;
|
||||||
|
ExifVersion: string;
|
||||||
|
OffsetTime: string;
|
||||||
|
Flash: number;
|
||||||
|
ExposureProgram: number;
|
||||||
|
MeteringMode: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Represents a temporary file in the local filesystem.
|
* Represents a temporary file in the local filesystem.
|
||||||
*/
|
*/
|
||||||
export type TemporaryFile = Readonly<{
|
export interface TemporaryFile {
|
||||||
/**
|
/**
|
||||||
* The path of the file. This file might get deleted once the app closes because it lives in the temp directory.
|
* The path of the file. This file might get deleted once the app closes because it lives in the temp directory.
|
||||||
*/
|
*/
|
||||||
path: string;
|
path: string;
|
||||||
}>;
|
}
|
||||||
|
@ -47,15 +47,13 @@ export interface RecordVideoOptions {
|
|||||||
/**
|
/**
|
||||||
* Represents a Video taken by the Camera written to the local filesystem.
|
* Represents a Video taken by the Camera written to the local filesystem.
|
||||||
*/
|
*/
|
||||||
export type VideoFile = Readonly<
|
export interface VideoFile extends TemporaryFile {
|
||||||
TemporaryFile & {
|
/**
|
||||||
/**
|
* Represents the duration of the video, in seconds.
|
||||||
* Represents the duration of the video, in seconds.
|
*/
|
||||||
*/
|
duration: number;
|
||||||
duration: number;
|
/**
|
||||||
/**
|
* Represents the file size of the recorded Video File, in bytes.
|
||||||
* Represents the file size of the recorded Video File, in bytes.
|
*/
|
||||||
*/
|
size: number;
|
||||||
size: number;
|
}
|
||||||
}
|
|
||||||
>;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user