-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
116 lines (101 loc) · 3.54 KB
/
Copy pathtype-check.yml
File metadata and controls
116 lines (101 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: "Types: check published types"
on: [pull_request, push]
permissions:
contents: read
jobs:
test:
name: ESLint ${{ matrix.eslint_version }}, TS ${{ matrix.ts_version }}, "${{ matrix.ts_lib }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
eslint_version:
- '7'
- '8'
- '9'
ts_version:
# The official ESLint types are not compatible with TS 3.9
# - 3.9
- '4.0'
- 4.1
- 4.2
- 4.3
- 4.4
- 4.5
- '5.0'
- 5.5
- 5.6
ts_lib:
- es2015
- es2015,dom
- es2020
- esnext
exclude:
# ESLint 9 ships types via @eslint/core which requires TS >= 5.0
- eslint_version: '9'
ts_version: '4.0'
- eslint_version: '9'
ts_version: 4.1
- eslint_version: '9'
ts_version: 4.2
- eslint_version: '9'
ts_version: 4.3
- eslint_version: '9'
ts_version: 4.4
- eslint_version: '9'
ts_version: 4.5
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
show-progress: false
- uses: ljharb/actions/node/install@main
name: 'nvm install lts/* && npm install'
with:
node-version: 'lts/*'
skip-ls-check: true
- name: select eslint types
run: |
if [ "${{ matrix.eslint_version }}" = "9" ]; then
npm uninstall --no-save @types/eslint
npm install --no-save eslint@^9 typescript@^5
elif [ "${{ matrix.eslint_version }}" = "7" ]; then
npm install --no-save eslint@^7 @types/eslint@7.2.10
else
npm uninstall --no-save @types/eslint
npm install --no-save eslint@^${{ matrix.eslint_version }}
fi
- name: build types
run: npm run build-types
# Pack the lib into a tarball so that when we install the lib later in the
# test-published-types directory, it's only install `dependencies` of the
# lib.
- name: pack the lib
run: npm pack --pack-destination /tmp/
- name: find the packed lib
run: echo "ESLINT_PLUGIN_REACT_PATH=$(ls /tmp/eslint-plugin-react*.tgz | tail -n 1)" >> $GITHUB_ENV
- name: show the path to the packed lib
run: echo "$ESLINT_PLUGIN_REACT_PATH"
- name: npm install working directory
run: npm install
working-directory: test-published-types
- name: select eslint for published types
run: |
if [ "${{ matrix.eslint_version }}" = "7" ]; then
npm install --no-save eslint@^7
else
npm install --no-save eslint@^${{ matrix.eslint_version }}
fi
working-directory: test-published-types
- name: install eslint-plugin-react and typescript version ${{ matrix.ts_version }}
run: npm install --no-save "$ESLINT_PLUGIN_REACT_PATH" typescript@${{ matrix.ts_version }}
working-directory: test-published-types
- name: show installed typescript version
run: npm list typescript --depth=0
working-directory: test-published-types
- name: show installed eslint-plugin-react version
run: npm list eslint-plugin-react --depth=0
working-directory: test-published-types
- name: check types with lib "${{ matrix.ts_lib }}"
run: npx tsc --lib ${{ matrix.ts_lib }}
working-directory: test-published-types