Skip to content

feat: add missing type definitions #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add type definitions
  • Loading branch information
aryaemami59 committed May 16, 2025
commit 32e7bfcfe172bea3d86293f01528ace69d2ba2bf
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@ jobs:
- name: ⬆️ Upload coverage report
uses: codecov/codecov-action@v4

are-the-types-wrong:
name: 🤔 Are the types wrong?
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: ⎔ Setup Node
uses: actions/setup-node@v4
with:
node-version: 18

- name: 📥 Install dependencies
run: npm install --legacy-peer-deps

- name: ▶️ Run test:types script
run: npm run test:types -- --format=table

release:
name: 🚀 Release
needs: [ lint, test ]
Expand Down
16 changes: 9 additions & 7 deletions configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ const plugin = {
rules,
}

const recommended = {
name: "@eslint-community/eslint-comments/recommended",
plugins: {
"@eslint-community/eslint-comments": plugin,
},
rules: rulesRecommended,
}

module.exports = {
recommended: {
name: '@eslint-community/eslint-comments/recommended',
plugins: {
"@eslint-community/eslint-comments": plugin,
},
rules: rulesRecommended,
},
recommended,
}

module.exports.default = module.exports
11 changes: 7 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/** DON'T EDIT THIS FILE WHICH WAS CREATED BY 'scripts/generate-index.js'. */
"use strict"

const rules = require("./lib/rules")
const utils = require("./lib/utils")
const configs = require("./lib/configs")

module.exports = {
configs: require("./lib/configs"),
rules: require("./lib/rules"),
utils: require("./lib/utils"),
configs,
rules,
utils,
}
26 changes: 23 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,30 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"main": "index.js",
"types": "./types/index.d.ts",
"type": "commonjs",
"files": [
"configs.js",
"lib"
"lib",
"types"
],
"exports": {
"./configs": "./configs.js",
".": "./index.js"
"./package.json": "./package.json",
"./configs": {
"types": "./types/configs.d.ts",
"default": "./configs.js"
},
".": {
"types": "./types/index.d.ts",
"default": "./index.js"
}
},
"typesVersions": {
"*": {
"configs": [
"./types/configs.d.ts"
]
}
},
"peerDependencies": {
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0"
Expand All @@ -23,11 +39,13 @@
"ignore": "^5.2.4"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.4",
"@babel/core": "^7.22.9",
"@babel/eslint-parser": "^7.22.9",
"@eslint-community/eslint-plugin-mysticatea": "^15.5.1",
"@eslint/core": "^0.13.0",
"@eslint/css": "^0.6.0",
"@types/eslint": "^8",
"@types/node": "^14.18.54",
"@vuepress/plugin-pwa": "^1.9.9",
"cross-spawn": "^7.0.3",
Expand All @@ -40,6 +58,7 @@
"opener": "^1.5.2",
"rimraf": "^3.0.2",
"semver": "^7.5.4",
"typescript": "^5.8.3",
"vite-plugin-eslint4b": "^0.2.1",
"vitepress": "^1.0.0-rc.15"
},
Expand All @@ -53,6 +72,7 @@
"lint": "eslint lib scripts tests",
"test": "nyc npm run debug",
"debug": "mocha \"tests/lib/**/*.js\" --reporter dot --timeout 8000",
"test:types": "attw --pack",
"coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html",
"watch": "npm run -s test -- --watch --growl"
},
Expand Down
21 changes: 21 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": false,
"esModuleInterop": false,
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"lib": ["ESNext"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": false,
"strict": true,
"target": "ESNext",
"useDefineForClassFields": true,
"useUnknownInCatchVariables": true,
"verbatimModuleSyntax": true
},
"include": ["."]
}
11 changes: 11 additions & 0 deletions types/configs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Linter } from "eslint"

declare namespace Configs {
import defaultExports = Configs

export const recommended: Linter.FlatConfig

export { defaultExports as default }
}

export = Configs
7 changes: 7 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { ESLint, Linter } from "eslint"

export declare const configs: { recommended: Linter.FlatConfig }

export declare const rules: NonNullable<ESLint.Plugin["rules"]>

export declare const utils: { patch: (ruleId?: string) => void }