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 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 }}

View File

@ -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:

View File

@ -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'

View File

@ -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",

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 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;
}>; }

View File

@ -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;
}; };
}>; }

View File

@ -65,8 +65,7 @@ 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;
@ -134,5 +133,4 @@ export type PhotoFile = Readonly<
MeteringMode: number; MeteringMode: number;
}; };
}; };
} }
>;

View File

@ -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;
}>; }

View File

@ -47,8 +47,7 @@ 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.
*/ */
@ -57,5 +56,4 @@ export type VideoFile = Readonly<
* 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;
} }
>;