-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Failed to load plugin 'react-hooks' declared in ' » eslint-config-next/core-web-vitals #78813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Update: After install: This error is the next: Need install manually: |
Thanks @daikiejp , your solution saved my time! 🆙 I do think Next.js need to update deps for ESLint for pnpm v10 |
This comment has been minimized.
This comment has been minimized.
After trying Another way to fix the issue with # pnpm-workspace.yaml
publicHoistPattern:
- "@next/eslint-plugin-next"
- "eslint-plugin-react-hooks" Then remove Then in VSCode run |
Nice @nattui but it causes one warning with successfully linting when running Here is code: import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
recommendedConfig: js.configs.recommended,
});
const eslintConfig = [
...compat.config({
extends: ["next/core-web-vitals", "next/typescript", "prettier", "plugin:drizzle/recommended"],
plugins: ["import", "drizzle", "@typescript-eslint"],
parser: "@typescript-eslint/parser",
ignorePatterns: [
"node_modules",
"dist",
"build",
"public",
"eslint.config.mjs",
"prettier.config.mjs",
"postcss.config.mjs",
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
project: "./tsconfig.json",
},
settings: {
"import/resolver": { typescript: { alwaysTryTypes: true } },
next: { rootDir: "./src" },
},
rules: {
// Base rules
semi: ["error", "always"],
quotes: ["error", "double", { avoidEscape: true }],
"comma-spacing": ["error", { before: false, after: true }],
"prefer-template": "error",
"arrow-body-style": ["error", "as-needed"],
"no-var": "error",
"no-param-reassign": "error",
"object-shorthand": ["error", "always"],
"no-multiple-empty-lines": ["warn", { max: 1, maxEOF: 0 }],
"prefer-const": ["error", { ignoreReadBeforeAssign: true }],
// TypeScript specific rules
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
// Import rules
"import/no-duplicates": "error",
"import/no-unresolved": "error",
"import/first": "error",
"no-duplicate-imports": "off", // Turning off in favor of import/no-duplicates
// Additional strict rules
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-unused-expressions": "error",
"max-depth": ["error", 4],
},
}),
];
export default eslintConfig; |
Hi @coderrshyam, nice eslint configs! Does this still show the warning for you? publicHoistPattern:
- "*eslint*" |
Yes @nattui I had already added the following code in auto-install-peers=true
lockfile=true
save-exact=true
strict-peer-dependencies=false
public-hoist-pattern[]=*import-in-the-middle*
public-hoist-pattern[]=*require-in-the-middle*
public-hoist-pattern[]=*@next/eslint-plugin-next*
public-hoist-pattern[]=*eslint-plugin-react-hooks*
public-hoist-pattern[]=*eslint* |
@coderrshyam How about replacing |
No! @nattui I cann't do that, the behaviour of |
Uh oh!
There was an error while loading. Please reload this page.
Link to the code that reproduces this issue
https://github.com/daikiejp/eslint-plugin-react-hooks
To Reproduce
Failed to load plugin 'react-hooks' declared in ' » eslint-config-next/core-web-vitals
Complete error:
This error is related to #73964
Current vs. Expected behavior
While the fix is simple (
pnpm add -D eslint-plugin-react-hooks
), it would greatly Next.js should handle peer dependencies and install them in pnpm.Provide environment information
Which area(s) are affected? (Select all that apply)
Error Handling, Linting
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
There's no documentation in
eslint-config-next
about required peer plugins.The text was updated successfully, but these errors were encountered: