Skip to content

chore: setup markdown formatting - #3224

Merged
azz merged 17 commits into
prettier:masterfrom
ikatyang:chore/setup-markdown-format
Nov 22, 2017
Merged

azz merged 17 commits into
prettier:masterfrom
ikatyang:chore/setup-markdown-format

Conversation

@ikatyang

@ikatyang ikatyang commented Nov 9, 2017

Copy link
Copy Markdown
Member

Re-apply #3022

This PR also update prettier to v1.8.2.

Comment thread CONTRIBUTING.md Outdated
additional parsers, like this:
`run_spec(__dirname, { trailingComma: "es5" }, ["babylon"]);`
additional parsers, like this: `run_spec(__dirname, { trailingComma: "es5" },
["babylon"]);`

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we disable the break in inlineCode? though it's breakable there.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I personally would not break

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.

Yeah it's fine as is.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Opened #3230

Comment thread package.json
"test:dist": "cross-env NODE_ENV=production yarn test",
"test-integration": "jest tests_integration",
"lint": "cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter",
"lint-docs": "prettylint {.,docs,website}/*.md",

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.

Would be really good if we could run --fix and auto-commit changes. Because if people contribute via GitHub UI we don't want the build to fail.

@ikatyang ikatyang Nov 10, 2017 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The auto-commit is available but it's dangerous since we'll need to expose our token to PR branches in the Travis, an alternative would be to enable the --no-prose-wrap option to reduce the possibility of linting errors.

EDIT: or setup some webhooks I guess.

Comment thread docs/api.md
prettier.resolveConfig(filePath).then(options => {
const formatted = prettier.format(text, options);
})
});

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.

😆

@ikatyang
ikatyang force-pushed the chore/setup-markdown-format branch from c6bd230 to 102e751 Compare November 10, 2017 05:42
@ikatyang
ikatyang force-pushed the chore/setup-markdown-format branch from 102e751 to 6dba903 Compare November 10, 2017 05:48
duailibe
duailibe previously approved these changes Nov 11, 2017

@azz azz left a comment •

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.

Changes are good, but I want to make sure we are not blocking GitHub edits to markdowns files before we merge this.

Auto-fixup (is there a tool for this?) or --no-prose-wrap are possible solutions.

@duailibe

duailibe commented Nov 12, 2017 •

Copy link
Copy Markdown
Collaborator

Auto commit in PRs might be a bit confusing for users, but I like the auto-fix idea. Perhaps it should be in follow up PRs after commit?

In #238 someone metioned https://github.com/GordyD/prettier-master

We could work on that

@ikatyang

Copy link
Copy Markdown
Member Author
  • Option 1: --no-prose-wrap
    • pros: won't cause any additional effects
    • cons: PR authors may feel annoying for the lint errors
  • Option 2: a Travis script runs on master and commit yarn lint-docs --fix results
    • pros: PR authors feel happy
    • cons: there will be a lot of yarn lint-docs --fix commits on master
  • Option 3: a GitHub App commit yarn lint-docs --fix results to the PR
    • pros: won't cause any additional effects
    • cons: PR authors may feel unhappy since their PR had been changed and that kind of App is not easy to build

I prefer Option 1 personally but Option 2 is also fine to me. The Option 3 is too expensive.

What do you think?

@azz

azz commented Nov 12, 2017

Copy link
Copy Markdown
Member

@vjeux you may have some thoughts on this.

@ikatyang

ikatyang commented Nov 12, 2017 •

Copy link
Copy Markdown
Member Author

Just realized if we choose Option 2 and there're some ASI issues in the code block or we do not want to format some code blocks but forgot to add prettier-ignore, the yarn lint-docs --fix result will be terrible.

@lipis

lipis commented Nov 12, 2017

Copy link
Copy Markdown
Member

What about just failing the test if the format is wrong.. without committing anything.. by doing so people could change/fix manually if they are willing to.. otherwise someone can edit or run the --fix on top of it before merging..

@vjeux

vjeux commented Nov 12, 2017

Copy link
Copy Markdown
Contributor

I've always found the 80 column enforcement of emails and markdown files such a stupid thing. It's wayyy harder to write and the benefits are very small, nowadays most of the places where they are displayed have a way to do word-wrap. If there are some that don't, then I believe that they should be fixed, rather than pushing a worse editing experience on everyone.

Note that code is a different beast. In order to word wrap code you neee to be able to parse the language, so only a complex and language aware tool like prettier can do it. Also there isn't a clear single way to do it. But for markdown prose, it's just a flat list of characters.

A good example is writing github comments, it's not expected to fit 80 columns: you don't even have a monospace font nor a column marker.

My 2 cents :)

Comment thread CHANGELOG.md
* Parenthesize function expressions in expression position (#941)
* update the README to add a pre-commit hook (#944)
* Fix #951: properly parenthesize ** expressions (#952)
* Fix #951: properly parenthesize \** expressions (#952)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should be formatted as \*\*, fixed in #3246.

Comment thread prettier.json
@@ -0,0 +1,3 @@
{
"proseWrap": false
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Rename as prettier.json since .prettierrc will cause --find-config-path tests to fail.

@azz azz Nov 12, 2017 •

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.

We should fix the tests (maybe mock impl for existsSync())?

@ikatyang
ikatyang force-pushed the chore/setup-markdown-format branch from f2e66dd to e236a90 Compare November 16, 2017 12:23
@ikatyang
ikatyang force-pushed the chore/setup-markdown-format branch from e236a90 to ae3a217 Compare November 16, 2017 12:24
@azz

azz commented Nov 21, 2017

Copy link
Copy Markdown
Member

This one is good to merge, right?

@ikatyang

Copy link
Copy Markdown
Member Author

If there's no further comment, it should be good to merge.

@azz
azz merged commit 76efb33 into prettier:master Nov 22, 2017
@ikatyang
ikatyang deleted the chore/setup-markdown-format branch November 22, 2017 11:27
lipis added a commit to lipis/prettier that referenced this pull request Nov 24, 2017
* master:
  Don't add trailing comma after object rest spread in TypeScript  (prettier#3313)
  fix(cli): respect `--ignore-path` when using `--stdin-filepath` (prettier#3309)
  Fix infinite recursion in playground (prettier#3305)
  chore: setup markdown formatting (prettier#3224)
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 19, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants