Skip to content

Commit

Permalink
Fix max-empty-lines before comments (#5507)
Browse files Browse the repository at this point in the history
* Disable Dependabot on default branch (#5452)

Currently, we have mainly developed on the `v14` branch. See #5439.

See also:
https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates#open-pull-requests-limit

* Set `target-branch: v14` for Dependabot again (#5453)

This change is a retry of PR #5439 and also a revert of PR #5452.
Maybe, `target-branch: v14` should be set on the `master` branch, not `v14`.

* Fix max-empty-lines before comments

* Update snapshot

Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
  • Loading branch information
yepninja and ybiquitous committed Sep 2, 2021
1 parent e5034d2 commit 399d524
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
7 changes: 7 additions & 0 deletions lib/rules/max-empty-lines/__tests__/index.js
Expand Up @@ -120,6 +120,13 @@ testRule({
line: 5,
column: 1,
},
{
code: 'a {}\n\n\n/** horse */\n\nb {}',
fixed: 'a {}\n\n/** horse */\n\nb {}',
message: messages.expected(1),
line: 3,
column: 1,
},
{
code: 'a {}\r\n\r\n/** horse */\r\n\r\n\r\nb {}',
fixed: 'a {}\r\n\r\n/** horse */\r\n\r\nb {}',
Expand Down
15 changes: 3 additions & 12 deletions lib/rules/max-empty-lines/index.js
Expand Up @@ -50,23 +50,14 @@ function rule(max, options, context) {
if (context.fix) {
root.walk((node) => {
if (node.type === 'comment') {
// for inline comments
if (node.raws.inline) {
node.raws.before = getChars(node.raws.before);
}

if (!ignoreComments) {
node.raws.left = getChars(node.raws.left);
node.raws.right = getChars(node.raws.right);
}
} else {
if (node.raws.before) {
node.raws.before = getChars(node.raws.before);
}
}

if (node.raws.after) {
node.raws.after = getChars(node.raws.after);
}
if (node.raws.before) {
node.raws.before = getChars(node.raws.before);
}
});

Expand Down
2 changes: 0 additions & 2 deletions system-tests/003/__snapshots__/no-fs.test.js.snap
Expand Up @@ -15,7 +15,6 @@ Object {
/* Your images should be linked as if the CSS file sits in the same folder as the images. ie. no paths. */
/* basic elements */
html {
margin: 0;
Expand Down Expand Up @@ -66,7 +65,6 @@ abbr {
border-bottom: none;
}
/* specific divs */
.page-wrapper {
background: url(http://csszengarden.com/001/zen-bg.jpg) no-repeat top left;
Expand Down

0 comments on commit 399d524

Please sign in to comment.