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.

Prettier styling?

See original GitHub issue

This would give a consistent style throughout code.

I believe I have the main idea of the current ‘style’ here:

{
  "arrowParens": "avoid",
  "bracketSpacing": false,
  "htmlWhitespaceSensitivity": "css",
  "insertPragma": false,
  "jsxBracketSameLine": false,
  "jsxSingleQuote": true,
  "printWidth": 120,
  "proseWrap": "never",
  "quoteProps": "as-needed",
  "requirePragma": false,
  "semi": true,
  "singleQuote": true,
  "tabWidth": 4,
  "trailingComma": "none",
  "useTabs": false,
  "vueIndentScriptAndStyle": true
}

prettier.io playground

Personally, I find it much easier to write a bunch of messy code, then run prettier and get it all cleaned up.

Edit: I’ve updated it so it should look more “normal.”

Got a branch here: https://github.com/naturecodevoid/ct-js/tree/prettier_formatting A small downside: When you write:

const fs = null,
      path = null;

the indenting gets messed up.

A possible solution: https://prettier.io/docs/en/ignore.html#javascript

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
CosmoMyzrailGorynychcommented, May 10, 2020

Seems to work but there is a lot to fix in the linted code 😄

image

1reaction
CosmoMyzrailGorynychcommented, May 5, 2020

Now, ESLint has a nice amount of style checks (https://eslint.org/docs/rules/#stylistic-issues), so maybe improve ESLint instead of incorporating a new tool in the build pipeline. It also works well with VSCode and has tons of other goodies that disallow one shooting themselves in their foot. I can see a plugin https://www.npmjs.com/package/eslint-plugin-pug that does not mess with pug syntax but works with script tags only.

So yeah, let’s instead try to do the same with ESLint. I’ll release v1.3 and will look into the issue again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier · Opinionated Code Formatter
What is Prettier? An opinionated code formatter; Supports many languages; Integrates with most editors; Has few options ... styled-components. styled-jsx.
Read more >
Prettier is an opinionated code formatter. - GitHub
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that...
Read more >
How To Format Code with Prettier in Visual Studio Code
In this article, you'll set up Prettier to automatically format your code in Visual Studio Code, also known as VS Code.
Read more >
Prettier - Code formatter - Visual Studio Marketplace
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that...
Read more >
Code Formatting with Prettier in Visual Studio Code - YouTube
Formatting your code can be a hassle. Learn how to have your code automatically formatted to save yourself a lot of time and...
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