Skip to content

Commit

Permalink
Merge pull request #1391 from no23reason/eslint-ts-6
Browse files Browse the repository at this point in the history
build: upgrade typescript eslint to 6.0.0
  • Loading branch information
no23reason authored Jul 15, 2023
2 parents 7968086 + b43ea82 commit 49ba60b
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 112 deletions.
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const commonExtends = [
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended",
];

module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: commonExtends,
overrides: [
{
files: ["./src/**/*.ts", "./src/**/*.tsx"],
parserOptions: {
project: ["./tsconfig.json"],
},
extends: [
...commonExtends,
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/strict",
],
},
],
settings: {
react: {
version: "detect",
},
},
ignorePatterns: "demo",
};
24 changes: 0 additions & 24 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion demo/DemoPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef } from "react";
import React from "react";
import { Demo } from "./Demo";

export const DemoPage = () => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"@types/jest": "^29.2.1",
"@types/react": "^18.0.9",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.26.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"autoprefixer": "^10.4.2",
"cz-conventional-changelog": "^3.0.2",
"eslint": "^8.7.0",
Expand Down
29 changes: 17 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function useGeolocated(config: GeolocatedConfig = {}): GeolocatedResult {

const userDecisionTimeoutId = useRef(0);
const isCurrentlyMounted = useRef(true);
const watchId = useRef<number | void>(0);
const watchId = useRef<number>(0);

const [isGeolocationEnabled, setIsGeolocationEnabled] = useState(
isOptimisticGeolocationEnabled,
Expand Down Expand Up @@ -160,23 +160,25 @@ export function useGeolocated(config: GeolocatedConfig = {}): GeolocatedResult {
throw new Error("The provided geolocation provider is invalid");
}

const funcPosition = (
watchPosition
? geolocationProvider.watchPosition
: geolocationProvider.getCurrentPosition
).bind(geolocationProvider);

if (userDecisionTimeout) {
userDecisionTimeoutId.current = window.setTimeout(() => {
handlePositionError();
}, userDecisionTimeout);
}

watchId.current = funcPosition(
handlePositionSuccess,
handlePositionError,
positionOptions,
);
if (watchPosition) {
watchId.current = geolocationProvider.watchPosition(
handlePositionSuccess,
handlePositionError,
positionOptions,
);
} else {
geolocationProvider.getCurrentPosition(
handlePositionSuccess,
handlePositionError,
positionOptions,
);
}
}, [
geolocationProvider,
watchPosition,
Expand All @@ -201,6 +203,9 @@ export function useGeolocated(config: GeolocatedConfig = {}): GeolocatedResult {
permission.onchange = () => {
setPermissionState(permission.state);
};
})
.catch((e) => {
console.error("Error updating the permissions", e);
});
}

Expand Down
165 changes: 92 additions & 73 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,23 @@
dependencies:
eslint-visitor-keys "^3.3.0"

"@eslint-community/eslint-utils@^4.3.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==
dependencies:
eslint-visitor-keys "^3.3.0"

"@eslint-community/regexpp@^4.4.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.4.0.tgz#3e61c564fcd6b921cb789838631c5ee44df09403"
integrity sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ==

"@eslint-community/regexpp@^4.5.0":
version "4.5.1"
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884"
integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==

"@eslint/eslintrc@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.0.tgz#82256f164cc9e0b59669efc19d57f8092706841d"
Expand Down Expand Up @@ -2019,10 +2031,10 @@
"@types/tough-cookie" "*"
parse5 "^7.0.0"

"@types/json-schema@^7.0.9":
version "7.0.11"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==
"@types/json-schema@^7.0.11":
version "7.0.12"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb"
integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==

"@types/minimatch@^3.0.3":
version "3.0.3"
Expand Down Expand Up @@ -2121,89 +2133,93 @@
dependencies:
"@types/yargs-parser" "*"

