Commit Graph

187 Commits (3e00fbad7858193978f0bd68082806b9c255b1a8)

Author SHA1 Message Date
Lucas Duailibe 3e00fbad78
Add empty .prettierrc to project root (#6125) 2019-05-15 12:25:22 -03:00
Adrian Zgorzałek 7c9823fcba Teach prettier/graphql about formatting fragment variables. (#6016)
Fragment variables are an experimental extension to GraphQL schema.
Formatting should follow the same rules as formatting an OperationDefinition node,
hence code is the same.
2019-04-04 09:44:52 -03:00
Lucas Azzola f32b289032
Support shared Prettier configuration (#5963)
* Support external configuration

* Document changes

* Update existing snapshots

* Update existing snapshots (2)

* Fix typo in docs

* Add example config repo
2019-03-13 09:34:51 +11:00
Hugo Alliaume b38319740a feat: autoload plugins that are located in `@*/prettier-plugin-* (#5945)
* add tests

* implement the feature

* update docs

* update changelog

* typo
2019-03-10 20:34:04 +11:00
Lucas Azzola f526c47b1e
Add an option to modify when Prettier quotes object properties (#5934)
* Implement quote-props=preserve

* Implement quote-props=consistent

* Add tests

* Enable quoteProps in playground

* Add documentation

* Cache objectHasStringProp calculations

* Fixup changelog
2019-03-06 20:33:08 +11:00
Julien Marchand ed1db90c68 Honor stdin-filepath when outputting error messages. (#5878) 2019-02-20 08:39:25 -05:00
Maël Nison 9793154833 Tweak the plugin directory search (#5819)
* Update load-plugins.js

* Update load-plugins.js

* Adds a test

* Fixes lint
2019-02-05 07:47:55 -05:00
Lucas Azzola 2982dcd897
Fixup getSupportInfo for babylon parser prior to 1.16.0 (#5826)
This undoes an accidental breaking change where `prettier.getSupportInfo('1.0.0')` would report supporting the `babel` parser instead of `babylon`.

Fixes #5822
2019-02-03 21:57:59 +11:00
Nathan Totten a093bb3f7b Adds LWC Parser to support unquoted interop attributes (#5800)
This pull requests adds a new parser option `lwc`. This is the same as the HTML parser, but it adds support for unquoted HTML attributes per the needs of LWC. See: #5627
2019-02-01 13:58:50 +08:00
Alexander Kachkaev 36aeb4ce4f Fix CI detection to avoid unwanted TTY behavior (#5804) 2019-01-30 14:08:03 +08:00
Ika a9fd8e2cf4
fix(api): do not report the same deprecation warning more than once (#5774)
A quick fix for suppressing duplicate deprecation warnings.
2019-01-20 15:38:19 +08:00
Wenlu Wang 1dea4ef6f2 fix: allow plugin instance (#5760) (#5763) 2019-01-18 12:40:18 -02:00
Ika 7c4cebeaa5
feat: add babel-flow (#5685) 2018-12-29 21:35:47 +08:00
Wei-Wei Wu 91c20f7fbe Rename "babylon" with "babel" (#5647) 2018-12-27 21:05:19 +08:00
Alexander Kachkaev 711c6d78a8 Add --check option (#5629) 2018-12-19 22:03:30 +08:00
Ika 952bc0cc03
fix: get rid of CRLF (#5494) 2018-12-08 18:28:29 +08:00
Laurin Quast 9d1fb93e86 feat: add mjml extension to html language (#5505) 2018-12-07 21:01:40 +08:00
Ika 3fcf69a7d5
fix(api): normalize file path for `getFileInfo` (#5570) 2018-11-29 11:04:44 +08:00
Ika 99a3efaa7a
fix: update editorconfig-to-prettier (#5550) 2018-11-26 13:08:52 +08:00
evelyn masso e12cd17be2 ensure --list-different + --write reports status code 0 (#5512)
* change exit code for list different and write

* update existing tests
2018-11-23 10:42:29 -05:00
Danny McCormick 18b03a31cc Fix tests for Windows and add Azure Pipelines for cross platform CI (#5410)
* Add azure pipelines

* Add gitattributes

* Updating tests to work on Windows or Unix

* Lint

* Cleaning up

* Fixing names

* Clean up naming

* try to consolidate images

* Clean up

* Add back txt to gitattributes
2018-11-14 07:55:50 -05:00
Ika 2bb95d8924
fix(markdown): handle CRLF correctly (#5414) 2018-11-11 00:24:37 +08:00
Ika b0b5460e8f
feat(cli): allow overriding (#5390) 2018-11-10 00:59:59 +08:00
Ika 12a8fa3a24
fix(html): treat CRLF as LF (#5393) 2018-11-09 09:56:46 +08:00
Ika 514b6d3741 Bump Prettier dependency to 1.15.0 2018-11-07 09:12:25 +08:00
Alexander Kachkaev b87fe4cf22 Add option to enforce certain line endings (#5327) 2018-11-06 22:47:13 +08:00
Stefan Mirea e17512adcd Add an option to print single quotes in JSX (#4798)
* feat(option-singleQuote-jsx): Added jsSingleQuote

* feat(option-singleQuote-jsx): Refactored to use a simple jsxSingleQuote flag

* feat(option-singleQuote-jsx): Fixed borked rebase

* feat(option-singleQuote-jsx): Updated snapshots

* feat(option-singleQuote-jsx): Resolved pending comments

* feat(option-singleQuote-jsx): Removed assert

* Fixed merge conflicts

* Updated snapshots after merge conflicts
2018-11-04 16:36:00 -05:00
Ika 5e8a4a115a
feat: support HTML/Vue/Angular (#5259) 2018-11-04 23:03:07 +08:00
Evilebot Tnawi 023a8b78df feat: more shared utils for plugins (#5254) 2018-10-17 07:53:38 -07:00
Ika dd4687e7ef
feat(html): whitespace-sensitive formatting (#5168)
- whitespace-sensitive formatting 
  - respect css `display: block`/`white-space: pre` (data from [`html-styles`](https://github.com/marionebl/html-styles))
  - support magic comment (`<!-- display: block -->`)
  - add an option to specify whitespace sensitivity (`--html-whitespace-sensitivity <css|strict|ignore>`)
    - magic comments take precedence
    - (default) `css`: respect default css style (safe in the most cases)
    - `strict`: every node is considered whitespace sensitive (the safest)
    - `ignore`: every node is considered whitespace insensitive (dangerous, the original behavior)
  - inline inline-tags 
- support ie conditional comment (`<!--[if IE]><![endif]-->`)
- indent the script/style content
- no inconsistent output for 2+ attributes
- force break tag if there're multiline attributes
2018-10-13 13:55:38 +08:00
Warren Seine 7920e6fdde Add a new `trim` command to trim whitespaces in the current line (#4772) 2018-10-06 20:18:52 +08:00
Petter 1244729ad7 Infer via shebang (#5149)
If no file type can be inferred, this attempts to read the first line of a file and extract a shebang, which can be checked against a known list.
2018-10-05 08:47:23 +08:00
Ika 13147facc5
feat(html): switch to htmlparser2 (#5127)
- switch to [`htmlparser2`](https://github.com/fb55/htmlparser2)
  - no need to fork
  - won't generate pseudo nodes ([`parse5` will](https://github.com/prettier/prettier/issues/5098#issuecomment-423055181))
  - should be [faster](https://github.com/fb55/htmlparser2#performance)
- support custom self-closing tags
- support HTML entities
- remove extra trailing newline for `<template>`
- distinguish empty/empty-string attributes (`<tag x>`/`<tag x="">`)
- rename `--parser parse5` with `--parser html`
- enable `html` since 1.15, which means it's enabled by default if you install the dev version from GitHub after this PR merged.
2018-09-22 21:53:38 +08:00
Ika 4ff0f26d3e
refactor: move cli leven suggestion to options-normalizer (#5057)
Option-related processing should be done in `options-normalizer`.

- unknown flag suggestions are colored
  ![image](https://user-images.githubusercontent.com/8341033/45103027-866c7900-b161-11e8-8ee3-6467a9ca0090.png)
- unknown flags with no suggestion are now errors:
  ```
  $ bin/prettier.js --help noseminosemi
  [error] Invalid `--help` value. Expected `a flag`, but received `"noseminosemi"`.
  ```
2018-09-08 07:40:09 +08:00
Evilebot Tnawi 7fd346ffa1
feat: newline and space utils to shared (#5049) 2018-09-04 23:08:37 +03:00
Ika 49e2f77bff
refactor: extract options-normalizer/validator (#5020)
- Uses [`vnopts`](https://github.com/ikatyang/vnopts#readme)
- This way it should be easier to support language-specific options (https://github.com/prettier/prettier/pull/4798#issuecomment-407258477) and map the common options to language-specific options using [`forward`](https://github.com/ikatyang/vnopts#forward), e.g. `singleQuote: true` -> `"javascript/singleQuote": "js"`, `singleQuote: false` -> `"javascript/singleQuote": "none"`.
2018-08-31 11:26:07 +08:00
Ika 1790211f76
feat: support MDX (#4975)
* feat: support MDX

* refactor: flip condition
2018-08-13 22:23:09 +08:00
Ika 82a12a58a8
fix(config): better error message for unsupported extension (#4969) 2018-08-11 16:35:18 +08:00
Ika 53c83f97f5
fix: guess line ending before preprocess (#4957) 2018-08-09 10:51:08 +08:00
Ika 3842cbb118
fix(typescript): use the first error when both failed (#4947) 2018-08-09 10:21:00 +08:00
Ika e72cb538f9
fix: update flow support info (#4943) 2018-08-08 23:47:49 +08:00
Jorge Gonzalez 7d78ce68ef feat(config): support TOML configuration files (#4877)
* Add initial support for TOML in configuration files

* Missed brace

* Fix snapshots

* refactor: move loadToml to utils

* Use @iarna/toml

* Add tests for loadToml

* Fix test for CI

* Remove jest-extended

* Create snapshot for load-toml

* Add feat to docs

* lint docs

* Use @iarna/toml/parse-string

* Change path string
2018-08-03 06:27:19 -04:00
Lucas Azzola a938076ae5
Ignore .git, .svn and .hg directories (#4906)
Fixes #4895
2018-07-30 00:08:51 +10:00
Ika 440ab4f60b
refactor: upgrade to cosmiconfig@5 (#4899)
* refactor: upgrade to cosmiconfig@5

* fix: use custom require
2018-07-29 16:57:36 +08:00
Ika 1fe0b01bd4
fix(yaml): no wrong loc info for CRLF (#4863)
Context: https://github.com/prettier/prettier/issues/4856#issuecomment-405982539

Workaround for eemeli/yaml#20
2018-07-19 21:50:27 +08:00
Ika 1a2c4e663e
chore: use pre-release version number on master (#4855)
* chore: use pre-release version number on master

* docs: tweak comment
2018-07-18 09:38:26 +08:00
Ika ed0ecdad18 fix(json): do not put values on a separate line from the key (#4852)
* test: add tests

* fix(json): do not put values on a separate line from the key
2018-07-17 18:08:59 -03:00
Ika 2271992446
feat(json): add jsonc to aliases and use it to find parser in markdown embed (#4734) 2018-07-07 20:46:34 +08:00
Ika 432c9d7d04
feat(yaml): support proseWrap (#4742)
- support `proseWrap` in `yaml`
- move `proseWrap` to `commonOptions`
- update to `yaml@1.0.0-rc.4` and `yaml-unist-parser@1.0.0-rc.1`
2018-07-04 00:28:47 +08:00
Ika 9bb8edf96a
feat: support .js.flow (#4777)
* feat: support .js.flow

* feat: add Flow language entry
2018-07-01 16:18:08 +08:00