Commit Graph

21 Commits (3cd1d003c0ae54715301e3838fd1aa64ba576d4a)

Author SHA1 Message Date
Mahir Shah 30ec30daa9 Escape Quotes in Glimmer String Literals (#5143) 2018-10-05 22:19:33 +02:00
Simon Lydell f87c82cc4e
Improve glimmer parse errors (#5161)
Instead of showing 80 carets, point out just which line the error was
on, and rely on the original message to point out the "column".

I thought about matching the `----^` in the original message with a
regex and use the length of it as the column number, but unfortunately
the original message does not show the original code (in this example
some whitespace is missing), so it wouldn't work.

Before:

```
$ ./bin/prettier.js test.hbs --parser glimmer
[error] test.hbs: SyntaxError: Parse error on line 2:
[error] {{one}}{{
[error] ---------^
[error] Expecting 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'EOF' (2:0)
[error]   1 | {{one}}
[error] > 2 | {{
[error]     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]   3 |
```

After:

```
$ ./bin/prettier.js test.hbs --parser glimmer
[error] test.hbs: SyntaxError: Parse error on line 2:
[error] {{one}}{{
[error] ---------^
[error] Expecting 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'EOF' (2:0)
[error]   1 | {{one}}
[error] > 2 | {{
[error]   3 |
```
2018-09-30 00:25:45 +02:00
Ika 58d34bb844
refactor: language extend (#4994) 2018-08-22 10:12:57 +08:00
Paul Chavard 783923a81b fix(glimmer): preserve empty text attributes (#4897) 2018-08-01 12:45:36 -03:00
Paul Chavard 0571b2b884 fix(glimmer): treat glimmer components as self closing tags (#4900) 2018-07-27 06:49:13 -04:00
Paul Chavard 65d65a5c13 fix(glimmer): better formatting of boolean attributes (and also ...attributes) (#4891) 2018-07-26 09:50:45 -03:00
Paul Chavard 505e08292c fix(glimmer): add softline in nested block statements (#4896) 2018-07-26 09:49:50 -03:00
Paul Chavard ca8e049126 fix(glimmer): remove extra space from sub-expressions without params (#4890) 2018-07-24 19:50:30 -03:00
Paul Chavard 5d254ce310 fix(glimmer): do not strip block params on <Component> (#4889) 2018-07-24 19:07:49 -03:00
Prashant Andani cdcb7b11c9 Use destructures and refactor code for readability (#4844)
* Use destructuring for readability and optimzations at for loop length property

* Destructure variables for easy maintainability of code

* PR review fix

* refactor: fix linting

* Use destructures and refactor code for better readability

* Remove merge conflict line

* lint before commit
2018-07-17 18:01:44 -03: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
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 52a2a46b3c
New build system (#4449) 2018-05-24 15:30:45 -03:00
Dray Lacy bb6d130b5b Fix printing of `{{{raw}}}` handlebars expressions (#4535)
Previously, `{{{raw}}}` would be output as `{{raw}}`.
2018-05-24 11:16:50 -07:00
Ika d0f6aac001
refactor(massageAst): move stripLocation to corresponding plugins (#4477) 2018-05-14 20:52:27 +08:00
Nate Pendleton 91c701886d fix(glimmer): preserve leading/trailing spaces in text nodes undernea… (#4288)
* fix(glimmer): preserve leading/trailing spaces in text nodes underneath attribute nodes when next to mustache statements.

* fix(glimmer): format printer-glimmer.js

* fix(glimmer): lint fix

* fix(glimmer): removed decomposition assignments to be compatible with Node 4

* fix(glimmer): Array.includes() -> indexOf() for Node 4
2018-04-27 14:20:10 -06:00
Nate Pendleton 28e4b07b17 fix(issue-3982): Glimmer printer now properly handles else-if blocks without else block … (#4256)
* fix(glimmer): Now properly handles else-if blocks without else block and block statements as root of else.

* run prettier on printer-glimmer.js
2018-04-08 11:36:37 -06:00
Lucas Azzola a0668129da
Do not require plugins to set 'since' field (#4038)
* Do not require plugins to set 'since' field

* Refactor
2018-02-24 19:00:51 +11:00
Christian Zosel fac08034e7 Split out location extraction into plugin config (#3777)
* Split out location extraction into plugin config

* Reduce set of exported function, rebase to current master

* Pass custom locStart/locEnd fn's directly to affected methods

* (wip) always use locStart/locEnd from plugin

* Convert graphql implementation

* Convert HTML implementation

* (wip) convert JS implementation

* Remove unused variables

* Continue conversion of JS implementation

* Replace "util.locStart" with direct call to "options.locStart"

* Remove util closure

* Add unit test for structure of shared util

* Fix linting error, simplify locStart/End implementations
2018-02-09 23:17:48 +11:00
Lucas Azzola a041914551
Extract cleanAST to language-specific files (#3610)
* Extract cleanAST to language-specific files

* Fix lint

* Fix clean-ast for vue and glimmer
2017-12-30 21:30:09 +11:00
Robert Webb 833666a394 Support handlebars (#3534)
* feat(glimmer): initial HTML/Handlebars/Glimmer support

* feat(glimmer): support un-escaped mustache expressions

* fix(glimmer): add 'as |foo|' syntax

* fix(glimmer): support {{foo bar}} syntax

* feat(glimmer): implement all AST types

* feat(glimmer): implement if/else if/else

* test(glimmer): ignore leading/trailing whitespace from AST_COMPARE

* fix(glimmer): do not use trailing slash for void self-closing elements

* chore(build): disable html tests until we can sort out the glimmer dependency

* feat(html): complete rebase on parse5 addition

* Prettier Support For Glimmer VM/Handlebars

Polished Support for Sub Expressions
Added test cases for glimmer primitives
Added support for concat statements
Attempted to make element nodes work
Attempted block statements
Element Nodes are OK
Added support for block elements that are not else-if related
Added support for Else/If
Cleaning up
Rebase
Switch node 4 syntax
Update build

* Removed dead code/partials

* Added new lines to end of test files.

* Rebase after plugin change

* Added ignores to code coverage
2017-12-29 18:14:31 +01:00