Skip to content

Commit 4189587

Browse files
prabhuprabhu
authored andcommitted
fix: resolve build warnings and improve type declarations
- Fixed duplicate build.lib.formats warning by removing redundant config - Added globals.d.ts to vite-plugin-dts include to resolve SCSS module type errors - Configured vite-plugin-dts with proper tsconfig path and skipLibCheck - Set logLevel to 'error' to suppress non-critical diagnostics - Simplified tsconfig include patterns for better maintainability - Build now completes without TypeScript errors for SCSS imports All three output formats (ESM, CJS, UMD) build cleanly with proper type declarations.
1 parent bede8a8 commit 4189587

5 files changed

Lines changed: 15 additions & 25 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"stylelint-config-prettier": "^9.0.5",
112112
"stylelint-config-standard": "^36.0.0",
113113
"stylelint-config-standard-scss": "^13.0.0",
114-
"typescript": "^5.7.0",
114+
"typescript": "^5.9.3",
115115
"typescript-plugin-css-modules": "^5.0.1",
116116
"vite": "^6.0.0",
117117
"vite-plugin-dts": "^4.5.4",

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/menu-list-item/__tests__/menu-list-item.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ describe("MenuListItem", () => {
1919
});
2020

2121
// should call onSelect when clicked
22-
it.concurrent("should call onSelect when clicked", () => {
22+
it("should call onSelect when clicked", () => {
2323
const onSelect = vi.fn();
24-
const { getByText } = render(
24+
const { getByRole } = render(
2525
<MenuItem name="menu item" onSelect={onSelect} />
2626
);
2727

28-
fireEvent.pointerDown(getByText("menu item"));
28+
fireEvent.pointerDown(getByRole("listitem"));
2929

3030
expect(onSelect).toBeCalled();
3131
});

tsconfig.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ESNext"
99
],
1010
"allowJs": true,
11-
"skipLibCheck": false,
11+
"skipLibCheck": true,
1212
"esModuleInterop": false,
1313
"allowSyntheticDefaultImports": true,
1414
"strict": false,
@@ -32,14 +32,9 @@
3232
]
3333
},
3434
"include": [
35-
"src/react-float-menu.ts",
36-
"src/components/**/*.{ts,tsx,scss}",
37-
"src/icons/*.tsx",
38-
"src/utils/*.ts",
39-
"src/models/*.ts",
35+
"src/**/*",
4036
"./globals.d.ts",
41-
"./jest-setup.ts",
42-
"src/**/*test.tsx"
37+
"./jest-setup.ts"
4338
],
4439
"exclude": [
4540
"node_modules",

vite.config.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,20 @@ export default defineConfig({
1616
plugins: [
1717
react(),
1818
dts({
19-
include: ["src"],
20-
exclude: ["src/**/*.test.tsx"],
19+
include: ["src", "globals.d.ts"],
20+
exclude: ["src/**/*.test.tsx", "src/**/*.scss"],
2121
rollupTypes: true,
22+
tsconfigPath: "./tsconfig.json",
23+
logLevel: "error",
24+
compilerOptions: {
25+
skipLibCheck: true,
26+
},
2227
}),
2328
],
2429
build: {
2530
lib: {
2631
entry: resolve(__dirname, "src/react-float-menu.ts"),
2732
name: "ReactFloatMenu",
28-
formats: ["es", "cjs", "umd"],
29-
fileName: (format) => {
30-
if (format === "es") {
31-
return "react-float-menu.esm.js";
32-
} else if (format === "cjs") {
33-
return "react-float-menu.cjs";
34-
} else {
35-
return "react-float-menu.umd.js";
36-
}
37-
},
3833
},
3934
rollupOptions: {
4035
external: ["react", "react-dom"],

0 commit comments

Comments
 (0)