Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow leading newlines for source map and copyright comments #2121

Merged
merged 2 commits into from Nov 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/rules/comment-whitespace-inside/__tests__/index.js 100644 → 100755
Expand Up @@ -31,6 +31,10 @@ testRule(rule, {
code: "/*! copyright */",
}, {
code: "/*# sourcemap */",
}, {
code: "/*!\ncopyright */",
}, {
code: "/*#\nsourcemap */",
} ],

reject: [ {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/comment-whitespace-inside/index.js 100644 → 100755
Expand Up @@ -32,7 +32,7 @@ export default function (expectation) {
const firstFourChars = rawComment.substr(0, 4)

// Return early if sourcemap or copyright comment
if (firstFourChars === "/*# " || firstFourChars === "/*! ") { return }
if (/^\/\*[#!]\s/.test(firstFourChars)) { return }

const leftMatches = rawComment.match(/(^\/\*+)(\s)?/)
const rightMatches = rawComment.match(/(\s)?(\*+\/)$/)
Expand Down
7 changes: 0 additions & 7 deletions system-tests/001/__snapshots__/001.test.js.snap
Expand Up @@ -14,13 +14,6 @@ Array [
"severity": "error",
"text": "Expected empty line before comment (comment-empty-line-before)",
},
Object {
"column": 3,
"line": 1,
"rule": "comment-whitespace-inside",
"severity": "error",
"text": "Expected whitespace after \"/*\" (comment-whitespace-inside)",
},
Object {
"column": 3,
"line": 5414,
Expand Down