Commit Graph
1985 Commits
Author SHA1 Message Date
Georgii Dolzhykov cf3d9f0b80 api: remove the version parameter of getSupportInfo (#7620)
* api: remove the version parameter of getSupportInfo

* add changelog entry

* remove mapDeprecated

* Update pr-7620.md

* remove the first parameter completely

* Update api.md

* add default value for opts just to be on the safe side
2020-02-23 02:47:17 +02:00
Karl Horky 2b761b6af8 Remove unnecessary expression (#7648)
Since wordPart is checked for falsiness on the previous line, it will always evaluate to an empty string. The expression in the parentheses will then evaluate to `"" || ""`, which I assume is not desired.

Ref: https://lgtm.com/projects/g/prettier/prettier/snapshot/ecfc5e9b8320d79ed8a801d811e0a63892b040d0/files/src/printer-postcss.js?sort=name&dir=ASC&mode=heatmap#L468
2020-02-21 00:54:15 +02:00
fisker Cheung 647c041b57 Check pattern existence before glob (#7587) 2020-02-19 12:57:39 +02:00
fisker CheungandChristopher J. Brody 3cef19c73e Update globby to v11 (#6776)
* globby@10 update (with fast-glob implementation)

with some minor test snapshot updates in tests_integration since
fast-glob does not always keep the same file order as node-glob

* with no `nodir: true` option

use of no `nodir: true` option was introduced in 639c52388
but it does not seem to be needed with some newer
versions of globby

* with workaround for fast-glob on Windows

ref: https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows

Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: Christopher J. Brody <chris@brody.consulting>

* Revert "with no `nodir: true` option"

This reverts commit f7297cbceebc3d939bca0d90a904a1d3fea45345.

* revert updates to snapshots in tests_integration

* sort the file paths from globby

and update some snapshots in tests_integration

* Update build scripts

* replace `util.promisify` with `pify`

* style

* typo

* add pify to dict

* check index.js

* debug

* exclude `transform-async-to-generator`

* fix `bin-prettier.js`

* restore disabled script

* try depth:1

* remove depth add `./`

* sort dir

* disable expandDirectories

ref: https://github.com/sindresorhus/globby/blob/master/index.js#L95

* use absolute path

* remove sort()

* sort dir

* use `alphasorti` compare

* remove './'

* fix `findPluginsInNodeModules`

* fix `findPluginsInNodeModules`

* restore snap

* fix `findPluginsInNodeModules`

* return early

* code style

* sort

* update snap

* try mem

* mem `loadPlugins` function

* fix

* glob directories instead of package.json

* use deep

* remove mem

* improve speed

* support dot pattern

* expand directories test

* restore import order

* remove snap

* update test

* restore `findPluginsInNodeModules`

* Update `globby`

* `fast-glob` beta

* Restore logic

* Add tests for `globby` update

* Fix tests

* Remove option with default value

* Try new beta version of `fast-glob`

* Restore error info

* Add `path.sep` check
2020-02-18 17:36:22 +02:00
Kevin GibbonsandGeorgii Dolzhykov ada3d08df5 Put space after generator star, not before (#7516)
* Put space after generator star, not before

* remove pr-7516.md, edit pr-3903.md instead

Because the release blog post will be generated from these files.

* edit pr-3903.md

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-02-18 16:27:52 +02:00
Corinne Hoener 50e0ea91ee Respect prettierignore when executed in subdirectories (#7588)
* Respect prettierignore when executed in subdirectories

* Add ignore-in-subdirectories tests

* Add changelog entry
2020-02-18 00:40:26 +02:00
Georgii Dolzhykov 16c0a7a10f Rudimentary support for the most used directives of AngularJS 1.x (#6869)
* Rudimentary support for the most used directives of AngularJS 1.x

* add ng-class and ng-style

* add changelog entry in the new format

* Update pr-6869.md

* update snapshots
2020-02-18 00:38:23 +02:00
fisker Cheung ee61bdf435 Remove usage of cosmiconfig v4 interface (#7458)
* Remove usage of cosmiconfig v4 interface

* Remove `loadEditorConfig` second argument
2020-02-17 16:42:04 +02:00
fisker Cheung 2bfaa7c2cf Simplify createLanguage (#7509) 2020-02-17 16:39:08 +02:00
fisker Cheung d2de524571 Don't add parens to undefined in ConditionalExpression with jsx (#7504)
* Add failed test

* Don't add parens to Literal and Identifier

* Update snap shot

* Move test to `jsx`

* Only undefined

* Add changelog
2020-02-17 16:34:50 +02:00
fisker CheungandGeorgii Dolzhykov 40a1418246 Format value of HTML class attribute (#7555)
* Format HTML attribute `class` value

* Add more example

* Typo

* Don't break

* exclude mustache and multiparser

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-02-16 10:59:15 +02:00
Georgii Dolzhykov 5dab172700 Merge remote-tracking branch 'remotes/upstream/master' into next 2020-02-14 14:08:20 +02:00
Cory Forsyth 5bd45d79af fix(glimmer): Do not strip AttrNode value when it is not blank (#7552)
* failing test

* fix(glimmer): Do not strip attr node values when not blank

* Add user-facing changes
2020-02-14 13:39:59 +02:00
fisker Cheung 017d079ca8 Format value of HTML style attribute (#7556) 2020-02-14 14:21:11 +03:00
fisker Cheung 4bac066146 Refactor shouldPrintComma logic for angular (#7507) 2020-02-14 13:21:46 +03:00
fisker Cheung b26d66feb3 Remove unnecessary type-casting in FastPath (#7506) 2020-02-14 13:21:19 +03:00
Daiki Ihara 3a485c68dd Markdown: fix incorrect prettification of multi-line markdown footnote (#7203)
* fix incorrect prettification of multi-line markdown footnote

* update test of footnoteDefinition

* add changelog_unreleased pr-7203

* fix changelog_unreleased

* fix pointed out

* update snapshot test of markdown for footnote
2020-02-14 11:50:49 +02:00
fisker Cheung 61398f0dc7 Vue: don't print long single expression of TemplateLiteral and StringLiteral on new line (#7479)
* Add failed test

* Fix logic

* Update example

* More tests

* Add changelog_unreleased/vue/pr-7479.md

* Fix logic
2020-02-14 01:47:36 +02:00
fisker Cheung 8fdab1bf40 A little DRY on TypeCastExpression print (#7551) 2020-02-14 01:35:43 +02:00
fisker CheungandGeorgii Dolzhykov b35074007b HTML: Fix inconsistent formatting of self-closing tags (#7395)
* Fix inconsistent self-closing tag in vue

* Update snap

* Add changelog

* More test

* reword changelog

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-02-10 13:36:25 +03:00
Cyrille David 057e93305b refactoring(glimmer): Create a clean file (#7529) 2020-02-04 02:32:14 +02:00
Cyrille David 7d42e79d9d refactoring(glimmer): Extract utils from printer (#7528)
* Extract isWhitespaceNode

* Refactor isParentOfType to isParentOfSomeType

* Introduce isNodeOfSomeType

* Replace isNextNodeOfType with isNextNodeOfSomeType

* Move utils to utils file

* Sort utils

* Refactor isPrettierIgnoreNode function to use util

* Extract hasPrettierIgnore to utils

* Apply review feedback

* Apply review suggestions

* Add getSiblingNode
2020-02-03 21:44:24 +02:00
Cyrille DavidandGeorgii Dolzhykov 9b684892d5 Upgrade @glimmer/syntax to latest (#7245)
* Remove simple-html-tokenizer resolution

* Remove outdated filter

I'm not 100% sure but I guess it was useful with previous
@glimmer/syntax versions

* Remove unused code

* Upgrade @glimmer/syntax and simple-html-tokenizen

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-02-03 18:28:08 +02:00
Kagami Sascha RosylightandGeorgii Dolzhykov 1cd90c9fb8 Do not add hard linebreak for html template (#7208)
* Do not add hard linebreak for html template

* Collapse whitespaces to single space char

* restore line breaking

* use `line` and rename vars

* add test

* support htmlWhitespaceSensitivity

* indent if breakable

* add htmlWhitespaceSensitivity test

* indent only when multiple top levels

* add a changelog entry

* update snapshot

* replace match with test

* split tests into multiple files for better readability of snapshots

* fix an edge case with html-in-js-in-html

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-02-03 17:09:38 +02:00
Cyrille David 2662e542b5 Extract isGlimmerComponent to an util (#7483) 2020-02-03 13:44:37 +03:00
fisker Cheung e2e534df30 Remove normalize-path package (#7465)
* Remove `normalize-path` module

* Try run all tests on `standalone`

* Restore test

* Add `no-parser-tests`

* Fix issue with shim

* DRY

* Rename tests

* Use `endsWith`
2020-02-03 01:33:19 +02:00
fisker Cheung 6e397b2bb2 Fix a failed test on flow parser (#7501)
* Add failed tests

* fix ast diff

* Delete dead code
2020-02-01 18:27:31 +02:00
fisker Cheung 0aec777e68 Use "lodash/groupBy" (#7438) 2020-02-01 18:26:59 +02:00
fisker Cheung bd2166b798 Rewrite FastPath class (#7442) 2020-01-31 23:08:58 +09:00
Georgii Dolzhykov 850e705d10 Fix edge cases with parentheses around optional chaining (#7500)
* fix disappearing parens in (foo?.bar)()

* fix `new (foo?.bar)();`
2020-01-31 12:50:08 +02:00
fisker Cheung 340951f045 Keep parentheses of SequenceExpression for ExportDefaultDeclaration (#7491)
* Fix export default `SequenceExpression`

* Add more parser

* Add change log

* Fix  logic

* Rename that function

* Add a branch
2020-01-31 13:28:08 +03:00
fisker Cheung a1ce84a13b Cleanup dead code from pr7461 (#7468)
* Add test for #5810

* Remove maybe dead code

* Add changelog

* Remove old tests

* More dead code
2020-01-31 13:23:10 +03:00
fisker Cheung 0370f47cb3 Refactor some Object.assign (#7437) 2020-01-31 09:13:37 +09:00
fisker Cheung 947a174954 Flow: Add support for decorators (#7482)
* Update flow parse options

* Add `decorators` test

* Restore enums

* Add changelog

* Add babel-verify
2020-01-31 08:55:30 +09:00
fisker Cheunganddependabot-preview[bot] 28e70b6c9b Bump linguist-languages from 7.7.0 to 7.8.0 (#7481)
* Bump linguist-languages from 7.7.0 to 7.8.0

Bumps [linguist-languages](https://github.com/ikatyang/linguist-languages) from 7.7.0 to 7.8.0.
- [Release notes](https://github.com/ikatyang/linguist-languages/releases)
- [Commits](https://github.com/ikatyang/linguist-languages/compare/v7.7.0...v7.8.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump linguist-languages from 7.7.0 to 7.8.0

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-01-30 19:36:49 +02:00
fisker Cheung eb1e587d2f Flow: Add support for ClassPrivateProperty (#7484)
* Support `ClassPrivateProperty`

* Add changelog

* Code style

* Fix babel

* Move logic up

* Add tests

* Make test a little bit uglier
2020-01-31 01:51:27 +09:00
fisker Cheung 90128a3a00 Flow: add typing support for the symbol type (#7472)
* Flow: add typing support for the `symbol` type

* Add changelog
2020-01-30 13:08:01 +03:00
fisker Cheung 0c93198942 Remove deprecated parser & update sharedUtil (#6993)
* Remove some old stuff

* Add changelog

* Fix test

* util changes

* restore parser

* Fix `util` usage
2020-01-29 17:32:42 +03:00
fisker Cheung 2877dda67e Use ci-info instead of is-ci (#7432) 2020-01-29 15:42:07 +02:00
JounQinandGeorgii Dolzhykov c1937cb1b8 feat: add new parser babel-ts to parse TypeScript syntaxes via Babel (#6400)
* feat: add new parser `babel-ts` to parse TypeScript syntaxes via Babel

* docs: document parser babel-ts

* chore: enable babel-ts in markdown and worker.js

* verify all TS tests against babel-ts except disabled by disableBabelTS

* support for TSDeclareMethod; fix abstract properties and methods

* fix embedded angular templates and styles

* fix TSImportType

* simplify babel options combinations

* fix method decorators

* fix ranges

* work around loc inconsistencies for SequenceExpression

* don't print trailing comma in type parameters (unsupported in TS < 3.3)

* preserve quotes for class properties

* align printing of single-parameter functions

* fix comments in degenerate single-element unions and intersections

* fix comments for methods

* fix comments for mapped types

* edit docs, change 'since' to 2.0.0

* add changelog

* fix code sample on playground

* update snapshots after rebase

Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
2020-01-29 14:11:16 +02:00
Panayiotis Lipiridis 0c51368d33 Merge branch 'master' of github.com:prettier/prettier into next
* 'master' of github.com:prettier/prettier:
  Clarify API docs (#7402)
  Fix typo (#7425)
  [docs] Add Tidelift to cspell.json
  website: add Tidelift enterprise language (#7424)
  Use BOM string instead of BOM charCode (#7420)
2020-01-29 13:45:45 +02:00
Alexander Kachkaev e00ce8c2c8 Change arrowParens to always by default for 2.0 (#7430) 2020-01-29 13:31:25 +02:00
fisker Cheung ebd0c6d605 Remove useless argument in editorconfig load function (#7459) 2020-01-29 12:51:05 +03:00
Alexander Kachkaev 1b3a5d3572 Change endOfLine to lf by default for 2.0 (#7435)
* Towards changing default value for endOfLine

* Update tests and snapshots

* Add placeholder for changelog_unreleased

* Add CHANGELOG

* Undo adding snapshot tests for auto as it does not play well on Windows in CI

* Tweak changelog

* Update jest snapshot
2020-01-28 23:35:47 +02:00
fisker Cheung c493bdef8d Update mem to v6 (#7260)
* Style: use async for `editorconfigAsyncNoCache`

* Update `mem` to v6

* Fix usage of `mem`

* Fix: add `await`

* Use JSON.stringify
2020-01-28 19:10:01 +02:00
fisker Cheung f11a94befd Simplify createUsage (#7439)
* Simplify `createUsage`

* restore some change
2020-01-28 18:56:36 +02:00
fisker Cheung ccb38118b5 Minor tweak (#7440)
* Simplify `isExportDeclaration`

* move `isExportDeclaration` and `getParentExportDeclaration` to `language-js/utils.js`
2020-01-28 18:55:00 +02:00
fisker Cheung c0517441b2 Enable unicorn/prefer-string-slice (#7251) 2020-01-23 15:15:28 +03:00
fisker Cheung 9d9b4a15e5 Use BOM string instead of BOM charCode (#7420)
* Use BOM string instead of BOM charCode

* Trigger CI
2020-01-23 13:40:05 +02:00
fisker Cheung 27b5cb4d9d Enable ESLint prefer-rest-params rule (#7400) 2020-01-23 10:36:18 +02:00