Skip to content

Commit 9d1f639

Browse files
G-Rathljharb
authored andcommitted
[New] add TypeScript types
1 parent e159652 commit 9d1f639

File tree

4 files changed

+53
-1
lines changed

4 files changed

+53
-1
lines changed

.github/workflows/node-pretest.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ jobs:
1818
# skip-ls-check: true
1919
# - run: npm run pretest
2020

21+
types:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: ljharb/actions/node/install@main
26+
name: 'npm install'
27+
with:
28+
skip-ls-check: true
29+
# for some reason we've got to force typescript to install here
30+
# even though the npm script has `typescript@latest`
31+
- run: npm i --force typescript@latest
32+
- run: npm run test-types
33+
2134
posttest:
2235
runs-on: ubuntu-latest
2336

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
88

99
### Added
1010
- add [`enforce-node-protocol-usage`] rule and `import/node-version` setting ([#3024], thanks [@GoldStrikeArch] and [@sevenc-nanashi])
11+
- add TypeScript types ([#3097], thanks [@G-Rath])
1112

1213
### Changed
1314
- [Docs] [`extensions`], [`order`]: improve documentation ([#3106], thanks [@Xunnamius])
@@ -1161,6 +1162,7 @@ for info on changes for earlier releases.
11611162
[`memo-parser`]: ./memo-parser/README.md
11621163

11631164
[#3106]: https://github.com/import-js/eslint-plugin-import/pull/3106
1165+
[#3097]: https://github.com/import-js/eslint-plugin-import/pull/3097
11641166
[#3073]: https://github.com/import-js/eslint-plugin-import/pull/3073
11651167
[#3072]: https://github.com/import-js/eslint-plugin-import/pull/3072
11661168
[#3071]: https://github.com/import-js/eslint-plugin-import/pull/3071

index.d.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { ESLint, Linter, Rule } from 'eslint';
2+
3+
declare const plugin: ESLint.Plugin & {
4+
meta: {
5+
name: string;
6+
version: string;
7+
};
8+
configs: {
9+
'recommended': Linter.LegacyConfig;
10+
'errors': Linter.LegacyConfig;
11+
'warnings': Linter.LegacyConfig;
12+
'stage-0': Linter.LegacyConfig;
13+
'react': Linter.LegacyConfig;
14+
'react-native': Linter.LegacyConfig;
15+
'electron': Linter.LegacyConfig;
16+
'typescript': Linter.LegacyConfig;
17+
};
18+
flatConfigs: {
19+
'recommended': Linter.FlatConfig;
20+
'errors': Linter.FlatConfig;
21+
'warnings': Linter.FlatConfig;
22+
'stage-0': Linter.FlatConfig;
23+
'react': Linter.FlatConfig;
24+
'react-native': Linter.FlatConfig;
25+
'electron': Linter.FlatConfig;
26+
'typescript': Linter.FlatConfig;
27+
};
28+
rules: {
29+
[key: string]: Rule.RuleModule;
30+
};
31+
};
32+
33+
export = plugin;

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"node": ">=4"
77
},
88
"main": "lib/index.js",
9+
"types": "index.d.ts",
910
"directories": {
1011
"test": "tests"
1112
},
@@ -16,7 +17,8 @@
1617
"docs",
1718
"lib",
1819
"config",
19-
"memo-parser/{*.js,LICENSE,*.md}"
20+
"memo-parser/{*.js,LICENSE,*.md}",
21+
"index.d.ts"
2022
],
2123
"scripts": {
2224
"prebuild": "rimraf lib",
@@ -34,6 +36,7 @@
3436
"test-examples": "npm run build && npm run test-example:legacy && npm run test-example:flat",
3537
"test-example:legacy": "cd examples/legacy && npm install && npm run lint",
3638
"test-example:flat": "cd examples/flat && npm install && npm run lint",
39+
"test-types": "npx --package typescript@latest tsc --noEmit index.d.ts",
3740
"prepublishOnly": "safe-publish-latest && npm run build",
3841
"prepublish": "not-in-publish || npm run prepublishOnly",
3942
"preupdate:eslint-docs": "npm run build",
@@ -63,6 +66,7 @@
6366
"@angular-eslint/template-parser": "^13.5.0",
6467
"@eslint/import-test-order-redirect-scoped": "file:./tests/files/order-redirect-scoped",
6568
"@test-scope/some-module": "file:./tests/files/symlinked-module",
69+
"@types/eslint": "^8.56.12",
6670
"@typescript-eslint/parser": "^2.23.0 || ^3.3.0 || ^4.29.3 || ^5.10.0",
6771
"babel-cli": "^6.26.0",
6872
"babel-core": "^6.26.3",

0 commit comments

Comments
 (0)