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:
Marc Rousavy 2021-03-08 17:51:47 +01:00 committed by GitHub
parent 4e5a79fbde
commit f051481010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 131 additions and 104 deletions

View File

@ -52,9 +52,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Add key to allow access to repository
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
@ -72,7 +70,8 @@ jobs:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
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
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}

View File

@ -27,11 +27,35 @@ jobs:
uses: actions/setup-java@v1
with:
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
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:
xml_path: android/build/reports/lint-results.xml
ktlint:

View File

@ -33,10 +33,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install reviewdog
uses: reviewdog/action-setup@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
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
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@ -44,13 +48,18 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: Install modules
run: yarn
- name: Install modules (example/)
run: yarn example
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example
- 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
run: yarn lint-ci
uses: reviewdog/action-eslint@v1
with:
reporter: github-pr-review
eslint_flags: '--ext .js,.ts,.jsx,.tsx src'

View File

@ -66,7 +66,6 @@
"registry": "https://registry.npmjs.org/"
},
"devDependencies": {
"@firmnav/eslint-github-actions-formatter": "^1.0.1",
"@react-native-community/eslint-config": "^2.0.0",
"@react-native-community/eslint-plugin": "^1.1.0",
"@release-it/conventional-changelog": "^2.0.0",

View File

@ -74,15 +74,15 @@ export type AutoFocusSystem = 'contrast-detection' | 'phase-detection' | 'none';
*/
export type VideoStabilizationMode = 'off' | 'standard' | 'cinematic' | 'cinematic-extended' | 'auto';
export type FrameRateRange = Readonly<{
export interface FrameRateRange {
minFrameRate: number;
maxFrameRate: number;
}>;
}
/**
* 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
*/
@ -151,12 +151,12 @@ export type CameraDeviceFormat = Readonly<{
* All supported video stabilization modes
*/
videoStabilizationModes: VideoStabilizationMode[];
}>;
}
/**
* 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.
*/
@ -230,4 +230,4 @@ export type CameraDevice = Readonly<{
// * Whether this camera supports taking photos in RAW format
// */
// supportsRawCapture: boolean;
}>;
}

View File

@ -24,7 +24,7 @@ export type CodeType =
/**
* 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.
*/
@ -62,4 +62,4 @@ export type Code = Readonly<{
*/
height: number;
};
}>;
}

View File

@ -65,74 +65,72 @@ export interface TakePhotoOptions {
/**
* Represents a Photo taken by the Camera written to the local filesystem.
*/
export type PhotoFile = Readonly<
TemporaryFile & {
width: number;
height: number;
isRawPhoto: boolean;
thumbnail?: Record<string, unknown>;
metadata: {
Orientation: number;
export interface PhotoFile extends TemporaryFile {
width: number;
height: number;
isRawPhoto: boolean;
thumbnail?: Record<string, unknown>;
metadata: {
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
*/
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
*/
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;
};
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;
};
};
}

View File

@ -1,9 +1,9 @@
/**
* 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.
*/
path: string;
}>;
}

View File

@ -47,15 +47,13 @@ export interface RecordVideoOptions {
/**
* Represents a Video taken by the Camera written to the local filesystem.
*/
export type VideoFile = Readonly<
TemporaryFile & {
/**
* Represents the duration of the video, in seconds.
*/
duration: number;
/**
* Represents the file size of the recorded Video File, in bytes.
*/
size: number;
}
>;
export interface VideoFile extends TemporaryFile {
/**
* Represents the duration of the video, in seconds.
*/
duration: number;
/**
* Represents the file size of the recorded Video File, in bytes.
*/
size: number;
}