diff --git a/.eslintrc.js b/.eslintrc.js index fbee2cd326..e06931767b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,6 +6,14 @@ * - We should add "plugin:react/jsx-runtime", but not sure if this will cause problems for projects not using the new JSX transform * - Consider adding the rule "id-length" */ + +/** + * V9 migration WIP + * - eslint-plugin-storybook does not support v9 yet: https://github.com/storybookjs/eslint-plugin-storybook/issues/157 + * - eslint-plugin-testing-library does not support v9 yet: https://github.com/testing-library/eslint-plugin-testing-library/issues?q=is%3Aissue+is%3Aopen+v9 + * - @vitest/eslint-plugin supports v9, just need to replace @vitest/legacy-recommended: https://github.com/vitest-dev/eslint-plugin-vitest?tab=readme-ov-file#usage + * - Looks like @typescript-eslint/eslint-plugin and @typescript-eslint/parser can both be replaced by just typescript-eslint in v9: https://typescript-eslint.io/getting-started#step-2-configuration + */ module.exports = { env: { browser: true, diff --git a/@navikt/core/react/src/util/hooks/descendants/useDescendant.tsx b/@navikt/core/react/src/util/hooks/descendants/useDescendant.tsx index e27736a7e4..c5298e587d 100644 --- a/@navikt/core/react/src/util/hooks/descendants/useDescendant.tsx +++ b/@navikt/core/react/src/util/hooks/descendants/useDescendant.tsx @@ -16,7 +16,7 @@ export function createDescendantContext< K extends Record = object, >() { const [DescendantsContextProvider, useDescendantsContext] = createContext< - ReturnType + ReturnType >({ name: "DescendantsProvider", errorMessage: @@ -38,7 +38,7 @@ export function createDescendantContext< * - ref callback to register the descendant * - Its enabled index compared to other enabled descendants */ - function _useDescendant(options?: DescendantOptions) { + function useDescendant(options?: DescendantOptions) { const descendants = useDescendantsContext(); const [index, setIndex] = useState(-1); const ref = useRef(null); @@ -74,7 +74,7 @@ export function createDescendantContext< * @internal * Initializing DescendantsManager */ - function _useDescendants() { + function useDescendants() { const descendants = useRef(new DescendantsManager()).current; return descendants; @@ -86,8 +86,8 @@ export function createDescendantContext< // call this when you need to read from context useDescendantsContext, // descendants state information, to be called and passed to `ContextProvider` - _useDescendants, + useDescendants, // descendant index information - _useDescendant, + useDescendant, ] as const; } diff --git a/package.json b/package.json index f2392c0eb1..4cfd827bbf 100644 --- a/package.json +++ b/package.json @@ -169,12 +169,12 @@ "cross-env": "^7.0.0", "eslint": "^8.50.0", "eslint-plugin-aksel-local": "*", - "eslint-plugin-import": "^2.28.1", - "eslint-plugin-jsx-a11y": "^6.7.1", - "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-jsx-a11y": "^6.10.0", + "eslint-plugin-react": "^7.37.1", + "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-storybook": "^0.9.0", - "eslint-plugin-testing-library": "^6.0.2", + "eslint-plugin-testing-library": "^6.3.2", "fast-glob": "3.2.11", "husky": "^8.0.0", "lint-staged": "13.0.3", diff --git a/yarn.lock b/yarn.lock index bd45f6502f..4f1803f8a5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6928,7 +6928,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:^5.58.0, @typescript-eslint/utils@npm:^5.62.0": +"@typescript-eslint/utils@npm:^5.62.0": version: 5.62.0 resolution: "@typescript-eslint/utils@npm:5.62.0" dependencies: @@ -7725,12 +7725,12 @@ __metadata: cross-env: "npm:^7.0.0" eslint: "npm:^8.50.0" eslint-plugin-aksel-local: "npm:*" - eslint-plugin-import: "npm:^2.28.1" - eslint-plugin-jsx-a11y: "npm:^6.7.1" - eslint-plugin-react: "npm:^7.33.2" - eslint-plugin-react-hooks: "npm:^4.6.0" + eslint-plugin-import: "npm:^2.31.0" + eslint-plugin-jsx-a11y: "npm:^6.10.0" + eslint-plugin-react: "npm:^7.37.1" + eslint-plugin-react-hooks: "npm:^5.0.0" eslint-plugin-storybook: "npm:^0.9.0" - eslint-plugin-testing-library: "npm:^6.0.2" + eslint-plugin-testing-library: "npm:^6.3.2" fast-glob: "npm:3.2.11" husky: "npm:^8.0.0" lint-staged: "npm:13.0.3" @@ -11684,7 +11684,7 @@ __metadata: languageName: unknown linkType: soft -"eslint-plugin-import@npm:^2.28.1": +"eslint-plugin-import@npm:^2.31.0": version: 2.31.0 resolution: "eslint-plugin-import@npm:2.31.0" dependencies: @@ -11713,7 +11713,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-jsx-a11y@npm:^6.7.1": +"eslint-plugin-jsx-a11y@npm:^6.10.0": version: 6.10.0 resolution: "eslint-plugin-jsx-a11y@npm:6.10.0" dependencies: @@ -11739,16 +11739,16 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-react-hooks@npm:^4.6.0": - version: 4.6.2 - resolution: "eslint-plugin-react-hooks@npm:4.6.2" +"eslint-plugin-react-hooks@npm:^5.0.0": + version: 5.0.0 + resolution: "eslint-plugin-react-hooks@npm:5.0.0" peerDependencies: - eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 - checksum: 10/5a0680941f34e70cf505bcb6082df31a3e445d193ee95a88ff3483041eb944f4cefdaf7e81b0eb1feb4eeceee8c7c6ddb8a2a6e8c4c0388514a42e16ac7b7a69 + eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 + checksum: 10/b762789832806b6981e2d910994e72aa7a85136fe0880572334b26cf1274ba37bd3b1365e77d2c2f92465337c4a65c84ef647bc499d33b86fc1110f2df7ef1bb languageName: node linkType: hard -"eslint-plugin-react@npm:^7.33.2": +"eslint-plugin-react@npm:^7.37.1": version: 7.37.1 resolution: "eslint-plugin-react@npm:7.37.1" dependencies: @@ -11790,14 +11790,14 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-testing-library@npm:^6.0.2": - version: 6.3.0 - resolution: "eslint-plugin-testing-library@npm:6.3.0" +"eslint-plugin-testing-library@npm:^6.3.2": + version: 6.4.0 + resolution: "eslint-plugin-testing-library@npm:6.4.0" dependencies: - "@typescript-eslint/utils": "npm:^5.58.0" + "@typescript-eslint/utils": "npm:^5.62.0" peerDependencies: - eslint: ^7.5.0 || ^8.0.0 - checksum: 10/192b112f84f90cc7eee28965b3e7792e8d4cda71aa29690d8180f1ae9cd0e8d6a8851ee992d37285a76750f8638c04e76f768e1885168f060ca169b72ac9ec6c + eslint: ^7.5.0 || ^8.0.0 || ^9.0.0 + checksum: 10/b9461e6662542fbfb3c0b768e6038bbaa56e345cb0600c7f07e26ff8154166abb9f7dcdc08d565c314cd9ccf0416eca8c3ce3c235b375c5fbf3f152a81142969 languageName: node linkType: hard