Skip to content

Improve Prettier DX#500

Merged
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
ark120202:improve-prettier-dx
Mar 30, 2019
Merged

Improve Prettier DX#500
Perryvw merged 3 commits intoTypeScriptToLua:masterfrom
ark120202:improve-prettier-dx

Conversation

@ark120202
Copy link
Copy Markdown
Contributor

  • Added a message on Prettier check failure with instructions that show how to fix it. Tested in cmd, powershell, and (ba)sh.
  • Disabled endOfLine locally, but left it enabled on CI. That way it doesn't cause initial warnings with core.autocrlf=true (default on Windows), yet prevents committing files with inconsistent line endings to the repo.


/** @type {import("prettier").Options} */
module.exports = {
printWidth: 100,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this 100 actually? I think it's 120 in tslint

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In linters max length is used as a strict limit, but it's possible to make lines shorter. In prettier printWidth it more like average length, as prettier tries to as fit much as possible code into printWidth, so usually it's better to keep it less than it was with linter. See https://prettier.io/docs/en/options.html#print-width and https://prettier.io/docs/en/rationale.html#print-width for details.
Though I'm fine either way, the difference between 100 and 120 is quite small.

@Perryvw Perryvw merged commit 1dd715c into TypeScriptToLua:master Mar 30, 2019
@ark120202 ark120202 deleted the improve-prettier-dx branch November 26, 2019 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants