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
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
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
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
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
Ika
0b659b898d
feat: update linguist languages ( #4741 )
...
Context: https://github.com/prettier/prettier/pull/4734#issue-196702272
Languages should be easy to maintain now.
2018-06-28 08:24:02 +08:00
Ika
c38e6af301
fix(yaml): add missing `since` field ( #4739 )
2018-06-23 17:04:47 +08:00
Ika
dcf44ffbdc
feat: support YAML ( #4563 )
...
* feat: support YAML
* fix: do not indent sequence in mappingValue
* docs: add yaml to index.md
* fix: reduce `SyntaxError: Node#parse consumed no characters`
* chore: remove old-build and new-worker.js
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* refactor
* fix: no space after `<<`
* fix: add yaml to standalone test
* test: add tests
* fix: next empty line in flow collection
* fix: tabs are not allowed
http://yaml.org/spec/1.2/spec.html#space/indentation/
* fix: update parser
* feat: rewrite the mappingItem logic
* feat: indent sequence in mapping
* feat(doc): add ifBreak#groupId and group#id
* chore: fix node 4
* chore: add tools_yaml.svg
* chore: remove resolved TODO
* refactor: remove unnecessary workaround
* chore(worker): importScriptOnce
* chore(build): rename with babelPlugins
* make it rollup compatible
* feat: support singleQuote
* refactor
2018-06-21 10:29:42 +08:00
Ika
75e86b9e6b
fix(cli): no regression for --debug-check + --list-different ( #4600 )
2018-05-31 00:42:26 +08:00
Lucas Duailibe
1350edc5a6
Revert no parser error for API ( #4587 )
...
* Revert no parser error for API
* use warn
2018-05-28 23:43:44 -06:00
Lucas Duailibe
8892b14d8a
1.13.0
2018-05-27 15:19:39 -03:00
Lucas Azzola
b0cb63a7bb
Use destructuring for imports ( #4554 )
...
* Use destructuring for imports
* Clean up integration tests
* Use moduleNameMapper for require_prettier
2018-05-27 21:36:12 +10:00
Lucas Duailibe
5c6e0802af
Don't default parser to babylon ( #4528 )
...
* Don't default parser to babylon
* Different default values according to version
* Fix error logging
* Add tests specifically for parser inference
* Add another test case
* Add API test
2018-05-23 16:55:06 -03:00
Suchipi
ec45dc9a4c
(refactor): Move common options out of JS plugin ( #4445 )
...
* (refactor): Move common options out of JS plugin
* Add Common category to playground
2018-05-15 14:14:50 -06:00
Ika
1062f2a889
feat: support JSON.stringify formatting ( #4450 )
...
* test: move tests
* feat: support legacy JSON formatting
* fix: add missing assertion
* test: fix coverage
* fix: same output as JSON.stringify
* refactor: fix linting
* refactor: rename to json-stringify
* refactor: fix linting
* fix: should fix the production build
* docs: remove outdated name
* fix(playgound): add lib/parser-json-stringify.js
* feat(playgound): add example for json-stringify
* fix: no error on singleQuote string
* fix(playground): correctly load json-stringify
* fix: identifier is only allowed in ObjectProperty.key
* refactor: clearer
2018-05-14 09:12:25 +08:00
Alexander Kachkaev
cc734753fc
Implement prettier.getFileInfo() method and --file-info CLI option ( #4341 )
...
* Implement prettier.getFileInfo() method and --file-info CLI option
* Add empty line between functions in index.js
* Support --plugin-search-dirs / pluginSearchDirs() in --file-info / getFileInfo()
* Address review comments by @ikatyang
2018-05-10 00:53:44 +08:00
Alexander Kachkaev
7345a38e64
Fix plugin API in globally installed Prettier and introduce optional --plugin-search-dir ( #4192 )
...
* Fix plugin API in globally installed Prettier and introduce optional --plugin-search-dir
* Use find-parent-dir instead of find-up and test autoloading (with mocked fn)
* Add two test cases where --plugin-search-dir is not .
* Do not mutate pluginSearchDirs argument in load-plugins.js
* Do not test automatic plugin resolution as mocking of "find-parent-dir" does not work due to rollup
* Document --plugin-search-dir / pluginSearchDirs and improve spacing
* Address @ikatyang's review comments
* Fix require path for third-party
* Undo alphabetic sorting of third-party scripts
2018-05-09 19:17:12 +08:00
Ika
9cc5d4f162
fix(json): jsonc is considered JSON instead of JSON5 ( #4374 )
...
* fix(json): jsonc in consider JSON instead of JSON5
* feat: add json5 id
2018-04-27 00:09:36 +08:00
Ika
317f3a3c56
feat: split out JSON5 ( #4367 )
...
* feat: split out JSON5
* test: update snapshots
* test: update debug-check tests
* feat(playground): use JSON's code sample for JSON5
* fix: add missing trailing newline
2018-04-25 22:10:22 +08:00
Ika
5d7b14856b
fix(schema): support array type ( #4312 )
...
* test: add test
* fix(schema): support array type
* fix: convince CI
* refactor: another way to convince CI
2018-04-15 00:06:43 +08:00
Lucas Duailibe
240f09794b
Fix printing ignored files with --debug-check ( #4066 )
2018-03-01 13:03:54 -03:00
Ika
0ce4ce3138
fix(api): no regression for deprecated parser ( #4072 )
2018-03-01 00:14:30 +08:00
Christian Zosel
d05a29da05
Allow plugins to override default options ( #3991 )
...
* refactor(cli): defer default value applying
* Allow plugins to override default options
* Move "defaultOptions" to top level of plugin
* Simplify implementation
* Attach plugin name
* Add pluginOptions to cli help
* Update snapshots
* Code review (immutable style)
* Add test for help output
* Use snapshot test, fix Object.assign
* Refactor to immutable style
* Add test case for automatic plugin resolution
* Add tests for applying and overriding default opts
* Remove "since" option
* Only set defaults for CLI args when no pluginDefaults are present
* Revert workaround, rebase to #4045
* Add basic documentation for `options` and `defaultOptions`
2018-02-28 00:20:02 +11:00
Joseph Frazier
5153b15245
Respect EditorConfig when `--config` is passed ( #3992 )
...
* Respect EditorConfig when `--config` is passed
* Clarify config-resolution test file
See https://github.com/prettier/prettier/pull/3255#issuecomment-348420546
* Update test snapshots
2018-02-24 19:11:23 +11:00
Ika
84c603623d
feat: support external options ( #3775 )
...
* refactor: wrap
* refactor: replace
* refactor: replace
* refactor: replace
* refactor: extract
* refactor: logger
* refactor
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* feat(support): add `showInternal` option
* refactor: use internal
* refactor
* refactor: extract
* refactor: extract
* refactor
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: reorder
* refactor: remove unnecessary
* refactor: reorder
* refactor: move
* refactor
* refactor
* refactor
* refactor: remove unnecessary
* feat: external options from CLI
* refactor: push/pop plugins
* feat: external options from config file
* refactor: remove unnecessary
* refactor
* refactor
* refactor
* fix: use `json-stable-stringify`
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: move
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: extract
* refactor: move
* refactor: extract
* docs: add comments
* refactor: sort
* refactor: sort
* refactor: rename
* refactor: remove unnecessary
* style: remove trailing whitespace
2018-01-28 00:24:25 +08:00
Ika
dc26445e51
refactor(options): use supportOptions to generate CLI options ( #3622 )
...
* refactor(cli-constant): use supportOptions
* refactor(options): use supportOptions
* refactor(cli-util): use supportOptions
* fix: do not infer parser in multiparser
* chore: remove unnecessary package
* chore: trigger another travis build
* test: add kebab-case test to ensure no regression
* test: update snapshots
2018-01-18 15:26:27 +08:00
Lucas Azzola
bae21cb166
1.10.0
2018-01-10 23:08:15 +11:00
Lucas Duailibe
2cb9498ab6
Output files as-is if ignored ( #3618 )
...
* fix --stdin-filepath
* output file as-is without --write
* return early
* use writeOutput
2017-12-31 18:08:09 +01:00
Ika
6c0dd74518
feat(support-info): add `options` field ( #3433 )
...
* refactor: rename supportTable with supportLanguages
* refactor: use `dedent`
* test: reduce unnecessary data
* feat(support-info): add `options` field
* add `showDeprecated` option
* add `showUnreleased` option
* test: snapshot diff
* fix(support): add missing `since`
* fix: add missing `category`
* refactor: use template tag
* fix: `trailingComma:true` should redirect to `trailingComma:es5`
* refactor: reorder parser
* refactor: fix linting
* refactor: move options
* refactor: move options to printers
2017-12-31 15:34:37 +11:00
Joseph Frazier
7b211eab24
editorconfig: Only search for .editorconfig up to the VCS directory ( #3559 )
...
* editorconfig: Only search for .editorconfig up to $PWD
This addresses https://github.com/prettier/prettier/issues/3558
I'm not sure if this is the best way to find the "project root", but it
seems better than before.
* editorconfig: Search for `.editorconfig` up to the VCS directory
This uses [find-project-root] to find the nearest directory containing `.git` or `.hg`
See here for context: https://github.com/prettier/prettier/pull/3559#issuecomment-353756948
[find-project-root]: https://github.com/kirstein/find-project-root
* editorconfig: Add test for finding VCS directory
It's a little hacky in that the .hg file isn't really a Mercurial
repository, but it's enough to illustrate the intent. See here for
context: https://github.com/prettier/prettier/pull/3559#issuecomment-353857109
2017-12-26 18:16:09 +11:00
Lucas Azzola
4c9d4061da
Prettier Plugin API ( #3536 )
...
* Move files around in preparation for refactor
* Update paths in build script
* Extract generic printing logic from the JavaScript printer
* Conform printer API
* Fixup decorator handling
* Fix multiparser
* Create plugin entry for markdown
* Create plugin entry for javascript/typescript
* Create plugin entry for html
* Create plugin entry for graphql
* Create plugin entry for css/less/scss
* Move JSON to JS plugin entry
* Integrate plugins into getSupportInfo()
* Move astFormat to parser definition
* Move util to common
* Implement parser loading
* remark -> mdast
* Rename cli/cli -> cli/index
* Rename builder -> doc package, fix printer resolution
* Fix doc shape assumption in CSS-in-JS logic
* Fix third-party.js prod resolution
* Fixup build-docs script
* Distribute multiparser code
* Remove requirement to forward options
* Flatten closure
* Remove debug directory
* Expose doc
* Add external plugins
* Pass options to loadPlugins
* Export getParsers
* Pin resolve version
* Use getSupportInfo in Markdown embed
* Document plugin API
* Update build-docs
* Add CLI for plugins
* Lint docs
* Fixup build.js
* Add vue language
* Fixup multiparser for vue
* Upgrade rollup and rollup-plugin-commonjs
* Fixup third-party build
* Change AST format in docs
2017-12-26 12:23:50 +11:00