Skip to content

Commit

Permalink
fix: make types usable in CommonJS (#44)
Browse files Browse the repository at this point in the history
* fix: make types usable in CommonJS

* use local `@types/css-tree` package

* don't use `node_modules/@types/css-tree` in development

* use `node_modules` types instead of local typings

* remove outdated `@types/eslint`
  • Loading branch information
fasttime authored Jan 24, 2025
1 parent 265523d commit 0540006
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
package-lock = false
install-links = false
4 changes: 3 additions & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
}
},
"files": [
"dist"
"dist",
"typings"
],
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -69,13 +70,13 @@
],
"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": "file:./typings/css-tree",
"css-tree": "^3.1.0"
},
"devDependencies": {
"@eslint/core": "^0.7.0",
"@eslint/json": "^0.5.0",
"@types/eslint": "^8.56.10",
"c8": "^9.1.0",
"dedent": "^1.5.3",
"eslint": "^9.11.1",
Expand Down
10 changes: 10 additions & 0 deletions tests/types/cjs-import.test.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @fileoverview CommonJS type import test for ESLint CSS Language Plugin.
* @author Francesco Trotta
*/

//-----------------------------------------------------------------------------
// Imports
//-----------------------------------------------------------------------------

import "@eslint/css";
3 changes: 2 additions & 1 deletion tests/types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"rootDir": "../..",
"strict": true
},
"files": ["../../dist/esm/index.d.ts", "types.test.ts"]
"files": [],
"include": [".", "../../dist"]
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"files": ["src/index.js"],
"include": ["typings"],
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true,
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions typings/css-tree/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"private": true,
"name": "@types/css-tree"
}

0 comments on commit 0540006

Please sign in to comment.