"@typescript-eslint/eslint-plugin@^5.59.5":
version "5.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.61.0.tgz#a1a5290cf33863b4db3fb79350b3c5275a7b1223"
integrity sha512-A5l/eUAug103qtkwccSCxn8ZRwT+7RXWkFECdA4Cvl1dOlDUgTpAOfSEElZn2uSUxhdDpnCdetrf0jvU4qrL+g==
dependencies:
"@eslint-community/regexpp" "^4.4.0"
"@typescript-eslint/scope-manager" "5.61.0"
"@typescript-eslint/type-utils" "5.61.0"
"@typescript-eslint/utils" "5.61.0"
"@typescript-eslint/eslint-plugin@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.0.0.tgz#19ff4f1cab8d6f8c2c1825150f7a840bc5d9bdc4"
integrity sha512-xuv6ghKGoiq856Bww/yVYnXGsKa588kY3M0XK7uUW/3fJNNULKRfZfSBkMTSpqGG/8ZCXCadfh8G/z/B4aqS/A==
dependencies:
"@eslint-community/regexpp" "^4.5.0"
"@typescript-eslint/scope-manager" "6.0.0"
"@typescript-eslint/type-utils" "6.0.0"
"@typescript-eslint/utils" "6.0.0"
"@typescript-eslint/visitor-keys" "6.0.0"
debug "^4.3.4"
grapheme-splitter "^1.0.4"
graphemer "^1.4.0"
ignore "^5.2.0"
ignore "^5.2.4"
natural-compare "^1.4.0"
natural-compare-lite "^1.4.0"
semver "^7.3.7"
tsutils "^3.21.0"
semver "^7.5.0"
ts-api-utils "^1.0.1"

"@typescript-eslint/parser@^5.26.0":
version "5.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.61.0.tgz#7fbe3e2951904bb843f8932ebedd6e0635bffb70"
integrity sha512-yGr4Sgyh8uO6fSi9hw3jAFXNBHbCtKKFMdX2IkT3ZqpKmtAq3lHS4ixB/COFuAIJpwl9/AqF7j72ZDWYKmIfvg==
"@typescript-eslint/parser@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.0.0.tgz#46b2600fd1f67e62fc00a28093a75f41bf7effc4"
integrity sha512-TNaufYSPrr1U8n+3xN+Yp9g31vQDJqhXzzPSHfQDLcaO4tU+mCfODPxCwf4H530zo7aUBE3QIdxCXamEnG04Tg==
dependencies:
"@typescript-eslint/scope-manager" "5.61.0"
"@typescript-eslint/types" "5.61.0"
"@typescript-eslint/typescript-estree" "5.61.0"
"@typescript-eslint/scope-manager" "6.0.0"
"@typescript-eslint/types" "6.0.0"
"@typescript-eslint/typescript-estree" "6.0.0"
"@typescript-eslint/visitor-keys" "6.0.0"
debug "^4.3.4"

"@typescript-eslint/scope-manager@5.61.0":
version "5.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.61.0.tgz#b670006d069c9abe6415c41f754b1b5d949ef2b2"
integrity sha512-W8VoMjoSg7f7nqAROEmTt6LoBpn81AegP7uKhhW5KzYlehs8VV0ZW0fIDVbcZRcaP3aPSW+JZFua+ysQN+m/Nw==
"@typescript-eslint/scope-manager@6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.0.0.tgz#8ede47a37cb2b7ed82d329000437abd1113b5e11"
integrity sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg==
dependencies:
"@typescript-eslint/types" "5.61.0"
"@typescript-eslint/visitor-keys" "5.61.0"
"@typescript-eslint/types" "6.0.0"
"@typescript-eslint/visitor-keys" "6.0.0"

"@typescript-eslint/type-utils@5.61.0":
version "5.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.61.0.tgz#e90799eb2045c4435ea8378cb31cd8a9fddca47a"
integrity sha512-kk8u//r+oVK2Aj3ph/26XdH0pbAkC2RiSjUYhKD+PExemG4XSjpGFeyZ/QM8lBOa7O8aGOU+/yEbMJgQv/DnCg==
"@typescript-eslint/type-utils@6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.0.0.tgz#0478d8a94f05e51da2877cc0500f1b3c27ac7e18"
integrity sha512-ah6LJvLgkoZ/pyJ9GAdFkzeuMZ8goV6BH7eC9FPmojrnX9yNCIsfjB+zYcnex28YO3RFvBkV6rMV6WpIqkPvoQ==
dependencies:
"@typescript-eslint/typescript-estree" "5.61.0"
"@typescript-eslint/utils" "5.61.0"
"@typescript-eslint/typescript-estree" "6.0.0"
"@typescript-eslint/utils" "6.0.0"
debug "^4.3.4"
tsutils "^3.21.0"
ts-api-utils "^1.0.1"

"@typescript-eslint/types@5.61.0":
version "5.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.61.0.tgz#e99ff11b5792d791554abab0f0370936d8ca50c0"
integrity sha512-ldyueo58KjngXpzloHUog/h9REmHl59G1b3a5Sng1GfBo14BkS3ZbMEb3693gnP1k//97lh7bKsp6/V/0v1veQ==
"@typescript-eslint/types@6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.0.0.tgz#19795f515f8decbec749c448b0b5fc76d82445a1"
integrity sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg==

"@typescript-eslint/typescript-estree@5.61.0":
version "5.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.61.0.tgz#4c7caca84ce95bb41aa585d46a764bcc050b92f3"
integrity sha512-Fud90PxONnnLZ36oR5ClJBLTLfU4pIWBmnvGwTbEa2cXIqj70AEDEmOmpkFComjBZ/037ueKrOdHuYmSFVD7Rw==
"@typescript-eslint/typescript-estree@6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.0.0.tgz#1e09aab7320e404fb9f83027ea568ac24e372f81"
integrity sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ==
dependencies:
"@typescript-eslint/types" "5.61.0"
"@typescript-eslint/visitor-keys" "5.61.0"
"@typescript-eslint/types" "6.0.0"
"@typescript-eslint/visitor-keys" "6.0.0"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
semver "^7.3.7"
tsutils "^3.21.0"
semver "^7.5.0"
ts-api-utils "^1.0.1"

"@typescript-eslint/utils@5.61.0":
version "5.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.61.0.tgz#5064838a53e91c754fffbddd306adcca3fe0af36"
integrity sha512-mV6O+6VgQmVE6+xzlA91xifndPW9ElFW8vbSF0xCT/czPXVhwDewKila1jOyRwa9AE19zKnrr7Cg5S3pJVrTWQ==
"@typescript-eslint/utils@6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.0.0.tgz#27a16d0d8f2719274a39417b9782f7daa3802db0"
integrity sha512-SOr6l4NB6HE4H/ktz0JVVWNXqCJTOo/mHnvIte1ZhBQ0Cvd04x5uKZa3zT6tiodL06zf5xxdK8COiDvPnQ27JQ==
dependencies:
"@eslint-community/eslint-utils" "^4.2.0"
"@types/json-schema" "^7.0.9"
"@eslint-community/eslint-utils" "^4.3.0"
"@types/json-schema" "^7.0.11"
"@types/semver" "^7.3.12"
"@typescript-eslint/scope-manager" "5.61.0"
"@typescript-eslint/types" "5.61.0"
"@typescript-eslint/typescript-estree" "5.61.0"
"@typescript-eslint/scope-manager" "6.0.0"
"@typescript-eslint/types" "6.0.0"
"@typescript-eslint/typescript-estree" "6.0.0"
eslint-scope "^5.1.1"
semver "^7.3.7"
semver "^7.5.0"

"@typescript-eslint/visitor-keys@5.61.0":
version "5.61.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.61.0.tgz#c79414fa42158fd23bd2bb70952dc5cdbb298140"
integrity sha512-50XQ5VdbWrX06mQXhy93WywSFZZGsv3EOjq+lqp6WC2t+j3mb6A9xYVdrRxafvK88vg9k9u+CT4l6D8PEatjKg==
"@typescript-eslint/visitor-keys@6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.0.0.tgz#0b49026049fbd096d2c00c5e784866bc69532a31"
integrity sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==
dependencies:
"@typescript-eslint/types" "5.61.0"
eslint-visitor-keys "^3.3.0"
"@typescript-eslint/types" "6.0.0"
eslint-visitor-keys "^3.4.1"

JSONStream@^1.3.5:
version "1.3.5"
Expand Down Expand Up @@ -4376,6 +4392,11 @@ graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11,
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==

grapheme-splitter@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e"
integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==

graphemer@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6"
Expand Down Expand Up @@ -7652,7 +7673,7 @@ semver@^6.0.0, semver@^6.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==

semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.2, semver@^7.5.3:
semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.0, semver@^7.5.2, semver@^7.5.3:
version "7.5.4"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
Expand Down Expand Up @@ -8268,6 +8289,11 @@ trim-newlines@^3.0.0:
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"
integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==

ts-api-utils@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.1.tgz#8144e811d44c749cd65b2da305a032510774452d"
integrity sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==

ts-interface-checker@^0.1.9:
version "0.1.13"
resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699"
Expand Down Expand Up @@ -8305,7 +8331,7 @@ ts-node@^10.4.0:
make-error "^1.1.1"
yn "3.1.1"

tslib@^1.8.1, tslib@^1.9.0:
tslib@^1.9.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
Expand All @@ -8315,13 +8341,6 @@ tslib@^2.4.0, tslib@^2.5.0, tslib@^2.6.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3"
integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==

tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==
dependencies:
tslib "^1.8.1"

tuf-js@^1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/tuf-js/-/tuf-js-1.1.7.tgz#21b7ae92a9373015be77dfe0cb282a80ec3bbe43"
Expand Down

0 comments on commit 49ba60b

Please sign in to comment.