From ade2a290d57ca3efd362eb59dece4a70abeca8dc Mon Sep 17 00:00:00 2001 From: Francesco Trotta Date: Tue, 14 Jan 2025 18:50:26 +0100 Subject: [PATCH 1/5] fix: make types usable in CommonJS --- package.json | 5 +++-- tests/types/cjs-import.test.cts | 10 ++++++++++ tests/types/tsconfig.json | 3 ++- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 tests/types/cjs-import.test.cts diff --git a/package.json b/package.json index 8508faa..69ed66e 100644 --- a/package.json +++ b/package.json @@ -69,11 +69,12 @@ ], "license": "Apache-2.0", "dependencies": { - "@eslint/plugin-kit": "^0.2.3", + "@eslint/core": "^0.10.0", + "@eslint/plugin-kit": "^0.2.5", + "@types/css-tree": "^2.3.10", "css-tree": "^3.0.1" }, "devDependencies": { - "@eslint/core": "^0.7.0", "@eslint/json": "^0.5.0", "@types/eslint": "^8.56.10", "c8": "^9.1.0", diff --git a/tests/types/cjs-import.test.cts b/tests/types/cjs-import.test.cts new file mode 100644 index 0000000..daf8471 --- /dev/null +++ b/tests/types/cjs-import.test.cts @@ -0,0 +1,10 @@ +/** + * @fileoverview CommonJS type import test for ESLint CSS Language Plugin. + * @author Francesco Trotta + */ + +//----------------------------------------------------------------------------- +// Imports +//----------------------------------------------------------------------------- + +import "@eslint/css"; diff --git a/tests/types/tsconfig.json b/tests/types/tsconfig.json index 6bf4343..c6bd5a6 100644 --- a/tests/types/tsconfig.json +++ b/tests/types/tsconfig.json @@ -5,5 +5,6 @@ "rootDir": "../..", "strict": true }, - "files": ["../../dist/esm/index.d.ts", "types.test.ts"] + "files": [], + "include": [".", "../../dist"] } From 9c3c05a0143d04377ab9b04551d6a146df9ae8b9 Mon Sep 17 00:00:00 2001 From: Francesco Trotta Date: Mon, 20 Jan 2025 13:05:18 +0100 Subject: [PATCH 2/5] use local `@types/css-tree` package --- .npmrc | 1 + jsr.json | 4 +++- package.json | 5 +++-- typings/{ => css-tree}/LICENSE | 0 typings/{css-tree.d.ts => css-tree/index.d.ts} | 0 typings/css-tree/package.json | 4 ++++ 6 files changed, 11 insertions(+), 3 deletions(-) rename typings/{ => css-tree}/LICENSE (100%) rename typings/{css-tree.d.ts => css-tree/index.d.ts} (100%) create mode 100644 typings/css-tree/package.json diff --git a/.npmrc b/.npmrc index c1ca392..8783d62 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ package-lock = false +install-links = false diff --git a/jsr.json b/jsr.json index 72ea2cb..7a2b6f6 100644 --- a/jsr.json +++ b/jsr.json @@ -8,7 +8,9 @@ "dist/esm/index.d.ts", "README.md", "jsr.json", - "LICENSE" + "LICENSE", + "typings/css-tree/index.d.ts", + "typings/css-tree/LICENSE" ] } } diff --git a/package.json b/package.json index 71c517d..be224d9 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ } }, "files": [ - "dist" + "dist", + "typings" ], "publishConfig": { "access": "public" @@ -71,7 +72,7 @@ "dependencies": { "@eslint/core": "^0.10.0", "@eslint/plugin-kit": "^0.2.5", - "@types/css-tree": "^2.3.10", + "@types/css-tree": "file:./typings/css-tree", "css-tree": "^3.1.0" }, "devDependencies": { diff --git a/typings/LICENSE b/typings/css-tree/LICENSE similarity index 100% rename from typings/LICENSE rename to typings/css-tree/LICENSE diff --git a/typings/css-tree.d.ts b/typings/css-tree/index.d.ts similarity index 100% rename from typings/css-tree.d.ts rename to typings/css-tree/index.d.ts diff --git a/typings/css-tree/package.json b/typings/css-tree/package.json new file mode 100644 index 0000000..e9eac78 --- /dev/null +++ b/typings/css-tree/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "name": "@types/css-tree" +} From 89c1a092d58a4a5f85337d09aaa2b0e45dc9b69c Mon Sep 17 00:00:00 2001 From: Francesco Trotta Date: Wed, 22 Jan 2025 09:05:07 +0100 Subject: [PATCH 3/5] don't use `node_modules/@types/css-tree` in development --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index bcaaa13..324ecc1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,7 @@ "outDir": "dist/esm", "target": "ES2022", "moduleResolution": "NodeNext", - "module": "NodeNext" + "module": "NodeNext", + "types": [] } } From 2a8cb3a6c7f34373632d0e937d9d650696cbe81f Mon Sep 17 00:00:00 2001 From: Francesco Trotta Date: Wed, 22 Jan 2025 09:20:07 +0100 Subject: [PATCH 4/5] use `node_modules` types instead of local typings --- tsconfig.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 324ecc1..3fa504c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,5 @@ { "files": ["src/index.js"], - "include": ["typings"], "compilerOptions": { "declaration": true, "emitDeclarationOnly": true, @@ -9,7 +8,6 @@ "outDir": "dist/esm", "target": "ES2022", "moduleResolution": "NodeNext", - "module": "NodeNext", - "types": [] + "module": "NodeNext" } } From 89d90c098fbe32f310d3b5fb1c613832267f58cb Mon Sep 17 00:00:00 2001 From: Francesco Trotta Date: Wed, 22 Jan 2025 09:23:30 +0100 Subject: [PATCH 5/5] remove outdated `@types/eslint` --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index be224d9..6fea3fa 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,6 @@ }, "devDependencies": { "@eslint/json": "^0.5.0", - "@types/eslint": "^8.56.10", "c8": "^9.1.0", "dedent": "^1.5.3", "eslint": "^9.11.1",