Skip to content

Commit 9a77d6f

Browse files
build: update dependencies
1 parent 9a4673d commit 9a77d6f

File tree

13 files changed

+4908
-5297
lines changed

13 files changed

+4908
-5297
lines changed

.eslintrc.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
"jest": true,
44
"browser": true
55
},
6-
"extends": [
7-
"airbnb-typescript",
8-
"prettier",
9-
"prettier/react",
10-
"prettier/@typescript-eslint"
11-
],
6+
"extends": ["airbnb-typescript", "prettier"],
127
"parser": "@typescript-eslint/parser",
138
"plugins": ["@typescript-eslint", "prettier"],
149
"rules": {
10+
"@typescript-eslint/dot-notation": "off",
11+
"@typescript-eslint/no-implied-eval": "off",
12+
"@typescript-eslint/no-throw-literal": "off",
13+
"@typescript-eslint/return-await": "off",
1514
"consistent-return": "off",
1615
"default-case": "off",
1716
"import/prefer-default-export": "off",
@@ -20,6 +19,7 @@
2019
"prettier/prettier": "error",
2120
"react/no-multi-comp": "off",
2221
"react/prop-types": "off",
22+
"react/require-default-props": "off",
2323
"no-continue": "off",
2424
"no-nested-ternary": "off",
2525
"no-plusplus": "off"

package.json

+35-35
Original file line numberDiff line numberDiff line change
@@ -31,42 +31,42 @@
3131
}
3232
},
3333
"devDependencies": {
34-
"@babel/core": "^7.7.2",
35-
"@babel/preset-env": "^7.7.1",
36-
"@babel/preset-react": "^7.7.0",
37-
"@babel/preset-typescript": "^7.7.2",
38-
"@commitlint/cli": "^8.3.5",
39-
"@commitlint/config-conventional": "^8.3.4",
40-
"@testing-library/react": "^9.4.1",
41-
"@testing-library/react-hooks": "^3.2.1",
42-
"@types/jest": "^25.1.3",
43-
"@types/react": "^16.9.11",
44-
"@types/react-dom": "^16.9.4",
45-
"@types/react-test-renderer": "^16.9.1",
46-
"@typescript-eslint/eslint-plugin": "^2.7.0",
47-
"@typescript-eslint/parser": "^2.7.0",
48-
"all-contributors-cli": "^6.11.0",
49-
"conventional-changelog-conventionalcommits": "^4.2.3",
50-
"eslint": "^6.6.0",
51-
"eslint-config-airbnb-typescript": "^6.3.0",
52-
"eslint-config-prettier": "^6.5.0",
53-
"eslint-plugin-import": "^2.18.2",
54-
"eslint-plugin-jsx-a11y": "^6.2.3",
55-
"eslint-plugin-prettier": "^3.1.1",
56-
"eslint-plugin-react": "^7.16.0",
57-
"eslint-plugin-react-hooks": "^2.3.0",
58-
"husky": "^3.0.9",
59-
"jest": "^25.1.0",
60-
"lerna": "^3.18.4",
61-
"lint-staged": "^9.4.3",
62-
"microbundle": "^0.12.0-next.6",
63-
"prettier": "^2.0.5",
64-
"react": "^16.13.0",
65-
"react-dom": "^16.12.0",
66-
"react-test-renderer": "^16.12.0",
67-
"rimraf": "^2.6.2",
34+
"@babel/core": "^7.14.3",
35+
"@babel/preset-env": "^7.14.2",
36+
"@babel/preset-react": "^7.13.13",
37+
"@babel/preset-typescript": "^7.13.0",
38+
"@commitlint/cli": "^12.1.4",
39+
"@commitlint/config-conventional": "^12.1.4",
40+
"@testing-library/react": "^11.2.7",
41+
"@testing-library/react-hooks": "^6.0.0",
42+
"@types/jest": "^26.0.23",
43+
"@types/react": "^17.0.6",
44+
"@types/react-dom": "^17.0.5",
45+
"@types/react-test-renderer": "^17.0.1",
46+
"@typescript-eslint/eslint-plugin": "^4.24.0",
47+
"@typescript-eslint/parser": "^4.24.0",
48+
"all-contributors-cli": "^6.20.0",
49+
"conventional-changelog-conventionalcommits": "^4.6.0",
50+
"eslint": "^7.27.0",
51+
"eslint-config-airbnb-typescript": "^12.3.1",
52+
"eslint-config-prettier": "^8.3.0",
53+
"eslint-plugin-import": "^2.23.3",
54+
"eslint-plugin-jsx-a11y": "^6.4.1",
55+
"eslint-plugin-prettier": "^3.4.0",
56+
"eslint-plugin-react": "^7.23.2",
57+
"eslint-plugin-react-hooks": "^4.2.0",
58+
"husky": "^4.3.8",
59+
"jest": "^26.6.3",
60+
"lerna": "^4.0.0",
61+
"lint-staged": "^11.0.0",
62+
"microbundle": "^0.13.0",
63+
"prettier": "^2.3.0",
64+
"react": "^17.0.2",
65+
"react-dom": "^17.0.2",
66+
"react-test-renderer": "^17.0.2",
67+
"rimraf": "^3.0.2",
6868
"shelljs": "^0.8.3",
69-
"typescript": "^3.7.2"
69+
"typescript": "^4.2.4"
7070
},
7171
"workspaces": {
7272
"packages": [

packages/hooks/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@byteclaw/use-unique-id": "^1.0.1"
2525
},
2626
"peerDependencies": {
27-
"@types/react": "^16.9.11",
27+
"@types/react": "^16.9.11 || ^17.0.0",
2828
"react": "^16.12.0 || ^17.x"
2929
},
3030
"sideEffects": false,

packages/use-event-emitter/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"typecheck": "tsc --noEmit"
1818
},
1919
"peerDependencies": {
20-
"@types/react": "^16.9.11",
20+
"@types/react": "^16.9.11 || ^17.0.0",
2121
"react": "^16.12.0 || ^17.x"
2222
},
2323
"sideEffects": false,
@@ -39,7 +39,7 @@
3939
"bugs": {
4040
"url": "https://github.com/byteclaw/hooks/issues"
4141
},
42-
"homepage": "https://github.com/byteclaw/hooks/packages/use-event-emitter#readme",
42+
"homepage": "https://github.com/byteclaw/hooks/tree/master/packages/use-event-emitter#readme",
4343
"contributors": [
4444
{
4545
"name": "Michal Kvasničák",

packages/use-event-emitter/src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface EventEmitter<TEvents extends string> {
99
* Creates event emitter instance
1010
*/
1111
export function createEventEmitter<
12-
TEvents extends string = string
12+
TEvents extends string = string,
1313
>(): EventEmitter<TEvents> {
1414
const events: Record<TEvents, Function[]> = {} as Record<TEvents, Function[]>;
1515

@@ -37,7 +37,7 @@ EventEmitterContext.displayName = 'EventEmitterContext';
3737
* Connects to event emitter in context
3838
*/
3939
export function useEventEmitter<
40-
TEvents extends string = string
40+
TEvents extends string = string,
4141
>(): EventEmitter<TEvents> {
4242
return useContext(EventEmitterContext);
4343
}
@@ -47,7 +47,7 @@ export function useEventEmitter<
4747
* All subsequent calls return the same instance
4848
*/
4949
export function useEventEmitterInstance<
50-
TEvents extends string = string
50+
TEvents extends string = string,
5151
>(): EventEmitter<TEvents> {
5252
return useState(createEventEmitter())[0];
5353
}

packages/use-overflow-scroll-position/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"typecheck": "tsc --noEmit"
1818
},
1919
"peerDependencies": {
20-
"@types/react": "^16.9.11",
20+
"@types/react": "^16.9.11 || ^17.0.0",
2121
"react": "^16.12.0 || ^17.x"
2222
},
2323
"sideEffects": false,
@@ -34,7 +34,7 @@
3434
"bugs": {
3535
"url": "https://github.com/byteclaw/hooks/issues"
3636
},
37-
"homepage": "https://github.com/byteclaw/hooks/packages/use-overflow-scroll-position#readme",
37+
"homepage": "https://github.com/byteclaw/hooks/tree/master/packages/use-overflow-scroll-position#readme",
3838
"contributors": [
3939
{
4040
"name": "Michal Kvasničák",

packages/use-overflow-scroll-position/src/index.ts

+8-11
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ function useOverflowScrollPosition(ref: MutableRefObject<HTMLElement | null>) {
1010
[number | null, number | null]
1111
>([null, null]);
1212

13-
const handleScroll = useCallback(
14-
function handle() {
15-
if (ref.current != null) {
16-
setScrollProperties([
17-
ref.current.scrollTop + ref.current.clientHeight,
18-
ref.current.scrollHeight,
19-
]);
20-
}
21-
},
22-
[ref],
23-
);
13+
const handleScroll = useCallback(() => {
14+
if (ref.current != null) {
15+
setScrollProperties([
16+
ref.current.scrollTop + ref.current.clientHeight,
17+
ref.current.scrollHeight,
18+
]);
19+
}
20+
}, [ref]);
2421

2522
useLayoutEffect(() => {
2623
if (ref.current == null) {

packages/use-prompt/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@byteclaw/use-unique-id": "^1.0.1"
2222
},
2323
"peerDependencies": {
24-
"@types/react": "^16.9.11",
24+
"@types/react": "^16.9.11 || ^17.0.0",
2525
"react": "^16.12.0 || ^17.x"
2626
},
2727
"sideEffects": false,
@@ -43,7 +43,7 @@
4343
"bugs": {
4444
"url": "https://github.com/byteclaw/hooks/issues"
4545
},
46-
"homepage": "https://github.com/byteclaw/hooks/packages/use-prompt#readme",
46+
"homepage": "https://github.com/byteclaw/hooks/tree/master/packages/use-prompt#readme",
4747
"contributors": [
4848
{
4949
"name": "Michal Kvasničák",

packages/use-prompt/src/index.ts

+48-45
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ export function Prompts() {
4949

5050
// listen to events
5151
useEffect(() => {
52-
const unsubcribeAnswer = eventEmitter.on($$ANSWER_EVENT, (
53-
id: number /* value: any */,
54-
) => dispatch({ type: 'ANSWER', id }));
52+
const unsubcribeAnswer = eventEmitter.on(
53+
$$ANSWER_EVENT,
54+
(id: number /* value: any */) => dispatch({ type: 'ANSWER', id }),
55+
);
5556

5657
const unsubcribePrompt = eventEmitter.on(
5758
$$PROMPT_EVENT,
@@ -77,60 +78,62 @@ export interface PrompFunctionProps<TAnswer> {
7778
}
7879

7980
export interface PromptFunction<TAnswer> {
80-
(prompt: (props: PrompFunctionProps<TAnswer>) => ReactElement): Promise<
81-
TAnswer
82-
>;
81+
(
82+
prompt: (props: PrompFunctionProps<TAnswer>) => ReactElement,
83+
): Promise<TAnswer>;
8384
}
8485

8586
export function usePrompt<TAnswer>(): [PromptFunction<TAnswer>, boolean] {
8687
const id = useUniqueId();
8788
const eventEmitter = useEventEmitter();
8889
const [prompting, setPrompting] = useState(false);
89-
const prompt: PromptFunction<TAnswer> = useCallback(renderer => {
90-
return new Promise((resolve, reject) => {
91-
// subscribe to answer
92-
const handler: { unsubscribe: Function | null } = {
93-
unsubscribe: null,
94-
};
95-
96-
try {
97-
handler.unsubscribe = eventEmitter.on(
98-
$$ANSWER_EVENT,
99-
(promptId: number, value: any) => {
100-
if (id === promptId) {
101-
setPrompting(false);
102-
103-
if (handler.unsubscribe) {
104-
handler.unsubscribe();
105-
handler.unsubscribe = null;
90+
const prompt: PromptFunction<TAnswer> = useCallback(
91+
renderer =>
92+
new Promise((resolve, reject) => {
93+
// subscribe to answer
94+
const handler: { unsubscribe: Function | null } = {
95+
unsubscribe: null,
96+
};
97+
98+
try {
99+
handler.unsubscribe = eventEmitter.on(
100+
$$ANSWER_EVENT,
101+
(promptId: number, value: any) => {
102+
if (id === promptId) {
103+
setPrompting(false);
104+
105+
if (handler.unsubscribe) {
106+
handler.unsubscribe();
107+
handler.unsubscribe = null;
108+
}
109+
110+
resolve(value);
106111
}
112+
},
113+
);
107114

108-
resolve(value);
109-
}
110-
},
111-
);
112-
113-
setPrompting(true);
115+
setPrompting(true);
114116

115-
const comp = renderer({
116-
answer: value => {
117-
eventEmitter.emit($$ANSWER_EVENT, id, value);
118-
},
119-
});
117+
const comp = renderer({
118+
answer: value => {
119+
eventEmitter.emit($$ANSWER_EVENT, id, value);
120+
},
121+
});
120122

121-
eventEmitter.emit($$PROMPT_EVENT, id, comp);
122-
} catch (e) {
123-
if (handler.unsubscribe) {
124-
handler.unsubscribe();
125-
handler.unsubscribe = null;
126-
}
123+
eventEmitter.emit($$PROMPT_EVENT, id, comp);
124+
} catch (e) {
125+
if (handler.unsubscribe) {
126+
handler.unsubscribe();
127+
handler.unsubscribe = null;
128+
}
127129

128-
setPrompting(false);
130+
setPrompting(false);
129131

130-
reject(e);
131-
}
132-
});
133-
}, []);
132+
reject(e);
133+
}
134+
}),
135+
[],
136+
);
134137

135138
return [prompt, prompting];
136139
}

packages/use-static-callback/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"typecheck": "tsc --noEmit"
1818
},
1919
"peerDependencies": {
20-
"@types/react": "^16.9.11",
20+
"@types/react": "^16.9.11 || ^17.0.0",
2121
"react": "^16.12.0 || ^17.x"
2222
},
2323
"sideEffects": false,
@@ -36,7 +36,7 @@
3636
"bugs": {
3737
"url": "https://github.com/byteclaw/hooks/issues"
3838
},
39-
"homepage": "https://github.com/byteclaw/hooks/packages/use-static-callback#readme",
39+
"homepage": "https://github.com/byteclaw/hooks/tree/master/packages/use-static-callback#readme",
4040
"contributors": [
4141
{
4242
"name": "Michal Kvasničák",

packages/use-static-callback/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ export function useStaticCallback(
6363
* and returns the result as a callback
6464
*/
6565
export function useStaticCallbackCreator<
66-
T extends () => (...args: any[]) => any
66+
T extends () => (...args: any[]) => any,
6767
>(callback: T): ExtractReturn<T>;
6868
export function useStaticCallbackCreator<
69-
T extends (...args: any[]) => (...args: any[]) => any
69+
T extends (...args: any[]) => (...args1: any[]) => any,
7070
>(callback: T, args: ExtractArgs<T>): ExtractReturn<T>;
7171

7272
export function useStaticCallbackCreator(

packages/use-unique-id/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"typecheck": "tsc --noEmit"
1818
},
1919
"peerDependencies": {
20-
"@types/react": "^16.9.11",
20+
"@types/react": "^16.9.11 || ^17.0.0",
2121
"react": "^16.12.0 || ^17.x"
2222
},
2323
"sideEffects": false,
@@ -39,7 +39,7 @@
3939
"bugs": {
4040
"url": "https://github.com/byteclaw/hooks/issues"
4141
},
42-
"homepage": "https://github.com/byteclaw/hooks/packages/use-unique-id#readme",
42+
"homepage": "https://github.com/Byteclaw/hooks/tree/master/packages/use-unique-id#readme",
4343
"contributors": [
4444
{
4545
"name": "Michal Kvasničák",

0 commit comments

Comments
 (0)