Skip to content

Commit

Permalink
Fix false positives for style attributes in no-missing-end-of-source-…
Browse files Browse the repository at this point in the history
…newline (#3485)
  • Loading branch information
gucong3000 authored and jeddy3 committed Jul 21, 2018
1 parent 5744a01 commit 775903a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rules/no-missing-end-of-source-newline/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ testRule(rule, {
testRule(rule, {
ruleName,
config: [true],
skipBasicChecks: true,
syntax: "html",

accept: [
Expand All @@ -84,6 +85,9 @@ a {
</style>
</div>`
},
{
code: '<a style="color: red;"></a>'
}
],

Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-missing-end-of-source-newline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const rule = function(primary, _, context) {
eachRoot(root, checkRoot);

function checkRoot(root) {
if (root.source.inline) {
return;
}
const rootString = root.source.input.css;
if (rootString.trim() === "" || rootString.slice(-1) === "\n") {
return;
Expand Down

0 comments on commit 775903a

Please sign in to comment.