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.

Does prettier have an API that can show the detail for lint info

See original GitHub issue

Environments:

  • Prettier Version: 1.15.3
  • Running Prettier via: prettier.check(code, {parser: 'css', tabWidth: 4})
  • Runtime: Node.js v9
  • Operating System: macOS

Expected behavior: I wanna use API to scan a file where doesn’t match the prettier rules and returns me the info, but when I use prettier.check, it just return a Boolean, or if I use prettier.format, it will only prompt where prettier can’t format the code. I have read the docs in https://prettier.io/docs/en/api.html, but I can’t find the API which I needed.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
duailibecommented, Jan 14, 2019

@j-f1 That’s ESLint… I think that’s just an example of what they wanted.

@xtx1130 We don’t generate that kind of information and do intend to do it. Since Prettier just parses the code, generates an AST and then prints everything we don’t really “monitor” what changed.

The eslint-plugin-prettier ESLint plugin, which allows you to run Prettier through ESLint, computes a diff and shows a ESLint error. The rule is always the same though

0reactions
xtx1130commented, Jan 14, 2019

@duailibe Thanks for you detailed explanation of the problem, I got it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integrating with Linters - Prettier
Linters usually contain not only code quality rules, but also stylistic rules. Most stylistic rules are unnecessary when using Prettier, but worse –...
Read more >
Options - Prettier
You need to explicitly tell them what to do, while humans can make their own (implicit) judgements, ... See the strings rationale for...
Read more >
CLI - Prettier
Use the `prettier` command to run Prettier from the command line.
Read more >
API · Prettier
When Prettier loads configuration files and plugins, the file system structure is cached for performance. This function will clear the cache. Generally this...
Read more >
What is Prettier? · Prettier
Prettier is an opinionated code formatter with support for: ... Prettier takes your code and reprints it from scratch by taking the line...
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