Skip to content

Commit

Permalink
fix: Issues with type definitions (#18940)
Browse files Browse the repository at this point in the history
* Fix issues with type definitions

* Add `@arethetypeswrong/cli` to `devDependencies`

* Add `lint:types` command

* Add `are-the-types-wrong` CI job
  • Loading branch information
aryaemami59 authored Sep 27, 2024
1 parent 8f55ca2 commit fdd6319
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/types-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
- name: Install Packages (eslint)
working-directory: eslint
run: npm install

- name: Update package.json eslint-visitor-keys
uses: restackio/[email protected]
with:
Expand All @@ -146,3 +146,24 @@ jobs:
- name: Run TSC
working-directory: eslint-js
run: npm run build:types --workspace eslint-visitor-keys

are-the-types-wrong:
name: Are the types wrong?
runs-on: ubuntu-latest
steps:
- name: Checkout eslint
uses: actions/checkout@v4
with:
path: eslint

- uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Install Packages
working-directory: eslint
run: npm install

- name: Check validity of type definitions
working-directory: eslint
run: npm run lint:types
3 changes: 2 additions & 1 deletion lib/unsupported-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
const { FileEnumerator } = require("./cli-engine/file-enumerator");
const { ESLint: FlatESLint, shouldUseFlatConfig } = require("./eslint/eslint");
const { LegacyESLint } = require("./eslint/legacy-eslint");
const builtinRules = require("./rules");

//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------

module.exports = {
builtinRules: require("./rules"),
builtinRules,
FlatESLint,
shouldUseFlatConfig,
FileEnumerator,
Expand Down
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@
"default": "./lib/universal.js"
}
},
"typesVersions": {
"*": {
"use-at-your-own-risk": [
"./lib/types/use-at-your-own-risk.d.ts"
],
"rules": [
"./lib/types/rules/index.d.ts"
],
"universal": [
"./lib/types/universal.d.ts"
]
}
},
"scripts": {
"build:docs:update-links": "node tools/fetch-docs-links.js",
"build:site": "node Makefile.js gensite",
Expand All @@ -38,6 +51,7 @@
"lint:unused": "knip",
"lint:fix": "trunk check -y --ignore=docs/**/*.js -a --filter=eslint && trunk check -y --ignore=docs/**/*.js",
"lint:fix:docs:js": "trunk check -y --ignore=** --ignore=!docs/**/*.js -a --flter=eslint && trunk check -y --ignore=** --ignore=!docs/**/*.js",
"lint:types": "attw --pack",
"release:generate:alpha": "node Makefile.js generatePrerelease -- alpha",
"release:generate:beta": "node Makefile.js generatePrerelease -- beta",
"release:generate:latest": "node Makefile.js generateRelease -- latest",
Expand Down Expand Up @@ -120,6 +134,7 @@
"text-table": "^0.2.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.16.4",
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@eslint/json": "^0.4.0",
Expand Down

0 comments on commit fdd6319

Please sign in to comment.