Skip to content

Commit fcc7b7f

Browse files
authored
Prepare Release (#12)
1 parent 6f94f40 commit fcc7b7f

16 files changed

+2191
-1288
lines changed

.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 107 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ storybook-static
3030
terraform
3131

3232
.npmrc
33+
.vs
3334

3435
cypress/screenshots
3536
cypress/videos

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- `useConstructor` hook using state instead of ref for React 19 compatibility.
13+
1014
### Added
1115

1216
- `useConstructor` hook that executes a provided callback only once during the component's lifecycle, similar to a constructor.

cypress/component/useConstructor.cy.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ describe("useConstructor", () => {
2525
cy.get("@initSpy").should("have.been.calledOnce");
2626

2727
// Cause several re-renders
28-
cy.contains("Increment").click().click().click();
28+
cy.contains("Increment").click();
29+
cy.contains("Increment").click();
30+
cy.contains("Increment").click();
2931
cy.get("[data-cy='count']").should("have.text", "3");
3032

3133
cy.get("@initSpy").should("have.been.calledOnce");
@@ -45,7 +47,9 @@ describe("useConstructor", () => {
4547
};
4648

4749
const Child: React.FC = () => {
48-
useConstructor(() => initSpy());
50+
useConstructor(() => {
51+
initSpy();
52+
});
4953
return <div data-cy="child">Child</div>;
5054
};
5155

cypress/component/useHelloWorld.cy.tsx

Lines changed: 0 additions & 56 deletions
This file was deleted.

cypress/support/component-index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<meta charset="utf-8" />

eslint.config.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import neolutionEslintConfig from "@neolution-ch/eslint-config-neolution";
2+
3+
export default [
4+
{
5+
ignores: ["vite.config.ts"],
6+
},
7+
...neolutionEslintConfig.configs.flat.getConfig({
8+
...neolutionEslintConfig.configs.flat.defaults["react-library"],
9+
cypressRecommended: true,
10+
}),
11+
{
12+
rules: {
13+
"no-restricted-imports": [
14+
"error",
15+
{
16+
patterns: [
17+
{
18+
group: ["src/**"],
19+
message: "Use relative import path instead.",
20+
},
21+
{
22+
group: ["**/../src/**"],
23+
message: "Do not reach the 'src' folder in a relative path.",
24+
},
25+
],
26+
},
27+
],
28+
},
29+
},
30+
{
31+
files: ["**/cypress/**"],
32+
rules: {
33+
"@typescript-eslint/no-namespace": [
34+
"error",
35+
{
36+
allowDeclarations: true,
37+
allowDefinitionFiles: true,
38+
},
39+
],
40+
},
41+
},
42+
{
43+
files: ["eslint.config.ts"],
44+
rules: {
45+
"unicorn/prefer-module": "off",
46+
},
47+
},
48+
{
49+
files: ["**/*.cy.tsx"],
50+
rules: {
51+
"no-restricted-imports": "off",
52+
},
53+
},
54+
];

package.json

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,12 @@
1313
"exports": {
1414
"./package.json": "./package.json",
1515
".": {
16-
"types": "./dist/index.d.ts",
16+
"types": "./dist/src/index.d.ts",
1717
"import": "./dist/index.modern.js",
1818
"require": "./dist/index.js"
1919
}
2020
},
2121
"main": "dist/index.js",
22-
"umd:main": "dist/index.umd.js",
23-
"jsdelivr": "dist/index.umd.js",
24-
"unpkg": "dist/index.umd.js",
2522
"module": "dist/index.modern.js",
2623
"source": "src/index.ts",
2724
"jsnext:main": "dist/index.modern.js",
@@ -30,8 +27,8 @@
3027
"dist"
3128
],
3229
"scripts": {
33-
"build": "rollup -c",
34-
"lint": "eslint \"**/*.{ts,tsx}\" --cache --max-warnings 0",
30+
"build": "rollup -c --configPlugin rollup-plugin-typescript2",
31+
"lint": "eslint --cache",
3532
"prepack": "yarn build",
3633
"prepare-pr": "yarn prettier . --write && yarn lint && yarn build && yarn test",
3734
"prettier-check": "prettier --check .",
@@ -46,38 +43,33 @@
4643
"dependencies": {},
4744
"devDependencies": {
4845
"@babel/core": "^7.21.8",
46+
"@neolution-ch/eslint-config-neolution": "^2.3.0",
4947
"@popperjs/core": "^2.11.7",
5048
"@release-it/keep-a-changelog": "^4.0.0",
5149
"@rollup/plugin-commonjs": "^24.1.0",
5250
"@rollup/plugin-node-resolve": "^15.0.2",
5351
"@rollup/plugin-terser": "^0.4.1",
5452
"@types/jest": "^29.5.3",
55-
"@types/node": "^18.16.3",
56-
"@types/react": "^18.3.4",
53+
"@types/node": "^20.11.1",
54+
"@types/react": "^19.2.14",
55+
"@types/react-dom": "^19.2.3",
56+
"@types/rollup-plugin-peer-deps-external": "^2.2.6",
5757
"@types/uuid": "^9.0.7",
58-
"@typescript-eslint/eslint-plugin": "^5.59.2",
59-
"@typescript-eslint/parser": "^5.59.2",
60-
"@vitejs/plugin-react": "^5.0.2",
58+
"@typescript-eslint/parser": "^8.56.1",
59+
"@vitejs/plugin-react": "^5.1.4",
6160
"concurrently": "^8.0.1",
6261
"cross-env": "^7.0.3",
6362
"cypress": "^15.0.0",
64-
"eslint": "^8.45.0",
65-
"eslint-config-prettier": "^8.8.0",
66-
"eslint-import-resolver-typescript": "^3.5.5",
67-
"eslint-plugin-import": "^2.27.5",
68-
"eslint-plugin-jest": "^27.2.3",
69-
"eslint-plugin-jsdoc": "^46.4.4",
70-
"eslint-plugin-react": "^7.35.0",
71-
"eslint-plugin-react-hooks": "^4.6.2",
72-
"eslint-plugin-storybook": "^0.6.12",
63+
"eslint": "^9.25.1",
7364
"jest": "^29.6.1",
7465
"jest-localstorage-mock": "^2.4.26",
66+
"jiti": "^2.6.1",
7567
"nodemon": "^2.0.22",
76-
"prettier": "^2.8.8",
77-
"react": "^18.3.1",
78-
"react-dom": "^18.3.1",
68+
"prettier": "^3.8.1",
69+
"react": "^19.2.4",
70+
"react-dom": "^19.2.4",
7971
"release-it": "^16.1.2",
80-
"rollup": "^3.21.4",
72+
"rollup": "^4.32.0",
8173
"rollup-plugin-peer-deps-external": "^2.2.4",
8274
"rollup-plugin-typescript2": "^0.34.1",
8375
"shx": "^0.3.4",
@@ -89,7 +81,8 @@
8981
"yalc": "^1.0.0-pre.53"
9082
},
9183
"peerDependencies": {
92-
"react": "^18.0.0"
84+
"react": "^18.2.0 || ^19.2.0",
85+
"react-dom": "^18.2.0 || ^19.2.0"
9386
},
9487
"engines": {
9588
"node": ">=20"

0 commit comments

Comments
 (0)