Skip to content

Commit

Permalink
chore: add test case for #391, disable unicorn/template-indent for pr…
Browse files Browse the repository at this point in the history
…ettier (#393)
  • Loading branch information
JounQin authored May 13, 2022
1 parent f99339a commit 7e59d5e
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 371 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@types/eslint": "^8.4.2",
"@types/eslint-plugin-markdown": "^2.0.0",
"@types/jest": "^27.5.0",
"@types/node": "^17.0.31",
"@types/node": "^17.0.32",
"@types/react": "^18.0.9",
"@types/unist": "^2.0.6",
"lerna": "^4.0.0",
Expand Down
296 changes: 2 additions & 294 deletions test/__snapshots__/fixtures.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -230,30 +230,6 @@ Array [
"ruleId": "no-unused-expressions",
"severity": 2,
},
Object {
"column": 28,
"endColumn": 8,
"endLine": 92,
"fix": Object {
"range": Array [
1570,
1866,
],
"text": "
<aui-tab-group [type]=\\"type\\">
<aui-tab label=\\"Tab 0\\"><aui-card> Content 1 </aui-card></aui-tab>
<aui-tab label=\\"Tab 1\\"><aui-card> Content 2 </aui-card></aui-tab>
<aui-tab label=\\"Tab 2\\"><aui-card> Content 3 </aui-card></aui-tab>
</aui-tab-group>
",
},
"line": 86,
"message": "Templates should be properly indented.",
"messageId": "template-indent",
"nodeType": "TemplateLiteral",
"ruleId": "unicorn/template-indent",
"severity": 2,
},
Object {
"column": 6,
"endColumn": 6,
Expand All @@ -265,42 +241,6 @@ Array [
"ruleId": "no-unused-expressions",
"severity": 2,
},
Object {
"column": 28,
"endColumn": 8,
"endLine": 126,
"fix": Object {
"range": Array [
2053,
2797,
],
"text": "
<aui-form-item>
<label auiFormItemLabel>尺寸</label>
<aui-radio-group
auiFormItemControl
[(ngModel)]=\\"size\\"
[plain]=\\"false\\"
>
<aui-radio-button value=\\"large\\">大</aui-radio-button>
<aui-radio-button value=\\"medium\\">中</aui-radio-button>
<aui-radio-button value=\\"small\\">小</aui-radio-button>
</aui-radio-group>
</aui-form-item>
<aui-tab-group [size]=\\"size\\">
<aui-tab label=\\"Tab 0\\"><aui-card> Content 1 </aui-card></aui-tab>
<aui-tab label=\\"Tab 1\\"><aui-card> Content 2 </aui-card></aui-tab>
<aui-tab label=\\"Tab 2\\"><aui-card> Content 3 </aui-card></aui-tab>
</aui-tab-group>
",
},
"line": 108,
"message": "Templates should be properly indented.",
"messageId": "template-indent",
"nodeType": "TemplateLiteral",
"ruleId": "unicorn/template-indent",
"severity": 2,
},
Object {
"column": 6,
"endColumn": 6,
Expand All @@ -312,43 +252,6 @@ Array [
"ruleId": "no-unused-expressions",
"severity": 2,
},
Object {
"column": 28,
"endColumn": 24,
"endLine": 159,
"fix": Object {
"range": Array [
2998,
3589,
],
"text": "
aui-tab-group>
<ng-container *auiTabTitle>aa2</ng-container>
<aui-tab>
<ng-container *auiTabLabel>
<aui-icon icon=\\"sun\\"></aui-icon>
Custom Label
</ng-container>
<aui-card> Content 1 </aui-card>
</aui-tab>
<aui-tab label=\\"Tab 1\\"><aui-card>Content 2</aui-card></aui-tab>
<aui-tab>
<ng-container *auiTabLabel>
<aui-icon icon=\\"moon\\"></aui-icon>
Custom Label
</ng-container>
<aui-card> Content 3 </aui-card>
</aui-tab>
</aui-tab-group
",
},
"line": 142,
"message": "Templates should be properly indented.",
"messageId": "template-indent",
"nodeType": "TemplateLiteral",
"ruleId": "unicorn/template-indent",
"severity": 2,
},
Object {
"column": 6,
"endColumn": 6,
Expand All @@ -360,44 +263,6 @@ Array [
"ruleId": "no-unused-expressions",
"severity": 2,
},
Object {
"column": 28,
"endColumn": 8,
"endLine": 197,
"fix": Object {
"range": Array [
3825,
4386,
],
"text": "
<aui-tab-group>
<aui-tab
*ngFor=\\"let tab of tabs; index as i; count as len\\"
[closeable]=\\"len > 1\\"
[label]=\\"'tab' + tab\\"
(close)=\\"remove(i)\\"
>
<aui-card> content {{ i }} </aui-card>
</aui-tab>
<button
*auiTabHeaderAddon
aui-button=\\"primary\\"
(click)=\\"add()\\"
size=\\"small\\"
[square]=\\"true\\"
>
<aui-icon icon=\\"plus\\"></aui-icon>
</button>
</aui-tab-group>
",
},
"line": 177,
"message": "Templates should be properly indented.",
"messageId": "template-indent",
"nodeType": "TemplateLiteral",
"ruleId": "unicorn/template-indent",
"severity": 2,
},
Object {
"column": 13,
"endColumn": 16,
Expand Down Expand Up @@ -486,39 +351,6 @@ Array [
"ruleId": "no-unused-expressions",
"severity": 2,
},
Object {
"column": 28,
"endColumn": 8,
"endLine": 238,
"fix": Object {
"range": Array [
4863,
5355,
],
"text": "
<aui-tab-group>
<aui-tab label=\\"Tab 0\\"> <aui-card> Content 1 </aui-card> </aui-tab>
<aui-tab
label=\\"Tab 1\\"
[disabled]=\\"true\\"
><aui-card> Content 2 </aui-card></aui-tab
>
<aui-tab label=\\"Tab 2\\"><aui-card> Content 3 </aui-card></aui-tab>
<aui-tab
label=\\"Tab 3\\"
[disabled]=\\"true\\"
><aui-card> Content 4 </aui-card></aui-tab
>
</aui-tab-group>
",
},
"line": 223,
"message": "Templates should be properly indented.",
"messageId": "template-indent",
"nodeType": "TemplateLiteral",
"ruleId": "unicorn/template-indent",
"severity": 2,
},
Object {
"column": 6,
"endColumn": 6,
Expand All @@ -530,53 +362,6 @@ Array [
"ruleId": "no-unused-expressions",
"severity": 2,
},
Object {
"column": 28,
"endColumn": 8,
"endLine": 285,
"fix": Object {
"range": Array [
5652,
6633,
],
"text": "
<aui-form-item>
<label auiFormItemLabel>启用</label>
<aui-radio-group
auiFormItemControl
[(ngModel)]=\\"lazy\\"
[plain]=\\"false\\"
>
<aui-radio-button [value]=\\"true\\">是</aui-radio-button>
<aui-radio-button [value]=\\"false\\">否</aui-radio-button>
</aui-radio-group>
</aui-form-item>
<aui-tab-group [lazy]=\\"lazy\\">
<aui-tab label=\\"Tab 1\\">
<tabs-lazy-test *auiTabContent
><aui-card> Content 1 </aui-card></tabs-lazy-test
>
</aui-tab>
<aui-tab label=\\"Tab 2\\">
<tabs-lazy-test *auiTabContent
><aui-card> Content 2 </aui-card></tabs-lazy-test
>
</aui-tab>
<aui-tab label=\\"Tab 3\\">
<tabs-lazy-test *auiTabContent
><aui-card> Content 3 </aui-card></tabs-lazy-test
>
</aui-tab>
</aui-tab-group>
",
},
"line": 256,
"message": "Templates should be properly indented.",
"messageId": "template-indent",
"nodeType": "TemplateLiteral",
"ruleId": "unicorn/template-indent",
"severity": 2,
},
Object {
"column": 6,
"endColumn": 6,
Expand All @@ -588,59 +373,6 @@ Array [
"ruleId": "no-unused-expressions",
"severity": 2,
},
Object {
"column": 28,
"endColumn": 26,
"endLine": 335,
"fix": Object {
"range": Array [
6863,
8120,
],
"text": "
<aui-form-item>
<label auiFormItemLabel>启用 Lazy</label>
<aui-radio-group
auiFormItemControl
[(ngModel)]=\\"lazy\\"
[plain]=\\"false\\"
>
<aui-radio-button [value]=\\"true\\">是</aui-radio-button>
<aui-radio-button [value]=\\"false\\">否</aui-radio-button>
</aui-radio-group>
</aui-form-item>
<aui-tab-group [lazy]=\\"lazy\\">
<aui-tab label=\\"Tab 1\\">
<tabs-active-test *auiTabContent
><aui-card>Content 1</aui-card></tabs-active-test
>
</aui-tab>
<aui-tab label=\\"Tab 2\\">
<tabs-active-test *auiTabContent>
<aui-tab-group [lazy]=\\"true\\">
<aui-tab label=\\"Tab 2-1\\">
<tabs-active-test *auiTabContent>
<aui-card> Content 2-1 </aui-card>
</tabs-active-test>
</aui-tab>
<aui-tab label=\\"Tab 2-2\\">
<tabs-active-test *auiTabContent>
<aui-card> Content 2-2 </aui-card>
</tabs-active-test>
</aui-tab>
</aui-tab-group>
</tabs-active-test>
</aui-tab>
</aui-tab-group
",
},
"line": 302,
"message": "Templates should be properly indented.",
"messageId": "template-indent",
"nodeType": "TemplateLiteral",
"ruleId": "unicorn/template-indent",
"severity": 2,
},
Object {
"column": 6,
"endColumn": 6,
Expand All @@ -652,35 +384,11 @@ Array [
"ruleId": "no-unused-expressions",
"severity": 2,
},
Object {
"column": 28,
"endColumn": 8,
"endLine": 359,
"fix": Object {
"range": Array [
8305,
8736,
],
"text": "
<aui-tab-group size=\\"large\\">
<ng-container *auiTabTitle>Title</ng-container>
<aui-tab label=\\"Tab 0\\"> <aui-card> Content 1 </aui-card> </aui-tab>
<aui-tab label=\\"Tab 1\\"><aui-card> Content 2 </aui-card></aui-tab>
<aui-tab label=\\"Tab 2\\"><aui-card> Content 3 </aui-card></aui-tab>
<aui-tab label=\\"Tab 3\\"><aui-card> Content 4 </aui-card></aui-tab>
</aui-tab-group>
",
},
"line": 351,
"message": "Templates should be properly indented.",
"messageId": "template-indent",
"nodeType": "TemplateLiteral",
"ruleId": "unicorn/template-indent",
"severity": 2,
},
]
`;
exports[`fixtures should match all snapshots: 391.mdx 1`] = `Array []`;
exports[`fixtures should match all snapshots: acorn.mdx 1`] = `
Array [
Object {
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const getCli = (lintCodeBlocks = false) =>
version: 'detect',
},
},
rules: {
'unicorn/template-indent': 0,
},
overrides: lintCodeBlocks
? [
{
Expand Down
11 changes: 11 additions & 0 deletions test/fixtures/391.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Hello world

```js
<Foo />
```

<Foo />

```jsx
<Foo />
```
Loading

0 comments on commit 7e59d5e

Please sign in to comment.