Commit Graph

202 Commits (master)

Author SHA1 Message Date
Zaven Muradyan 3d52ab7016 Gracefully handle nonexistent paths passed to --stdin-filepath. (#6687)
Co-authored-by: Simon Lydell <simon.lydell@gmail.com>
2019-11-02 15:56:26 +01:00
Anders Kaseorg 0acc3120ef cli: Handle errors when reading stdin (#6708)
Co-authored-by: Simon Lydell <simon.lydell@gmail.com>
2019-11-02 13:53:13 +01:00
Dang Mai f6bd59dfd3 Allow plugin to specify option with type `string` (#6219) 2019-11-02 09:52:49 +01:00
fisker Cheung 159566798d Move `multiple-patterns` tests to `patterns` (#6777) 2019-11-01 18:02:34 +01:00
Kai Cataldo df45e12c5c API: add resolveConfig option to getFileInfo() (#6666)
* Add useConfig option to getFileInfo()

* useConfig -> resolveConfig
2019-10-23 13:56:59 +02:00
fisker Cheung 4750b1c25a Fix an expired todo test (#6665)
* Fix a expired todo test

* only check TypeError

* Throw a specific TypeError

* fix async expect

* use return
2019-10-16 15:09:39 +02:00
Evilebot Tnawi 6d4d6a7599 revert: `--only-changed` argument (#6594) 2019-10-03 11:21:05 -03:00
fisker Cheung 5ce16eaa02 Update linguist-languages to v7 (#6367)
* Update linguist-languages to v7

* Trigger build

* Update

* replace `includes` with `indexOf`

* fix `exclude`

* add `nodejs` back
2019-09-14 00:57:16 +03:00
Jack Bates af3084a63f Plugins can have falsy default options (#6348) 2019-09-12 18:52:48 +03:00
Jack Bates 38450587fe Delete .config.json.swp (#6363) 2019-08-08 15:02:47 +03:00
kamilic 7d0175ca90 feat: implement --vue-indent-script-and-style mentioned at pr-#… (#6157)
* feat: implement --vue-indent-script-and-style mentioned at pr-#6077

* docs: --vue-indent-script-and-style

* update new test case

* feat: playground for --vue-indent-script-and-style

* chores: Revert package.json version

* Remove noisy snapshots
2019-08-01 11:06:12 +02:00
Gabriel Harel 6fae09b67e Add --only-changed flag to CLI (#5910) 2019-07-22 11:17:24 -03:00
James Reggio 353b2ca064 Config should not be evaluated for ignored files (#6233)
Prior to this change, the CLI would resolve the config for a file before
checking it against the ignored list. If the config was invalid, the CLI
would report a failure.

This change relocates the config-resolution phase until after the file
is confirmed to not be ignored.
2019-06-18 17:20:47 -03:00
Lucas Duailibe 448328270d
Support overrides for dotfiles (#6194) 2019-06-07 09:45:56 -03:00
Lucas Duailibe 2a298a3815 Fix plugin resolution tests 2019-05-24 14:23:07 -03:00
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