Skip to content

Commit

Permalink
Breaking: Switch class option for lines-around-comment (fixes eslin…
Browse files Browse the repository at this point in the history
  • Loading branch information
Mardak committed May 8, 2017
1 parent c70b0ed commit 4ba7f79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/rules/lines-around-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ module.exports = {
* @returns {boolean} True if the comment is at block start.
*/
function isCommentAtBlockStart(token) {
return isCommentAtParentStart(token, "ClassBody") || isCommentAtParentStart(token, "BlockStatement") || isCommentAtParentStart(token, "SwitchCase");
return isCommentAtParentStart(token, "BlockStatement") || isCommentAtParentStart(token, "SwitchCase");
}

/**
Expand All @@ -221,7 +221,7 @@ module.exports = {
* @returns {boolean} True if the comment is at block end.
*/
function isCommentAtBlockEnd(token) {
return isCommentAtParentEnd(token, "ClassBody") || isCommentAtParentEnd(token, "BlockStatement") || isCommentAtParentEnd(token, "SwitchCase") || isCommentAtParentEnd(token, "SwitchStatement");
return isCommentAtParentEnd(token, "BlockStatement") || isCommentAtParentEnd(token, "SwitchCase") || isCommentAtParentEnd(token, "SwitchStatement");
}

/**
Expand All @@ -230,7 +230,7 @@ module.exports = {
* @returns {boolean} True if the comment is at object start.
*/
function isCommentAtObjectStart(token) {
return isCommentAtParentStart(token, "ObjectExpression") || isCommentAtParentStart(token, "ObjectPattern");
return isCommentAtParentStart(token, "ObjectExpression") || isCommentAtParentStart(token, "ObjectPattern") || isCommentAtParentStart(token, "ClassBody");
}

/**
Expand All @@ -239,7 +239,7 @@ module.exports = {
* @returns {boolean} True if the comment is at object end.
*/
function isCommentAtObjectEnd(token) {
return isCommentAtParentEnd(token, "ObjectExpression") || isCommentAtParentEnd(token, "ObjectPattern");
return isCommentAtParentEnd(token, "ObjectExpression") || isCommentAtParentEnd(token, "ObjectPattern") || isCommentAtParentEnd(token, "ClassBody");
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/lines-around-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ ruleTester.run("lines-around-comment", rule, {
},
{
code: "class A {\n/**\n* hi\n */\nconstructor() {}\n}",
options: [{ allowBlockStart: true }],
options: [{ allowObjectStart: true }],
parserOptions: { ecmaVersion: 6 }
},
{
Expand Down Expand Up @@ -414,7 +414,7 @@ ruleTester.run("lines-around-comment", rule, {
code: "class B {\nconstructor() {}\n\n/**\n* hi\n */\n}",
options: [{
afterBlockComment: true,
allowBlockEnd: true
allowObjectEnd: true
}],
parserOptions: { ecmaVersion: 6 }
},
Expand Down

0 comments on commit 4ba7f79

Please sign in to comment.