Skip to content

Commit d8e0dc9

Browse files
committed
refactor: add eslint job and yarn script
1 parent 3028e8e commit d8e0dc9

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

.github/workflows/build.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,53 @@ jobs:
108108
if: failure()
109109
uses: andymckay/cancel-action@0.2
110110

111+
lint-ts:
112+
name: Lint TypeScript files
113+
runs-on: ubuntu-latest
114+
timeout-minutes: 5
115+
steps:
116+
- name: Checkout repo
117+
uses: actions/checkout@v3
118+
119+
- name: Get changed files
120+
id: changed-files
121+
uses: tj-actions/changed-files@v23.2
122+
with:
123+
files: |
124+
**.ts
125+
**.tsx
126+
**.js
127+
files_ignore: |
128+
lib/vscode
129+
130+
- name: Install Node.js v16
131+
if: steps.changed-files.outputs.any_changed == 'true'
132+
uses: actions/setup-node@v3
133+
with:
134+
node-version: "16"
135+
136+
- name: Fetch dependencies from cache
137+
if: steps.changed-files.outputs.any_changed == 'true'
138+
id: cache-yarn
139+
uses: actions/cache@v3
140+
with:
141+
path: "node_modules"
142+
key: yarn-build-${{ hashFiles('yarn.lock') }}
143+
restore-keys: |
144+
yarn-build-
145+
146+
- name: Install dependencies
147+
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-yarn.outputs.cache-hit != 'true'
148+
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
149+
150+
- name: Lint TypeScript files
151+
if: steps.changed-files.outputs.any_changed == 'true'
152+
run: yarn lint:ts
153+
154+
- name: Fail workflow
155+
if: failure()
156+
uses: andymckay/cancel-action@0.2
157+
111158
lint-helm:
112159
name: Lint Helm chart
113160
runs-on: ubuntu-latest

ci/dev/lint.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ set -euo pipefail
44
main() {
55
cd "$(dirname "$0")/../.."
66

7-
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "lib/vscode")
87
tsc --noEmit --skipLibCheck
98

109
cd "$OLDPWD"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"lint": "./ci/dev/lint.sh",
3030
"lint:helm": "./ci/dedv/helm.sh",
3131
"lint:sh": "shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files '*.sh' | grep -v 'lib/vscode')",
32+
"lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.tsx' '*.js' | grep -v 'lib/vscode')",
3233
"test": "echo 'Run yarn test:unit or yarn test:e2e' && exit 1",
3334
"ci": "./ci/dev/ci.sh",
3435
"watch": "VSCODE_DEV=1 VSCODE_IPC_HOOK_CLI= NODE_OPTIONS='--max_old_space_size=32384 --trace-warnings' ts-node ./ci/dev/watch.ts",

0 commit comments

Comments
 (0)