Skip to content

Commit 35df194

Browse files
author
devgioele
authored
Merge pull request #9 from aboutbits/major-refactor
Version 2
2 parents ad14bec + ac91a47 commit 35df194

35 files changed

Lines changed: 1603 additions & 952 deletions

.eslintrc.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,30 @@
44
"browser": true,
55
"node": true
66
},
7-
"plugins": ["@typescript-eslint", "react", "react-hooks", "jest"],
7+
"plugins": ["@typescript-eslint", "react", "react-hooks"],
88
"extends": [
9+
"eslint:recommended",
910
"plugin:@typescript-eslint/recommended",
11+
"plugin:react/recommended",
12+
"plugin:react/jsx-runtime",
1013
"plugin:import/recommended",
1114
"plugin:import/typescript",
12-
"plugin:jest/recommended",
1315
"plugin:prettier/recommended"
1416
],
1517
"parserOptions": {
1618
"sourceType": "module",
1719
"ecmaVersion": 2018
1820
},
21+
"settings": {
22+
"react": {
23+
"version": "detect"
24+
},
25+
"import/resolver": {
26+
"node": {
27+
"paths": ["./"]
28+
}
29+
}
30+
},
1931
"rules": {
2032
"react-hooks/rules-of-hooks": "error",
2133
"react-hooks/exhaustive-deps": "error",

.githooks/pre-commit

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
set -e
44
set -o pipefail
55

6-
npm run lint
7-
npm run typecheck
6+
npm run checks

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ jobs:
1010
node-version: '16.x'
1111
registry-url: 'https://registry.npmjs.org'
1212
- run: npm install
13-
- run: npm run lint
14-
- run: npm run typecheck
15-
- run: npm run test
13+
- run: npm run checks

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
/package-lock.json
1010
/node_modules
1111
/dist
12+
13+
# ESLint
14+
.eslintcache

jest.config.json

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

package.json

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,43 @@
22
"name": "@aboutbits/react-pagination",
33
"version": "1.0.2",
44
"description": "Pagination hooks for React",
5-
"sideEffects": false,
5+
"exports": {
6+
".": {
7+
"types": "./dist/types/engine/index.d.ts",
8+
"import": "./dist/esm/engine/index.js",
9+
"require": "./dist/cjs/engine/index.js"
10+
},
11+
"./next-router": {
12+
"types": "./dist/types/routers/nextRouter.d.ts",
13+
"import": "./dist/esm/routers/nextRouter.js",
14+
"require": "./dist/cjs/routers/nextRouter.js"
15+
},
16+
"./in-memory": {
17+
"types": "./dist/types/routers/inMemory.d.ts",
18+
"import": "./dist/esm/routers/inMemory.js",
19+
"require": "./dist/cjs/routers/inMemory.js"
20+
},
21+
"./react-router": {
22+
"types": "./dist/types/routers/reactRouter.d.ts",
23+
"import": "./dist/esm/routers/reactRouter.js",
24+
"require": "./dist/cjs/routers/reactRouter.js"
25+
},
26+
"./next-router/zod": {
27+
"types": "./dist/types/zod/routers/nextRouter.d.ts",
28+
"import": "./dist/esm/zod/routers/nextRouter.js",
29+
"require": "./dist/cjs/zod/routers/nextRouter.js"
30+
},
31+
"./in-memory/zod": {
32+
"types": "./dist/types/zod/routers/inMemory.d.ts",
33+
"import": "./dist/esm/zod/routers/inMemory.js",
34+
"require": "./dist/cjs/zod/routers/inMemory.js"
35+
},
36+
"./react-router/zod": {
37+
"types": "./dist/types/zod/routers/reactRouter.d.ts",
38+
"import": "./dist/esm/zod/routers/reactRouter.js",
39+
"require": "./dist/cjs/zod/routers/reactRouter.js"
40+
}
41+
},
642
"engines": {
743
"npm": "^8",
844
"node": "^16"
@@ -12,13 +48,16 @@
1248
"build:esm": "tsc -p tsconfig.esm.json",
1349
"build:cjs": "tsc -p tsconfig.cjs.json",
1450
"build:types": "tsc -p tsconfig.types.json",
15-
"lint": "eslint --ext js,ts,tsx src",
51+
"lint": "eslint --ext js,ts,tsx --cache .",
1652
"lint:fix": "npm run lint -- --fix",
53+
"test": "vitest run --passWithNoTests",
54+
"test:watch": "vitest watch --passWithNoTests",
1755
"typecheck": "tsc --noEmit",
18-
"test": "jest --verbose --passWithNoTests",
56+
"checks": "npm run test && npm run lint && npm run typecheck",
57+
"prepublishOnly": "npm run checks",
1958
"prepare": "npm run build",
20-
"prepublishOnly": "npm run test && npm run lint",
21-
"version": "npm run test && npm run lint && git add -A src",
59+
"preversion": "npm run checks",
60+
"version": "git add -A src",
2261
"postversion": "git push && git push --tags"
2362
},
2463
"repository": {
@@ -28,8 +67,9 @@
2867
"private": false,
2968
"keywords": [
3069
"react",
70+
"query",
3171
"pagination",
32-
"hooks"
72+
"zod"
3373
],
3474
"author": "About Bits",
3575
"license": "MIT",
@@ -47,7 +87,6 @@
4787
"devDependencies": {
4888
"@testing-library/jest-dom": "^5.16.5",
4989
"@testing-library/react": "^13.4.0",
50-
"@types/jest": "^28.1.3",
5190
"@types/react": "^18.0.0",
5291
"@types/react-dom": "^18.0.0",
5392
"@types/react-router-dom": "^5.3.3",
@@ -56,33 +95,36 @@
5695
"eslint": "^8.18.0",
5796
"eslint-config-prettier": "^8.5.0",
5897
"eslint-plugin-import": "^2.26.0",
59-
"eslint-plugin-jest": "^26.5.3",
6098
"eslint-plugin-prettier": "^4.1.0",
6199
"eslint-plugin-react": "^7.32.2",
62100
"eslint-plugin-react-hooks": "^4.6.0",
63-
"jest": "^28.1.1",
64-
"jest-environment-jsdom": "^28.1.1",
101+
"jsdom": "^22.1.0",
65102
"next": "^13.1.3",
66103
"next-router-mock": "^0.7.4",
67104
"prettier": "^2.7.1",
68105
"react": "^18.0.0",
69106
"react-dom": "^18.0.0",
70107
"react-router-dom": "^6.7.0",
71108
"rimraf": "^5.0.1",
72-
"ts-jest": "^28.0.5",
73-
"typescript": "^5.1.6"
109+
"typescript": "^5.1.6",
110+
"vite": "^4.4.4",
111+
"vitest": "^0.33.0"
74112
},
75113
"peerDependencies": {
76114
"next": "^12.0.0 || ^13.0.0",
77115
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
78-
"react-router-dom": "^6.0.0"
116+
"react-router-dom": "^6.0.0",
117+
"zod": "^3.0.0"
79118
},
80119
"peerDependenciesMeta": {
81120
"next": {
82121
"optional": true
83122
},
84123
"react-router-dom": {
85124
"optional": true
125+
},
126+
"zod": {
127+
"optional": true
86128
}
87129
}
88130
}

0 commit comments

Comments
 (0)