Skip to content

Bug report: building non-React SPFx projects after upgrading to v1.15.0 using CLI fails #3475

@waldekmastykarz

Description

@waldekmastykarz

Description

After upgrading a non-React SPFx project to v1.15.0, when you try to build it, you get an error.

Steps to reproduce

Upgrade non-React SPFx project to v1.15.0 using CLI

Expected results

SPFx project builds fine

Actual results

[08:04:11] Error - [lint] Unexpected STDERR output from ESLint: 
Oops! Something went wrong! :(
ESLint: 8.7.0
ESLint couldn't find the plugin "eslint-plugin-react-hooks".
(The package "eslint-plugin-react-hooks" was not found when loaded as a Node module from the directory "/home/runner/work/microsoft-graph-toolkit/microsoft-graph-toolkit/packages/mgt-spfx".)
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
    npm install eslint-plugin-react-hooks@latest --save-dev
The plugin "eslint-plugin-react-hooks" was referenced from the config file in ".eslintrc.js » @microsoft/eslint-config-spfx/lib/profiles/react".
If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

Diagnostics

No response

CLI for Microsoft 365 version

latest from main

nodejs version

12.22.12

Operating system (environment)

macOS

Shell

zsh

cli doctor

No response

Additional Info

This error is caused, by the following line in CLI for M365:

extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],

Here, we always assume that the project should use a React profile for ESLint. This profile however, requires an additional dependency FN002025 which we suggest only for React projects.

To fix this, we need to adjust

extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],
to be as-is for React projects and extends: ['@microsoft/eslint-config-spfx/lib/profiles/default'], for non-React.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions