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.

.prettierrc file not affect on rules

See original GitHub issue

Hi,I write project using create-react-app and want to integrate prettier with eslint .

My package.json contain : "eslint-config-prettier": "^2.9.0", "eslint-plugin-prettier": "^2.6.2", "prettier": "^1.13.7", "pretty-quick": "^1.6.0"

.eslintrc file contain: { "extends": ["react-app", "plugin:prettier/recommended"], }

Now i have error that annoyed me and i want to cancel him: [eslint] Replace '../Admin.module.css' with "../Admin.module.css" (prettier/prettier)

So , I try to add .prettierrc file to my project and to add him this json: { "avoidEscape": true }

and also try to set this: { singleQuote: true }

But nothing happened! I try to add also another rules but also nothing happened …it’s looks like this file not affect anything and it’s stay the same What I am doing wrong?

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

50reactions
xuchaobeicommented, Apr 10, 2019

I also meet the issue. After a period of trial, I think the eslint plugin of vscode casue the issue. When changing rules in .prettier.js , the eslint server plugged in vsocde doesn’t reload the updated rules. But if you run eslint through terminal, you will find the new rules are applied.

One solution is to reopen the vscode, then eslint server will restart and load the new rules in .prettier.js.

26reactions
pmithunishcommented, Sep 29, 2018

Using the following setup

{
  "extends": ["react-app", "prettier"],
  "rules": {
    "prettier/prettier": "error"
  },
  "plugins": ["prettier"]
}

instead of the shorthand { extends: ["react-app", "plugin:prettier/recommended"] } did the trick for me. Read more about this here. Hope it helps 😃.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier doesn't format based on my eslint config - Stack Overflow
1 Answer 1 · move .prettierrc content in .eslint (not recommended because prettier plugins sometimes do not read this file); · run from...
Read more >
Configuration File - Prettier
By default, Prettier automatically infers which parser to use based on the input file extension. Combined with overrides you can teach Prettier how...
Read more >
Integrating with Linters - Prettier
Most stylistic rules are unnecessary when using Prettier, but worse – they might conflict with Prettier! Use Prettier for code formatting concerns, and...
Read more >
Options - Prettier
In code styleguides, maximum line length rules are often set to 100 or 120. ... Prettier's printWidth option does not work the same...
Read more >
Ignoring Code - Prettier
Use .prettierignore to ignore (i.e. not reformat) certain files and folders completely. Use “prettier-ignore” comments to ignore parts of files.
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