Skip to content

JSON Error in .prettierrc.json: LinesAndColumns$1 is not a constructor #8815

@Jernik

Description

@Jernik

Environments:

  • Prettier Version: 2.0.5
  • Running Prettier via: CLI and VsCode extension
  • Runtime: Node.js v12.18.1
  • Operating System: Windows

Steps to reproduce:
Follow the installation instructions here:
https://prettier.io/docs/en/install.html
and the configuration file documentation here:
https://prettier.io/docs/en/configuration.html

I have the configuration file .prettierrc.json :
{"tabWidth":4,"semi":true,"trailingComma":"es5"}

run npx prettier --write src/

Expected behavior:
prettier runs and formats my code

Actual behavior:
The error message from the CLI is

[error] Invalid configuration file `src\App.css`: JSON Error in C:\Users\mill0715\Code\Portal-Web\.prettierrc.json:
[error] LinesAndColumns$1 is not a constructor

I am getting the same error from the CLI, but I don't know how to get a stack trace/detailed logs from there, so here is the vscode "format on save" error logs that get spit out.

["ERROR" - 12:01:41 PM] Invalid prettier configuration file detected.
["ERROR" - 12:01:41 PM] JSON Error in c:\Users\mill0715\Code\Portal-Web\.prettierrc.json:
LinesAndColumns$1 is not a constructor
TypeError: JSON Error in c:\Users\mill0715\Code\Portal-Web\.prettierrc.json:
LinesAndColumns$1 is not a constructor
	at parseJson$1 (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:3200:21)
	at loadJson (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11009:22)
	at Explorer.loadFileContent (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11535:34)
	at Explorer.createCosmiconfigResult (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11540:38)
	at Explorer.loadSearchPlace (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11521:33)
	at async Explorer.searchDirectory (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11492:31)
	at async run (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11465:24)
	at async cacheWrapper (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11300:20)
	at async cacheWrapper (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11300:20)
	at async cacheWrapper (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11300:20)
	at async Explorer.search (c:\Users\mill0715\.vscode\extensions\esbenp.prettier-vscode-5.1.3\node_modules\prettier\third-party.js:11457:22)
	at async Promise.all (index 0)```

Metadata

Metadata

Assignees

No one assigned

    Labels

    locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions