Skip to content

Commit

Permalink
Bump hydrogen eslint plugin version (#1368)
Browse files Browse the repository at this point in the history
* Bump hydrogen eslint plugin version

This gets rid of the annoying error we're seeing while developing the monorepo

* Use new name for hook

* Update for more lax server component hooks rules
  • Loading branch information
jplhomer authored May 27, 2022
1 parent 7e9df89 commit 53d95bd
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module.exports = {
{
files: ['packages/eslint-plugin/**'],
rules: {
'hydrogen/no-state-in-server-components': 'off',
'hydrogen/server-component-banned-hooks': 'off',
'hydrogen/prefer-image-component': 'off',
'jsx-a11y/img-redundant-alt': 'off',
'no-prototype-builtins': 'off',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"chalk": "^4.1.2",
"cross-env": "^7.0.3",
"eslint": "^7.23.0",
"eslint-plugin-hydrogen": "^0.11.0",
"eslint-plugin-hydrogen": "^0.12.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-react": "^7.29.3",
"eslint-plugin-react-hooks": "^4.2.0",
Expand Down
3 changes: 0 additions & 3 deletions packages/hydrogen/src/entry-client.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable hydrogen/no-state-in-server-components */
import React, {
Suspense,
useState,
Expand Down Expand Up @@ -133,5 +132,3 @@ function Error({error}: {error: Error}) {
</div>
);
}

/* eslint-enable hydrogen/no-state-in-server-components */
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ function SomeApiDelayServerComponent({

throw promise;
});
/* eslint-disable react-hooks/rules-of-hooks */
useServerAnalytics({
[delayKey]: delay,
});
/* eslint-enable react-hooks/rules-of-hooks */
}
return <div>Api delay - {delay}</div>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ export function FileRoutes({routes, basePath, dirPrefix}: FileRoutesProps) {

basePath ??= '/';

/* eslint-disable react-hooks/rules-of-hooks */
const pageRoutes = useMemo(
() => createPageRoutes(routes!, basePath, dirPrefix),
[routes, basePath, dirPrefix]
);
/* eslint-enable react-hooks/rules-of-hooks */

let foundRoute, foundRouteDetails;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable hydrogen/no-state-in-server-components */
import React, {
createContext,
ReactNode,
Expand Down Expand Up @@ -169,5 +168,3 @@ export function ServerPropsProvider({
</ServerPropsContext.Provider>
);
}

/* eslint-enable hydrogen/no-state-in-server-components */
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export function ShopifyProvider({
let actualShopifyConfig: ShopifyConfig;

if (typeof shopifyConfig === 'function') {
// eslint-disable-next-line react-hooks/rules-of-hooks
const result = useRequestCacheData(['hydrogen-shopify-config'], () =>
(shopifyConfig as ShopifyConfigFetcher)(request)
);
Expand Down
19 changes: 0 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4989,25 +4989,6 @@ eslint-plugin-eslint-comments@^3.2.0:
escape-string-regexp "^1.0.5"
ignore "^5.0.5"

eslint-plugin-hydrogen@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-hydrogen/-/eslint-plugin-hydrogen-0.11.0.tgz#c0e90c52c937c0daa5cbb3dec0dcdb7d7ffc7056"
integrity sha512-fM1KD0E9KwNOF8bGREuB7LTHoxUkb2qdmZmZErXNzbMx51HNt9CXojtGuyUdkTFt6gvYO11JDzPzVyBUyI4gxQ==
dependencies:
"@typescript-eslint/eslint-plugin" "^4.26.0"
"@typescript-eslint/experimental-utils" "^4.0.1"
"@typescript-eslint/parser" "^4.26.0"
"@typescript-eslint/types" "^4.20.0"
eslint "^7.27.0"
eslint-config-prettier "^8.3.0"
eslint-plugin-eslint-comments "^3.2.0"
eslint-plugin-jest "^24.3.0"
eslint-plugin-jsx-a11y "^6.4.0"
eslint-plugin-prettier "^3.4.0"
eslint-plugin-react "^7.24.0"
eslint-plugin-react-hooks "^4.2.0"
prettier "^2.0.0"

eslint-plugin-jest@^24.3.0:
version "24.7.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.7.0.tgz#206ac0833841e59e375170b15f8d0955219c4889"
Expand Down

0 comments on commit 53d95bd

Please sign in to comment.