question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Prettier 1.19.1 CLI doesn't respect configuration

See original GitHub issue

Apologies if this is a duplicate. I searched and while I see other regression issues related to v1.19.1, I’m not seeing anything that looks quite right.

This issue is similar, however:

  1. The solution did not work for me.
  2. My issue was primarily with the CLI, though the behavior was mirrored by the VSCode extension (tried v2.3.0 and v3.11.0)

Environments:

  • Prettier Version: v1.19.1
  • Running Prettier via: CLI
  • Runtime: Node.js v12.13.0
  • Operating System: macOS v10.15.2
  • prettylint: v1.0.0

Steps to reproduce:

Running the npm script: "npm run lint": "prettylint 'src/**/*.{ts,tsx}'"

where my prettierrc.js is:

module.exports = {
    printWidth: 120,
    tabWidth: 4,
    useTabs: false,
    semi: true,
    singleQuote: false,
    trailingComma: "all",
    bracketSpacing: true,
    arrowParens: "avoid",
    proseWrap: "preserve",
};

Run it on a .tsx file with the function:

export const configuration = createSelector(
    [getState],
    state => state.configuration,
);

And you’ll get the error

> @revolution/web@0.3.0 lint:prettylint /Users/stephen/_coding/remine/revolution/web
> prettylint 'src/**/*.{ts,tsx}' --config ../.prettierrc.js

<path to file>:4:44
  ⚠    4:44  Replace ⏎····[getState],⏎····state·=>·state.configuration,⏎ with [getState],·state·=>·state.configuration                                                                                                                                  prettier/prettier

Note, I added the --config ../.prettierrc.js after confirming that that was the config identified for the file (it’s also the one I hoped would be used) with the --find-config-path option (https://github.com/prettier/prettier/blob/master/docs/cli.md#--find-config-path-and---config).

Expected behavior:

Running prettier on this file should produce no errors.

Actual behavior:

Running prettier produced errors and when I tried running it with --fix, it performed that action successfully.

Workaround: Downgrade version to v1.18.2 All of my configurations were respected and I stopped getting conflicting error messages (conflicting between my configuration and Prettier).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
no-response[bot]commented, Dec 24, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don’t have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

0reactions
brodybitscommented, Dec 24, 2019

This issue has been automatically closed because there has been no response

A warning would have been nice, the stale bot does before closing old issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CLI - Prettier
Use the `prettier` command to run Prettier from the command line. ... Prettier CLI proceeds with that file and doesn't resolve the path...
Read more >
In VS Code, I'm getting this error, 'Failed to load module ...
This is a solution that worked for me. 1. Install Prettier Globally via npm if you have never installed it globally npm i...
Read more >
prettierx | Yarn - Package Manager
An unofficial fork of the Prettier code formatter, intended to provide some additional options to help improve consistency with "Standard JS" ( feross/standard...
Read more >
eslint/eslint - Gitter
Hi Guys, I want to ask how can I set eslint to skip certain config file? I have a .eslintrc.js file (not in...
Read more >
detected local configuration (i.e. .prettierrc or .editorconfig), vs ...
Why Prettier doesn't follow my .prettierrc.json file? ... Now the Prettier extension respect your local .prettierrc config files. Basically Prettier: Config ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found