-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tslint] blueprint-html-components fixer! (#3162)
* enable strict mode in tslint-config * sort imports before adding * blueprint-html-components fixes imports * refactors * replaceTagName util * test formatting * add test for all imports * h2/h5
- Loading branch information
Showing
10 changed files
with
88 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright 2018 Palantir Technologies, Inc. All rights reserved. | ||
* | ||
* Licensed under the terms of the LICENSE file distributed with this project. | ||
*/ | ||
|
||
import { Replacement } from "tslint"; | ||
import { JsxTagNameExpression } from "typescript"; | ||
|
||
/** Replace the name of a JSX tag. */ | ||
export function replaceTagName(tagName: JsxTagNameExpression, newTagName: string) { | ||
return new Replacement(tagName.getFullStart(), tagName.getFullWidth(), newTagName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/tslint-config/test/rules/blueprint-html-components/true/all.tsx.fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Blockquote, Code, H2, H5, Pre } from "@blueprintjs/core"; | ||
<H5>Subtitle</H5> | ||
<Pre>block</Pre> | ||
<H2>Title</H2> | ||
<Code>code element</Code> | ||
<Blockquote /> | ||
|
12 changes: 12 additions & 0 deletions
12
packages/tslint-config/test/rules/blueprint-html-components/true/all.tsx.lint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<h5>Subtitle</h5> | ||
~~ [err % ("H5")] | ||
<pre>block</pre> | ||
~~~ [err % ("Pre")] | ||
<h2>Title</h2> | ||
~~ [err % ("H2")] | ||
<code>code element</code> | ||
~~~~ [err % ("Code")] | ||
<blockquote /> | ||
~~~~~~~~~~ [err % ("Blockquote")] | ||
|
||
[err]: use Blueprint <%s> component instead of JSX intrinsic element. |
7 changes: 7 additions & 0 deletions
7
packages/tslint-config/test/rules/blueprint-html-components/true/test.tsx.fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Blockquote, Code, H1, H3, Pre } from "@blueprintjs/core"; | ||
<H3>Subtitle</H3> | ||
<Pre>block</Pre> | ||
|
||
<H1>Title</H1> | ||
<Code>code element</Code> | ||
<Blockquote /> |
10 changes: 4 additions & 6 deletions
10
packages/tslint-config/test/rules/blueprint-html-components/true/test.tsx.lint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import { H3, Pre } from "@blueprintjs/core"; | ||
<H3>Subtitle</H3> | ||
<Pre>block</Pre> | ||
|
||
<h1>Title</h1> | ||
~~ [err % ("H1")] | ||
|
||
<code>code element</code> | ||
~~~~ [err % ("Code")] | ||
|
||
<blockquote /> | ||
~~~~~~~~~~ [err % ("Blockquote")] | ||
|
||
<H3>Subtitle</H3> | ||
<Pre>block</Pre> | ||
|
||
[err]: use Blueprint <%s> component instead of JSX intrinsic element. |
6fc03f3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tslint] blueprint-html-components fixer! (#3162)
Previews: documentation | landing | table