Prettier styling?
See original GitHub issueThis 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
}
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:
- Created 3 years ago
- Comments:15 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Seems to work but there is a lot to fix in the linted code 😄
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.