Socket
Socket
Sign inDemoInstall

eslint-plugin-header

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-header - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 1.1.0
* Ignore shebangs above header comments to support ESLint 4+ (#11)
# 1.0.0

@@ -2,0 +6,0 @@

17

lib/rules/header.js

@@ -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 @@ ],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc