Skip to content

Commit

Permalink
eslint-config: Bump @typescript-eslint (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhardy authored Nov 11, 2024
1 parent b7f8f18 commit a25eb5b
Show file tree
Hide file tree
Showing 25 changed files with 989 additions and 1,131 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@ojkelly
@nhardy
10 changes: 5 additions & 5 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
strategy:
matrix:
node-version:
- lts/hydrogen
- lts/iron
- lts/jod
- current

steps:
Expand All @@ -27,7 +27,7 @@ jobs:
fetch-depth: 0

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down Expand Up @@ -65,10 +65,10 @@ jobs:
with:
fetch-depth: 0

- name: Setup Node.js Hydrogen
uses: actions/setup-node@v3
- name: Setup Node.js Jod
uses: actions/setup-node@v4
with:
node-version: lts/hydrogen
node-version: lts/jod

- name: Install dependencies
run: yarn
Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,34 @@
]
},
"dependencies": {
"@changesets/cli": "^2.27.7",
"@manypkg/cli": "^0.21.4",
"@testing-library/jest-dom": "^6.4.6",
"@types/jest": "^29.5.12",
"@changesets/cli": "^2.27.9",
"@manypkg/cli": "^0.22.0",
"@testing-library/jest-dom": "^6.6.3",
"@types/jest": "^29.5.14",
"@types/jest-when": "^3.5.5",
"@types/lodash": "^4.17.6",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"core-js": "^3.37.1",
"eslint": "^8.57.0",
"@types/lodash": "^4.17.13",
"@types/node": "^22.9.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"core-js": "^3.39.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.4",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^24.1.0",
"jsdom": "^25.0.1",
"jsdom-global": "^3.0.2",
"lodash": "^4.17.21",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.2",
"prettier": "^3.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "^5.0.7",
"ts-jest": "^29.1.5",
"typescript": "^5.5.3"
"rimraf": "^6.0.1",
"ts-jest": "^29.2.5",
"typescript": "^5.6.3"
}
}
12 changes: 10 additions & 2 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ module.exports = {
files: ["*.js", "*.cjs"],
rules: {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-require-imports": "off",
},
},
{
Expand Down Expand Up @@ -164,7 +165,7 @@ module.exports = {
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"no-throw-literal": "off",
"@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/only-throw-error": "error",
// Allow void to be used to signify intentional ignoring of a Promise result
"no-void": "off",
"@typescript-eslint/no-meaningless-void-operator": "error",
Expand Down Expand Up @@ -193,7 +194,14 @@ module.exports = {
"@typescript-eslint/require-await": "off",
// Too opinionated for now, revisit later
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/switch-exhaustiveness-check": [
"error",
{
allowDefaultCaseForExhaustiveSwitch: true,
considerDefaultExhaustiveForUnions: true,
requireDefaultForNonUnion: true,
},
],
// Causes false positives with Jest mocks
// @see https://typescript-eslint.io/rules/unbound-method/#when-not-to-use-it
"@typescript-eslint/unbound-method": "off",
Expand Down
28 changes: 14 additions & 14 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/eslint-config",
"version": "0.0.21",
"version": "0.0.22",
"main": "index.js",
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/eslint-config",
"bugs": {
Expand All @@ -14,27 +14,27 @@
"clean": "exit 0",
"test": "exit 0"
},
"engines": {
"node": ">=20.9.0"
},
"peerDependencies": {
"eslint": "^7 || ^8"
"eslint": "^8"
},
"devDependencies": {
"eslint": "^8.57.0"
},
"engines": {
"node": ">=18.12.0"
"eslint": "^8.57.1"
},
"dependencies": {
"@kablamo/eslint-plugin": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/parser": "^8.13.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.4",
"eslint-plugin-react-hooks": "^4.6.2"
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0"
}
}
9 changes: 6 additions & 3 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
"clean": "exit 0",
"test": "src/test.js"
},
"engines": {
"node": ">=20.9.0"
},
"peerDependencies": {
"eslint": "^7 || ^8"
"eslint": "^8"
},
"devDependencies": {
"@types/eslint": "^8.56.10",
"eslint": "^8.57.0"
"@types/eslint": "^8.56.12",
"eslint": "^8.57.1"
}
}
4 changes: 2 additions & 2 deletions packages/kerosene-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
"dependencies": {
"@kablamo/kerosene": "^0.0.41",
"lodash": "^4.17.21",
"sinon": "^17.0.1"
"sinon": "^19.0.2"
},
"devDependencies": {
"@types/lodash": "^4.17.6",
"@types/lodash": "^4.17.13",
"@types/sinon": "^17.0.3",
"react": "^18.3.1",
"react-dom": "^18.3.1"
Expand Down
6 changes: 5 additions & 1 deletion packages/kerosene-test/src/react/createStubComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ export default function createStubComponent<
// eslint-disable-next-line react/no-unknown-property
<div __displayName__={displayName} {...props}>
{typeof children === "function"
? transformRenderPropResult(children(...getRenderProps(props)))
? transformRenderPropResult(
(children as (...args: RenderProps) => any)(
...getRenderProps(props),
),
)
: (children as React.ReactNode)}
</div>
),
Expand Down
26 changes: 13 additions & 13 deletions packages/kerosene-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/kerosene-ui",
"version": "0.0.43",
"version": "0.0.44",
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/kerosene-ui",
"bugs": {
"url": "https://github.com/KablamoOSS/kerosene/issues"
Expand Down Expand Up @@ -42,29 +42,29 @@
"devDependencies": {
"@kablamo/kerosene-test": "^0.0.17",
"@kablamo/rollup-plugin-resolve-externals": "^0.0.2",
"@optimize-lodash/rollup-plugin": "^4.0.4",
"@sinonjs/fake-timers": "^11.2.2",
"@tanstack/react-query": "^5.49.2",
"@testing-library/dom": "^10.3.0",
"@testing-library/react": "^16.0.0",
"@optimize-lodash/rollup-plugin": "^5.0.0",
"@sinonjs/fake-timers": "^13.0.5",
"@tanstack/react-query": "^5.59.20",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/lodash": "^4.17.6",
"@types/lodash": "^4.17.13",
"@types/sinonjs__fake-timers": "^8.1.5",
"@types/use-sync-external-store": "^0.0.6",
"esbuild": "^0.23.0",
"esbuild-register": "^3.5.0",
"esbuild": "^0.24.0",
"esbuild-register": "^3.6.0",
"jest-sandbox": "^1.1.2",
"jest-when": "^3.6.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.0.13",
"rollup": "^4.22.4",
"react-error-boundary": "^4.1.2",
"rollup": "^4.25.0",
"rollup-plugin-esbuild": "^6.1.1"
},
"peerDependencies": {
"@tanstack/react-query": ">=5.0.0 <6.0.0",
"react": ">=16.8.6",
"react-dom": ">=16.8.6",
"react": ">=18.3.1",
"react-dom": ">=18.3.1",
"react-error-boundary": ">=3.0.0 <5.0.0"
},
"peerDependenciesMeta": {
Expand Down
3 changes: 3 additions & 0 deletions packages/kerosene-ui/src/components/Boundaries/testHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
QueryObserverRefetchErrorResult,
QueryObserverSuccessResult,
} from "@tanstack/react-query";
import { noop } from "lodash";

function createQueryObserverBaseResult<
TData = unknown,
Expand Down Expand Up @@ -32,6 +33,7 @@ function createQueryObserverBaseResult<
isRefetching: false,
isStale: false,
isSuccess: false,
promise: new Promise<TData>(noop),
refetch: jest.fn(),
status: "pending",
fetchStatus: "idle",
Expand All @@ -51,6 +53,7 @@ export function createQueryObserverSuccessResult<TData, TError = never>(
isPending: false,
isRefetchError: false,
isSuccess: true,
promise: Promise.resolve(data),
status: "success",
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kerosene-ui/src/hooks/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function createUseStorage(storageArea: "localStorage" | "sessionStorage") {
? (JSON.parse(stored) as unknown)
: defaultValue;
return isT(parsed) ? parsed : defaultValue;
} catch (error) {
} catch {
return defaultValue;
}
},
Expand Down
3 changes: 1 addition & 2 deletions packages/kerosene-ui/src/hooks/useCurrentTime.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { MINUTE } from "@kablamo/kerosene";
import * as React from "react";
import { useSyncExternalStore } from "use-sync-external-store/shim";

interface CurrentTimeSubscription {
lastUpdatedAt: number;
Expand Down Expand Up @@ -187,7 +186,7 @@ export default function useCurrentTime(period?: number): number {
[emitter, period],
);

return useSyncExternalStore(
return React.useSyncExternalStore(
subscribe,
emitter.getCurrentTime,
emitter.getSsrTime,
Expand Down
4 changes: 2 additions & 2 deletions packages/kerosene-ui/src/hooks/useFocusVisible.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useSyncExternalStore } from "use-sync-external-store/shim";
import * as React from "react";
import {
ADD_EVENT_LISTENER_CAPTURE_PASSIVE_OPTIONS,
REMOVE_EVENT_LISTENER_CAPTURE_PASSIVE_OPTIONS,
Expand Down Expand Up @@ -42,5 +42,5 @@ const getServerSnapshot = () => false;
* Custom hook which returns whether there is any element on the page which has the :focus-visible pseudo class
*/
export default function useFocusVisible() {
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
return React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
}
4 changes: 1 addition & 3 deletions packages/kerosene-ui/src/hooks/useMediaQuery.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { noop } from "lodash";
import * as React from "react";
// Using shim for React 16 & 17 support instead of React.useSyncExternalStore
import { useSyncExternalStore } from "use-sync-external-store/shim";

export interface UseMediaQueryOptions {
/**
Expand Down Expand Up @@ -69,5 +67,5 @@ export default function useMediaQuery(
[defaultMatches],
);

return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
return React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
}
4 changes: 1 addition & 3 deletions packages/kerosene-ui/src/hooks/usePageVisibility.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import * as React from "react";
// Using shim for React 16 & 17 support instead of React.useSyncExternalStore
import { useSyncExternalStore } from "use-sync-external-store/shim";

const getServerSnapshot = () => true;

Expand Down Expand Up @@ -40,7 +38,7 @@ export default function usePageVisibility(
return useState ? visibility.current : true;
}, [useState]);

const visible = useSyncExternalStore(
const visible = React.useSyncExternalStore(
subscribe,
getSnapshot,
getServerSnapshot,
Expand Down
3 changes: 1 addition & 2 deletions packages/kerosene-ui/src/hooks/useTimeZone.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from "react";
import { useSyncExternalStore } from "use-sync-external-store/shim";

declare global {
interface WindowEventHandlersEventMap {
Expand Down Expand Up @@ -44,7 +43,7 @@ export default function useTimeZone() {
const ssrTimeZone = React.useContext(SSRTimeZoneContext);
const getServerSnapshot = React.useCallback(() => ssrTimeZone, [ssrTimeZone]);

return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
return React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
}

export interface TimeZoneProviderProps {
Expand Down
4 changes: 2 additions & 2 deletions packages/kerosene-ui/src/utils/listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ try {
};
window.addEventListener("test", noop, options);
window.removeEventListener("test", noop, {});
} catch (e) /* istanbul ignore next */ {
} catch /* istanbul ignore next */ {
isPassiveSupported = false;
}

Expand All @@ -29,7 +29,7 @@ try {
};
window.addEventListener("test", noop, options);
window.removeEventListener("test", noop, { capture: true });
} catch (e) /* istanbul ignore next */ {
} catch /* istanbul ignore next */ {
isCapturePassiveSupported = false;
}

Expand Down
Loading

0 comments on commit a25eb5b

Please sign in to comment.