From 9b7d8a51bdc9400dd367385db96aabbb25f484ce Mon Sep 17 00:00:00 2001 From: Mark Skelton Date: Tue, 22 Oct 2024 20:53:53 -0500 Subject: [PATCH] fix: Fix types for flat config (#326) --- index.d.ts | 14 ++++++++++++++ index.mjs | 3 +++ package.json | 43 +++++++++++++++++++++---------------------- 3 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 index.d.ts create mode 100644 index.mjs diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..e53d108 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,14 @@ +import { Linter, Rule } from 'eslint' + +declare const config: { + configs: { + 'flat/jest-playwright': Linter.Config + 'flat/recommended': Linter.Config + 'jest-playwright': Linter.Config + 'playwright-test': Linter.Config + recommended: Linter.Config + } + rules: Record +} + +export default config diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..06ae396 --- /dev/null +++ b/index.mjs @@ -0,0 +1,3 @@ +import plugin from './dist/index.js' + +export default plugin diff --git a/package.json b/package.json index bfed04e..e10d52b 100644 --- a/package.json +++ b/package.json @@ -15,22 +15,21 @@ "engines": { "node": ">=16.6.0" }, - "types": "./dist/index.d.ts", + "type": "commonjs", "exports": { - "import": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "require": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "require": "./dist/index.js" } }, "files": [ - "dist" + "dist", + "index.js", + "index.d.ts" ], "scripts": { - "build": "tsup src/index.ts --format cjs,esm --dts --out-dir dist --cjsInterop", + "build": "tsup src/index.ts --format cjs --out-dir dist", "lint": "eslint .", "fmt": "prettier --write .", "fmt:check": "prettier --check .", @@ -38,6 +37,18 @@ "test:watch": "vitest --reporter=dot", "ts": "tsc --noEmit" }, + "peerDependencies": { + "eslint": ">=8.40.0", + "eslint-plugin-jest": ">=25" + }, + "peerDependenciesMeta": { + "eslint-plugin-jest": { + "optional": true + } + }, + "dependencies": { + "globals": "^13.23.0" + }, "devDependencies": { "@mskelton/eslint-config": "^8.4.0", "@mskelton/semantic-release-config": "^1.0.1", @@ -55,17 +66,5 @@ "tsup": "^8.0.1", "typescript": "^5.2.2", "vitest": "^1.3.1" - }, - "peerDependencies": { - "eslint": ">=8.40.0", - "eslint-plugin-jest": ">=25" - }, - "peerDependenciesMeta": { - "eslint-plugin-jest": { - "optional": true - } - }, - "dependencies": { - "globals": "^13.23.0" } }