Skip to content

Commit

Permalink
+ useMemoizedFn hook
Browse files Browse the repository at this point in the history
+ `proxyHandlerTransparentGet` helper
+ `ProxyRef`, `InputDeviceProviderProps` types export
= various docs improvements
! `useGeolocation` `enabled` parameter not honored (always enabled)
  • Loading branch information
dzek69 committed Jan 11, 2025
1 parent a64441d commit ceb9ee3
Show file tree
Hide file tree
Showing 41 changed files with 2,908 additions and 2,056 deletions.
78 changes: 0 additions & 78 deletions .eslintrc.json

This file was deleted.

7 changes: 6 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
/nodemon.json
/.editorconfig
/tsconfig.*
/.eslintrc.json
/pagesconfig.json

/.next
Expand All @@ -20,3 +19,9 @@
/dist/pages
/dist/demos
/typedoc.cjs

/eslint.config.mjs
/typedoc.mjs
/.prettierignore
/.prettierrc.json
/.husky
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file.
The format is based on [EZEZ Changelog](https://ezez.dev/guidelines/changelog)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.3.0] - 2025-01-11
### Added
- `useMemoizedFn` hook
- `proxyHandlerTransparentGet` helper
- `ProxyRef`, `InputDeviceProviderProps` types export
### Changed
- various docs improvements
### Fixed
- `useGeolocation` `enabled` parameter not honored (always enabled)

## [2.2.0] - 2024-05-13
### Added
- `useProxyRef` hook
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ If a hook is there, it's either unique, rare, super optimized or just needed for
- 🌐 `useSimpleGeolocation` - keep track of user's geolocation (simplified)
- ☝️ `useInputDevice` - keep track of a currently active input device
- 🥇 `useIsFirstRender` - keep track of first render
- 💾 `useMemoizedFn` - improve performance by memoizing functions
- 🎭 `useProxyRef` - wraps your ref with a Proxy for full control
- 🎭 `useForwardedProxyRef` - wraps forwarded ref with a Proxy for full control
- 📅 `useToday` - keep track of day changes
Expand Down
34 changes: 34 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { readFile } from "fs/promises";

import { getEslintConfig } from "@ezez/eslint";
import reactHooks from "eslint-plugin-react-hooks";
import { fixupPluginRules } from "@eslint/compat";

const packageJson = JSON.parse(String(await readFile("./package.json")));
const react = Boolean(packageJson.libraryTemplate?.jsx);

const config = getEslintConfig({ react });
config.push({
files: ["src/demos/**/*"],
rules: {
"react/jsx-no-bind": "off",
},
});
config.push({
files: ["src/pages/**/*"],
rules: {
"import/no-default-export": "off",
},
});

config.push({
plugins: {
"react-hooks": fixupPluginRules(reactHooks),
},
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
});

export default config;
49 changes: 20 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ezez/hooks",
"version": "2.2.0",
"version": "2.3.0",
"repository": "git@github.com:dzek69/ezez-hooks.git",
"author": "Jacek Nowacki",
"license": "MIT",
Expand All @@ -11,16 +11,16 @@
"compile:esm": "rm -rf esm && tsc --project tsconfig.esm.json && node ./build-scripts/compile.esm.after.mjs",
"compile:cjs": "rm -rf dist && tsc --project tsconfig.cjs.json && node ./build-scripts/compile.cjs.after.mjs",
"typecheck": "tsc --noEmit",
"lint": "eslint src --ext .ts,.tsx,.js,.jsx,.mjs",
"lint": "ezlint src",
"lint:fix": "pnpm lint --fix",
"prepack": "pnpm compile",
"prepublishOnly": "pnpm audit && pnpm lint && pnpm test && pnpm run docs",
"prepare": "husky install",
"start:dev": "next dev",
"start:dev:compatibility": "TS_NODE_FILES=true pnpm start:dev",
"updates": "npx --yes npm-check-updates --dep prod",
"updates:dev": "npx --yes npm-check-updates --dep dev",
"updates:all": "npx --yes npm-check-updates"
"updates": "pnpm dlx npm-check-updates --dep prod",
"updates:dev": "pnpm dlx npm-check-updates --dep dev",
"updates:all": "pnpm dlx npm-check-updates"
},
"exports": {
".": {
Expand All @@ -33,43 +33,34 @@
"types": "./esm/index.d.ts",
"module": "./esm/index.js",
"dependencies": {
"@ezez/utils": "^1.9.0",
"@ezez/utils": "^4.1.0",
"oop-timers": "^5.0.0"
},
"devDependencies": {
"@babel/core": "^7.23.7",
"@babel/preset-env": "^7.23.7",
"@babel/preset-typescript": "^7.23.3",
"@dzek69/eslint-config-base": "^2.5.0",
"@dzek69/eslint-config-import": "^1.3.0",
"@dzek69/eslint-config-import-typescript": "^1.0.1",
"@dzek69/eslint-config-react": "^1.2.2",
"@dzek69/eslint-config-typescript": "^1.1.1",
"@knodes/typedoc-plugin-pages": "^0.23.4",
"@types/jest": "^29.5.2",
"@babel/core": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@eslint/compat": "^1.2.5",
"@ezez/eslint": "^0.3.0",
"@types/jest": "^29.5.5",
"@types/react": "^18.2.8",
"@types/react-dom": "^18.2.4",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"babel-plugin-module-extension": "^0.1.3",
"babel-plugin-module-resolver": "^5.0.0",
"eslint": "^8.44.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.6.0",
"fs-extra": "^11.1.1",
"husky": "^8.0.3",
"jest": "^29.6.1",
"jest": "^29.7.0",
"must": "^0.13.4",
"next": "^14.2.3",
"next": "^14.2.23",
"nodemon": "^3.0.1",
"prettier": "^2.8.8",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"resolve-tspaths": "^0.8.14",
"ts-node": "^10.9.1",
"typedoc": "^0.23.28",
"typescript": "^5.1.3"
"resolve-tspaths": "^0.8.15",
"ts-node": "^10.9.2",
"typedoc": "0.26.0-beta.2",
"typescript": "^5.4.5"
},
"peerDependencies": {
"react": "^18.2.0",
Expand All @@ -81,7 +72,7 @@
}
},
"libraryTemplate": {
"version": "3.11.1",
"version": "3.13.0",
"language": "typescript",
"fixDefaultForCommonJS": true,
"jsx": true
Expand Down
7 changes: 6 additions & 1 deletion pagesconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"pages": [],
"pages": [
{
"title": "CHANGELOG",
"source": "./CHANGELOG.md"
}
],
"source": "tutorials"
}
Loading

0 comments on commit ceb9ee3

Please sign in to comment.