02c17f131b
Allow lang attribute of <template> to be empty ( #12394 )
...
Co-authored-by: niklasvatn <niklas@vatn.se >
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2022-03-09 06:37:16 +08:00
Sosuke Suzuki
ff78a94424
Reduce bundle size of parser-html.js ( #12176 )
2022-01-28 10:07:37 +08:00
翠 / green and fisker Cheung
dd3e1a49e0
Improved performance with large HTML files ( #11696 )
...
* Simplify Object.assign
* Remove copying ast inside addIsSpaceSensitive
* Remove copying ast inside extractWhitespaces
* Remove copying ast inside removeIgnorableFirstLf
* Remove copying ast inside mergeIeConditonalStartEndCommentIntoElementOpeningTag
* Remove copying ast inside mergeNodeIntoText
* Remove copying ast inside mergeSimpleElementIntoText
* Remove copying ast inside extractInterpolation
* Remove copying ast inside _parse
* Remove copying ast inside preprocess
* Fix lint
* Refactor index/next/prev recalculation with loop
* Remove redundant condition
Co-authored-by: fisker Cheung <lionkay@gmail.com >
* Remove index/siblings from properties
* Define and use replaceChild method
* Change prev/next into getter
* Make parent non writable
* setNonEnumerableProperties to setNonEnumerableProperty
* Set parent with constructor
* Make parent a normal property
* Use child.prev/next
* Remove parent parameter from constructor
Co-authored-by: fisker Cheung <lionkay@gmail.com >
2022-01-11 10:06:46 -03:00
fisker Cheung
e2d07b35ec
Enable unicorn/prefer-switch ( #11935 )
2021-12-07 14:13:12 +08:00
fisker Cheung
16b6825172
Make options argument in parsers optional ( #11892 )
2021-12-02 13:56:47 +08:00
Sosuke Suzuki
9dcfd16e6a
Use ts-expect-error instead of ts-ignore ( #11330 )
2021-08-09 00:00:22 +09:00
fisker Cheung
894f841fbd
Style: Enforce extensions ( #11227 )
2021-07-21 09:10:34 +08:00
dependabot[bot] and Georgii Dolzhykov
f6b3919a62
Build(deps): Bump angular-html-parser from 1.7.1 to 1.8.0 ( #10681 )
...
* Build(deps): Bump angular-html-parser from 1.7.1 to 1.8.0
Bumps [angular-html-parser](https://github.com/ikatyang/angular-html-parser ) from 1.7.1 to 1.8.0.
- [Release notes](https://github.com/ikatyang/angular-html-parser/releases )
- [Changelog](https://github.com/ikatyang/angular-html-parser/blob/master/CHANGELOG.md )
- [Commits](https://github.com/ikatyang/angular-html-parser/compare/v1.7.1...v1.8.0 )
Signed-off-by: dependabot[bot] <support@github.com >
* Typechecking improvements
* Add a TODO comment
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com >
2021-04-12 11:53:19 +03:00
a6a05fa7fd
Enable and fix typecheck in language-html ( #8904 )
...
Co-authored-by: fisker <lionkay@gmail.com >
Co-authored-by: Christopher J. Brody <chris.brody+brodybits@gmail.com >
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com >
2021-03-29 20:00:50 +08:00
fisker Cheung
230428f34b
Add consistent-negative-index-access rule ( #10569 )
2021-03-20 14:06:12 +02:00
fisker Cheung
9c6de24405
Style: Disallow == ( #10338 )
2021-02-21 02:44:16 +02:00
Georgii Dolzhykov
ca4a51dcd9
build: fix tree shaking for front matter related functions ( #10314 )
2021-02-15 05:29:15 +02:00
fisker Cheung and Georgii Dolzhykov
6175013ae3
Enable unicorn/no-array-for-each ( #10112 )
...
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com >
2021-01-24 19:26:42 +08:00
fisker Cheung
181a325c1c
Enable unicorn/explicit-length-check ( #9975 )
2021-01-04 10:11:57 +08:00
fisker Cheung
9e9cc85072
Enable directly-loc-start-end for all languages ( #9610 )
2020-11-10 09:06:08 +08:00
fisker Cheung
5b6d1dfd91
Refactor: getParserName -> inferParserByLanguage ( #9556 )
2020-11-02 10:41:03 +08:00
fisker Cheung
3fe4666a85
Consistent parser errors ( #9406 )
2020-10-16 10:39:05 +08:00
fisker Cheung
e10aeee5c9
HTML: Fix crash on reading Node.sourceSpan ( #9372 )
2020-10-13 09:17:57 +08:00
fisker Cheung
720177ac5c
HTML: Fix format on files with frontMatter ( #9043 )
2020-08-25 19:49:38 +08:00
fisker Cheung
d31ebf4619
Test: Improve coverage ( #8811 )
2020-08-21 09:43:24 +08:00
fisker Cheung
97b899b7bc
Improve multiparser handle finalNewLine and frontMatter ( #8595 )
2020-08-16 16:12:20 +08:00
fisker Cheung
0c2b918078
ESLint: enable import/order ( #8635 )
2020-06-26 20:30:21 +08:00
Sosuke Suzuki
f3e59453cd
Vue: Improve upper case HTML tag formatting in DOM template ( #8337 )
...
* Treat upper case HTML same as lower case one
* Add changelog
* Support mixed case html tag
2020-05-19 10:30:03 +09:00
Sosuke Suzuki
b94e41aae4
Vue: Support Vue DOM template formatting ( #8326 )
2020-05-18 21:22:30 +08:00
Sosuke Suzuki
531b7ca139
Vue: improve parsing custom blocks with angular-html-parser@1.5.0 ( #8153 )
...
* Parse twice for vue
* Remove 'html' from vueRootElementsSet
* Add link for Vue SFC spec
* Modify to don't format pug code
* Add changelog
* Fix typo
* Change lang, pug => unknown in tests
* Support top-level html
* Refactor shouldParseAsHTML
* Fix multiple template formatting
* Tiny fix
* Fix by Lint
* Remove console.log
* Support nested template tag
* Meke expected syntax errors
* Update tests
* Support unclosed node
* Update to angular-html-parser@1.7.0
* Update
* Remove failed tests
* Modify to throw first parsing error
* Remove options for error tests
* Optimize parse
* Fix reviewed points
* Fix by lint
2020-05-14 22:08:40 +08:00
fisker Cheung
f0207e6850
Enable unicorn/better-regex ( #7991 )
...
* Enable `unicorn/better-regex`
* Spellcheck ignore regex
2020-04-10 21:20:40 +08:00
Georgii Dolzhykov
9dad95b35f
Bump Prettier dependency to 2.0.0
2020-03-21 22:09:54 +02: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
9900174d50
HTML: don't treat colons as namespace prefix delimiters in tag names ( #7273 )
2020-01-20 16:39:19 +02:00
Lucas Duailibe
ff79721397
Bump Prettier dependency to 1.17.0
2019-04-12 17:44:48 -03: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
Ika
ffc8482458
fix(vue): tag names are case-sensitive ( #5606 )
2018-12-13 10:31:48 +08:00
Ika
952bc0cc03
fix: get rid of CRLF ( #5494 )
2018-12-08 18:28:29 +08:00
Ika
28b938da97
feat(html): update angular-html-parser ( #5565 )
...
- support [`htm`](https://github.com/developit/htm ) (`<${Component}>content<//>`, `<div />`)
- preserve [bogus comments](https://www.w3.org/TR/html5/syntax.html#bogus-comment-state ) (`<! ... >`, `<? ... >`)
2018-11-29 11:03:22 +08:00
Ika
4dd7c79bbf
fix(html): correct column for error code frame ( #5553 )
...
- before
```html
[error] test.html: SyntaxError: Unexpected character "/" (1:26)
[error] > 1 | <div>footer content here<//>
[error] | ^
```
- after
```html
[error] test.html: SyntaxError: Unexpected character "/" (1:27)
[error] > 1 | <div>footer content here<//>
[error] | ^
```
2018-11-27 17:45:17 +08:00
Ika
a7528ebea4
fix(ng,vue): do not normalize attribute names ( #5549 )
2018-11-26 12:09:19 +08:00
Ika
cdac9552ef
fix(vue,ng): do not normalize tag names ( #5526 )
2018-11-23 13:12:43 +08:00
Ika
668e049a5e
feat(html): support ie conditional start/end comment ( #5470 )
2018-11-15 12:35:28 +08:00
Ika
182a92eb28
fix(html): preserve incomplete ie conditional comment ( #5429 )
2018-11-10 16:44:44 +08:00
Ika
12a8fa3a24
fix(html): treat CRLF as LF ( #5393 )
2018-11-09 09:56:46 +08: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
Ika
07abf0588e
fix(html): non-HTML attributes are considered case-sensitive ( #5135 )
2018-09-27 20:18:00 +08:00
Ika
51954daa74
fix(html): do not format unknown script ( #5132 )
...
- do not format unknown script
- do not normalize spaces in script tags
2018-09-23 08:36:54 +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