Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-eslint-comments

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-eslint-comments - npm Package Compare versions

Comparing version 3.0.0-beta.1 to 3.0.0-beta.2

29

lib/patch.js

@@ -44,8 +44,15 @@ /**

function getCommentAt(message, sourceCode) {
if (sourceCode == null) {
return undefined
if (sourceCode != null) {
const loc = { line: message.line, column: message.column - 1 }
const index = sourceCode.getIndexFromLoc(loc)
const options = { includeComments: true }
const comment = sourceCode.getTokenByRangeStart(index, options)
if (
comment != null &&
(comment.type === "Line" || comment.type === "Block")
) {
return comment
}
}
const index = sourceCode.getIndexFromLoc(message) - 1
return sourceCode.getTokenByRangeStart(index, { includeComments: true })
return undefined
}

@@ -56,11 +63,9 @@

* @param {Message} message The message.
* @param {Comment|undefined} comment The comment which existed at the message location.
* @returns {boolean} `true` if the message is a `reportUnusedDisableDirectives` error.
*/
function isUnusedDisableDirectiveError(message, comment) {
function isUnusedDisableDirectiveError(message) {
return (
!message.fatal &&
!message.ruleId &&
message.message.includes("eslint-disable") &&
(comment == null || comment.type === "Block" || comment.type === "Line")
message.message.includes("eslint-disable")
)

@@ -116,5 +121,3 @@ }

const message = messages[i]
const comment = getCommentAt(message, sourceCode)
if (!isUnusedDisableDirectiveError(message, comment)) {
if (!isUnusedDisableDirectiveError(message)) {
continue

@@ -127,3 +130,3 @@ }

message,
comment
getCommentAt(message, sourceCode)
)

@@ -130,0 +133,0 @@

@@ -18,3 +18,3 @@ /**

url:
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.1/docs/rules/disable-enable-pair.md",
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.2/docs/rules/disable-enable-pair.md",
},

@@ -21,0 +21,0 @@ fixable: null,

@@ -18,3 +18,3 @@ /**

url:
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.1/docs/rules/no-aggregating-enable.md",
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.2/docs/rules/no-aggregating-enable.md",
},

@@ -21,0 +21,0 @@ fixable: null,

@@ -17,3 +17,3 @@ /**

url:
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.1/docs/rules/no-duplicate-disable.md",
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.2/docs/rules/no-duplicate-disable.md",
},

@@ -20,0 +20,0 @@ fixable: null,

@@ -19,3 +19,3 @@ /**

url:
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.1/docs/rules/no-restricted-disable.md",
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.2/docs/rules/no-restricted-disable.md",
},

@@ -22,0 +22,0 @@ fixable: null,

@@ -22,3 +22,3 @@ /**

url:
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.1/docs/rules/no-unlimited-disable.md",
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.2/docs/rules/no-unlimited-disable.md",
},

@@ -25,0 +25,0 @@ fixable: null,

@@ -17,3 +17,3 @@ /**

url:
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.1/docs/rules/no-unused-disable.md",
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.2/docs/rules/no-unused-disable.md",
},

@@ -20,0 +20,0 @@ fixable: null,

@@ -17,3 +17,3 @@ /**

url:
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.1/docs/rules/no-unused-enable.md",
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.2/docs/rules/no-unused-enable.md",
},

@@ -20,0 +20,0 @@ fixable: null,

@@ -20,3 +20,3 @@ /**

url:
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.1/docs/rules/no-use.md",
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.2/docs/rules/no-use.md",
},

@@ -23,0 +23,0 @@ fixable: null,

{
"name": "eslint-plugin-eslint-comments",
"version": "3.0.0-beta.1",
"version": "3.0.0-beta.2",
"description": "Additional ESLint rules for ESLint directive comments.",

@@ -5,0 +5,0 @@ "engines": {

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