Skip to content

Bug report: Upgrade action issue #5161

@Adam-it

Description

@Adam-it

Priority

(Low) Something is a little off

Description

Error caused by newline characters in overrides JSON while upgrading SPFx solution.
When running m365 spfx project upgrade --output md command on a project which is SPFx 1.15.0 version we get Add overrides in .eslintrc.js step. The Function property is given with break lines instead of \n which will actually produce and error in the file

image

Steps to reproduce

  1. for example -> download a spfx webpart sample from the pnp gallery that has exact spfx 1.15.0 version. I used the react roomchat
    https://github.com/pnp/sp-dev-fx-webparts/blob/main/samples/react-roomchat/.yo-rc.json
  2. using CLI run m365 spfx project upgrade --output md > "upgrade-report.md"
  3. when checking the .md report without any md preview just plain text we will see the linebreaks were removed

image

Expected results

the property should be given with \n like :

'Function': {
                'message': 'The \'Function\' type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \'new\'.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
              }

Actual results

it is given as

'Function': {
                'message': 'The \'Function\' type accepts any function-like value.
It provides no type safety when calling the function, which can be a common source of bugs.
It also accepts things like class declarations, which will throw at runtime as they will not be called with 'new'.
If you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
              }

Diagnostics

No response

CLI for Microsoft 365 version

6.8

nodejs version

v18.10.0

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

the issue was originally reported by @Saurabh7019 in the vscode-viva repo pnp/vscode-viva#60

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions