Skip to content

Commit ae99b02

Browse files
committed
chore: format files
1 parent a59855c commit ae99b02

File tree

10 files changed

+447
-503
lines changed

10 files changed

+447
-503
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
# JS and TS files must always use LF for tools to work
55
*.js eol=lf
66
*.ts eol=lf
7+
angular-html-parser/**/* eol.lf
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.yarn/
2+
lib/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"preset": "angular",
3+
"scripts": {
4+
"postchangelog": "prettier --write CHANGELOG.md"
5+
}
6+
}

packages/angular-html-parser/CHANGELOG.md

Lines changed: 128 additions & 147 deletions
Large diffs are not rendered by default.

packages/angular-html-parser/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ yarn add angular-html-parser
1919
## Usage
2020

2121
```js
22-
import {parse} from 'angular-html-parser';
22+
import { parse } from "angular-html-parser";
2323

24-
const {rootNodes, errors} = parse(`
24+
const { rootNodes, errors } = parse(`
2525
<!DOCTYPE html>
2626
<html>
2727
<head>
@@ -67,16 +67,16 @@ interface Options {
6767
tagName: string,
6868
prefix: string,
6969
hasParent: boolean,
70-
attrs: Array<{prefix: string; name: string; value?: string | undefined}>
70+
attrs: Array<{ prefix: string; name: string; value?: string | undefined }>,
7171
) => void | ng.TagContentType;
7272
/**
7373
* tokenize angular control flow block syntax
7474
*/
75-
tokenizeAngularBlocks?: boolean,
75+
tokenizeAngularBlocks?: boolean;
7676
/**
7777
* tokenize angular let declaration syntax
7878
*/
79-
tokenizeAngularLetDeclaration?: boolean,
79+
tokenizeAngularLetDeclaration?: boolean;
8080
}
8181
```
8282

packages/angular-html-parser/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@
2424
"build-lib": "tsc -p tsconfig.build.json",
2525
"codemod": "node ./node_modules/jscodeshift/bin/jscodeshift.js -t postbuild-codemod.ts lib --extensions=js,ts --parser=ts",
2626
"test": "ts-node --project tsconfig.test.json -r tsconfig-paths/register node_modules/jasmine/bin/jasmine.js ../compiler/test/ml_parser/*_spec.ts ./test/*_spec.ts",
27-
"release": "standard-version"
28-
},
29-
"dependencies": {
30-
"tslib": "^2.8.1"
27+
"release": "standard-version",
28+
"fix": "prettier . --write"
3129
},
3230
"devDependencies": {
33-
"@types/jscodeshift": "0.12.0",
3431
"del-cli": "6.0.0",
3532
"jasmine": "5.6.0",
3633
"jscodeshift": "17.1.2",
34+
"prettier": "3.5.3",
3735
"standard-version": "9.5.0",
3836
"ts-node": "10.9.2",
3937
"tsconfig-paths": "4.2.0",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {};

packages/angular-html-parser/src/index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { HtmlParser } from "../../compiler/src/ml_parser/html_parser.js";
2-
import { TagContentType } from '../../compiler/src/ml_parser/tags.js';
2+
import { TagContentType } from "../../compiler/src/ml_parser/tags.js";
33
import { ParseTreeResult } from "../../compiler/src/ml_parser/parser.js";
44

55
let parser: HtmlParser | null = null;
@@ -17,19 +17,19 @@ export interface ParseOptions {
1717
*
1818
* defaults to false
1919
*/
20-
canSelfClose?: boolean,
20+
canSelfClose?: boolean;
2121
/**
2222
* support [`htm`](https://github.com/developit/htm) component closing tags (`<//>`)
2323
*
2424
* defaults to false
2525
*/
26-
allowHtmComponentClosingTags?: boolean,
26+
allowHtmComponentClosingTags?: boolean;
2727
/**
2828
* do not lowercase tag names before querying their tag definitions
2929
*
3030
* defaults to false
3131
*/
32-
isTagNameCaseSensitive?: boolean,
32+
isTagNameCaseSensitive?: boolean;
3333
/**
3434
* customize tag content type
3535
*
@@ -39,21 +39,21 @@ export interface ParseOptions {
3939
tagName: string,
4040
prefix: string,
4141
hasParent: boolean,
42-
attrs: Array<{prefix: string, name: string, value?: string}>
43-
) => void | TagContentType,
42+
attrs: Array<{ prefix: string; name: string; value?: string }>,
43+
) => void | TagContentType;
4444
/**
4545
* tokenize angular control flow block syntax
4646
*/
47-
tokenizeAngularBlocks?: boolean,
47+
tokenizeAngularBlocks?: boolean;
4848
/**
4949
* tokenize angular let declaration syntax
5050
*/
51-
tokenizeAngularLetDeclaration?: boolean,
51+
tokenizeAngularLetDeclaration?: boolean;
5252
}
5353

5454
export function parse(
5555
input: string,
56-
options: ParseOptions = {}
56+
options: ParseOptions = {},
5757
): ParseTreeResult {
5858
const {
5959
canSelfClose = false,

packages/angular-html-parser/test/index_spec.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ describe("options", () => {
2424
tagName: string,
2525
prefix: string,
2626
hasParent: boolean,
27-
attrs: Array<{ prefix: string; name: string; value?: string }>
27+
attrs: Array<{ prefix: string; name: string; value?: string }>,
2828
) => {
2929
if (
3030
!hasParent &&
3131
(tagName !== "template" ||
32-
attrs.find(attr => attr.name === "lang" && attr.value !== "html"))
32+
attrs.find((attr) => attr.name === "lang" && attr.value !== "html"))
3333
) {
3434
return TagContentType.RAW_TEXT;
3535
}
@@ -45,7 +45,7 @@ describe("options", () => {
4545
[html.Text, "<div>", 1, ["<div>"]],
4646
[html.Element, "custom", 0],
4747
[html.Attribute, "lang", "babel", ["babel"]],
48-
[html.Text, 'const foo = "</";', 1, ['const foo = "</";']]
48+
[html.Text, 'const foo = "</";', 1, ['const foo = "</";']],
4949
]);
5050
});
5151
});
@@ -76,19 +76,22 @@ describe("AST format", () => {
7676
name: "if",
7777
type: "block",
7878
parameters: [
79-
jasmine.objectContaining({ type: 'blockParameter', expression: 'user.isHuman' })
79+
jasmine.objectContaining({
80+
type: "blockParameter",
81+
expression: "user.isHuman",
82+
}),
8083
],
8184
children: [
82-
jasmine.objectContaining({ type: 'text', value: ' ' }),
85+
jasmine.objectContaining({ type: "text", value: " " }),
8386
jasmine.objectContaining({
84-
type: 'element',
85-
name: 'p',
87+
type: "element",
88+
name: "p",
8689
children: [
87-
jasmine.objectContaining({ type: 'text', value: 'Hello human' })
88-
]
90+
jasmine.objectContaining({ type: "text", value: "Hello human" }),
91+
],
8992
}),
90-
jasmine.objectContaining({ type: 'text', value: ' ' }),
91-
]
93+
jasmine.objectContaining({ type: "text", value: " " }),
94+
],
9295
}),
9396
]);
9497
});

0 commit comments

Comments
 (0)