Skip to content

File tree

6 files changed

+99
-0
lines changed

6 files changed

+99
-0
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test-published-types

.github/workflows/type-check.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: "Types: check published types"
2+
3+
on: [pull_request, push]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
test:
10+
name: TS ${{ matrix.ts_version }}, "${{ matrix.ts_lib }}"
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
ts_version:
16+
# The official ESLint types are not compatible with TS 3.9
17+
# - 3.9
18+
- '4.0'
19+
- 4.1
20+
- 4.2
21+
- 4.3
22+
- 4.4
23+
- 4.5
24+
- '5.0'
25+
- 5.5
26+
- 5.6
27+
ts_lib:
28+
- es2015
29+
- es2015,dom
30+
- es2020
31+
- esnext
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
persist-credentials: false
36+
show-progress: false
37+
38+
- uses: ljharb/actions/node/install@main
39+
name: 'nvm install lts/* && npm install'
40+
with:
41+
node-version: 'lts/*'
42+
skip-ls-check: true
43+
44+
- name: build types
45+
run: npm run build-types
46+
47+
- name: npm install working directory
48+
run: npm install --ignore-scripts
49+
working-directory: test-published-types
50+
51+
- name: install typescript version ${{ matrix.ts_version }}
52+
run: npm install --force typescript@${{ matrix.ts_version }}
53+
working-directory: test-published-types
54+
55+
- name: show installed typescript version
56+
run: npm list typescript --depth=0
57+
working-directory: test-published-types
58+
59+
- name: check types with lib "${{ matrix.ts_lib }}"
60+
run: npx tsc --lib ${{ matrix.ts_lib }}
61+
working-directory: test-published-types

test-published-types/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

test-published-types/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
const react = require('eslint-plugin-react');
4+
5+
/** @type {import('eslint').Linter.Config[]} */
6+
module.exports = [
7+
{
8+
plugins: {
9+
react,
10+
},
11+
},
12+
];

test-published-types/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "eslint-plugin-react-test-published-types",
3+
"private": true,
4+
"version": "0.0.0",
5+
"dependencies": {
6+
"@eslint/core": "^0.6.0",
7+
"@types/estree": "^1.0.6",
8+
"@types/json-schema": "^7.0.15",
9+
"eslint": "^9.0.0",
10+
"eslint-plugin-react": "file:.."
11+
}
12+
}

test-published-types/tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
4+
"files": [
5+
"index.js"
6+
],
7+
8+
"compilerOptions": {
9+
"lib": ["esnext"],
10+
"types": ["node"]
11+
}
12+
}

0 commit comments

Comments
 (0)