eslint-plugin-header
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -0,1 +1,5 @@ | ||
# 1.1.0 | ||
* Ignore shebangs above header comments to support ESLint 4+ (#11) | ||
# 1.0.0 | ||
@@ -2,0 +6,0 @@ |
@@ -18,2 +18,12 @@ "use strict"; | ||
function excludeShebangs(comments) { | ||
return comments.filter(function(comment) { return comment.type !== "Shebang"; }); | ||
} | ||
function getLeadingComments(context, node) { | ||
return node.body.length ? | ||
context.getComments(node.body[0]).leading : | ||
context.getComments(node).leading; | ||
} | ||
module.exports = function(context) { | ||
@@ -55,8 +65,3 @@ var options = context.options; | ||
Program: function(node) { | ||
var leadingComments; | ||
if (node.body.length) { | ||
leadingComments = context.getComments(node.body[0]).leading; | ||
} else { | ||
leadingComments = context.getComments(node).leading; | ||
} | ||
var leadingComments = excludeShebangs(getLeadingComments(context, node)); | ||
@@ -63,0 +68,0 @@ if (!leadingComments.length) { |
{ | ||
"name": "eslint-plugin-header", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "ESLint plugin to ensure that files begin with given comment", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -65,2 +65,10 @@ "use strict"; | ||
options: ["block", {pattern: "^ Copyright \\d{4}\\n Author: \\w+@\\w+\\.\\w+ $"}] | ||
}, | ||
{ | ||
code: "#!/usr/bin/env node\n/**\n * Copyright\n */", | ||
options: ["block", [ | ||
"*", | ||
" * Copyright", | ||
" " | ||
]] | ||
} | ||
@@ -67,0 +75,0 @@ ], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
274
14968
12