eslint-plugin-eslint-comments
Advanced tools
Comparing version 2.0.2 to 3.0.0-beta.0
11
index.js
@@ -1,6 +0,2 @@ | ||
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* See LICENSE file in root directory for full license. | ||
*/ | ||
/** DON'T EDIT THIS FILE WHICH WAS CREATED BY 'scripts/generate-index.js'. */ | ||
"use strict" | ||
@@ -18,3 +14,3 @@ | ||
"eslint-comments/no-unlimited-disable": "error", | ||
"eslint-comments/no-unused-disable": "error", | ||
"eslint-comments/no-unused-disable": "off", | ||
"eslint-comments/no-unused-enable": "error", | ||
@@ -35,2 +31,5 @@ "eslint-comments/no-use": "off", | ||
}, | ||
utils: { | ||
patch: require("./lib/patch.js").patch, | ||
}, | ||
} |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,12 +7,3 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
const utils = require("./utils") | ||
//------------------------------------------------------------------------------ | ||
// Helpers | ||
//------------------------------------------------------------------------------ | ||
const COMMENT_DIRECTIVE = /^\s*(eslint-(?:en|dis)able(?:(?:-next)?-line)?)\s*(?:(\S|\S[\s\S]*\S)\s*)?$/ | ||
@@ -23,6 +13,2 @@ const DELIMITER = /[\s,]+/g | ||
//------------------------------------------------------------------------------ | ||
// Exports | ||
//------------------------------------------------------------------------------ | ||
module.exports = class DisabledArea { | ||
@@ -80,7 +66,5 @@ /** | ||
end: null, | ||
reported: false, | ||
}) | ||
} | ||
} | ||
else { | ||
} else { | ||
if (this._getArea(null, location) != null) { | ||
@@ -96,3 +80,2 @@ this.duplicateDisableDirectives.push({ comment, ruleId: null }) | ||
end: null, | ||
reported: false, | ||
}) | ||
@@ -122,3 +105,7 @@ } | ||
if (area.end === null && area.kind === kind && area.ruleId === ruleId) { | ||
if ( | ||
area.end === null && | ||
area.kind === kind && | ||
area.ruleId === ruleId | ||
) { | ||
relatedDisableDirectives.add(area.comment) | ||
@@ -134,4 +121,3 @@ area.end = location | ||
} | ||
} | ||
else { | ||
} else { | ||
let used = false | ||
@@ -154,3 +140,6 @@ | ||
this.numberOfRelatedDisableDirectives.set(comment, relatedDisableDirectives.size) | ||
this.numberOfRelatedDisableDirectives.set( | ||
comment, | ||
relatedDisableDirectives.size | ||
) | ||
} | ||
@@ -170,3 +159,4 @@ | ||
if ((area.ruleId === null || area.ruleId === ruleId) && | ||
if ( | ||
(area.ruleId === null || area.ruleId === ruleId) && | ||
utils.lte(area.start, location) && | ||
@@ -200,7 +190,8 @@ (area.end === null || utils.lte(location, area.end)) | ||
this._disable(comment, comment.loc.start, ruleIds, "block") | ||
} | ||
else if (comment.type === "Block" && kind === "eslint-enable") { | ||
} else if (comment.type === "Block" && kind === "eslint-enable") { | ||
this._enable(comment, comment.loc.start, ruleIds, "block") | ||
} | ||
else if (comment.type === "Line" && kind === "eslint-disable-line") { | ||
} else if ( | ||
comment.type === "Line" && | ||
kind === "eslint-disable-line" | ||
) { | ||
const line = comment.loc.start.line | ||
@@ -212,4 +203,6 @@ const start = { line, column: 0 } | ||
this._enable(comment, end, ruleIds, "line") | ||
} | ||
else if (comment.type === "Line" && kind === "eslint-disable-next-line") { | ||
} else if ( | ||
comment.type === "Line" && | ||
kind === "eslint-disable-next-line" | ||
) { | ||
const line = comment.loc.start.line | ||
@@ -224,16 +217,2 @@ const start = { line: line + 1, column: 0 } | ||
} | ||
/** | ||
* Mark the area of the given ruleId and location as reported. | ||
* | ||
* @param {string} ruleId - The ruleId name to mark. | ||
* @param {object} location - The location to mark. | ||
* @returns {void} | ||
*/ | ||
report(ruleId, location) { | ||
const area = this._getArea(ruleId, location) | ||
if (area != null) { | ||
area.reported = true | ||
} | ||
} | ||
} |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,35 +7,32 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
const DisabledArea = require("../disabled-area") | ||
const utils = require("../utils") | ||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
module.exports = { | ||
meta: { | ||
docs: { | ||
description: "requires a `eslint-enable` comment for every `eslint-disable` comment", | ||
description: | ||
"requires a `eslint-enable` comment for every `eslint-disable` comment", | ||
category: "Best Practices", | ||
recommended: true, | ||
url: "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/disable-enable-pair.md", | ||
url: | ||
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.0/docs/rules/disable-enable-pair.md", | ||
}, | ||
fixable: false, | ||
schema: [{ | ||
type: "object", | ||
properties: { | ||
allowWholeFile: { | ||
type: "boolean", | ||
fixable: null, | ||
schema: [ | ||
{ | ||
type: "object", | ||
properties: { | ||
allowWholeFile: { | ||
type: "boolean", | ||
}, | ||
}, | ||
additionalProperties: false, | ||
}, | ||
additionalProperties: false, | ||
}], | ||
], | ||
}, | ||
create(context) { | ||
const allowWholeFile = context.options[0] && context.options[0].allowWholeFile | ||
const allowWholeFile = | ||
context.options[0] && context.options[0].allowWholeFile | ||
const sourceCode = context.getSourceCode() | ||
@@ -55,3 +51,6 @@ const disabledArea = DisabledArea.get(sourceCode) | ||
} | ||
if (allowWholeFile && utils.lte(area.start, node.loc.start)) { | ||
if ( | ||
allowWholeFile && | ||
utils.lte(area.start, node.loc.start) | ||
) { | ||
continue | ||
@@ -62,5 +61,5 @@ } | ||
loc: utils.toRuleIdLocation(area.comment, area.ruleId), | ||
message: (area.ruleId) ? | ||
"Requires 'eslint-enable' directive for '{{ruleId}}'." : | ||
"Requires 'eslint-enable' directive.", | ||
message: area.ruleId | ||
? "Requires 'eslint-enable' directive for '{{ruleId}}'." | ||
: "Requires 'eslint-enable' directive.", | ||
data: area, | ||
@@ -67,0 +66,0 @@ }) |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,53 +7,41 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
const DisabledArea = require("../disabled-area") | ||
const utils = require("../utils") | ||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
/** | ||
* Creates AST event handlers for no-aggregating-enable. | ||
* | ||
* @param {RuleContext} context - The rule context. | ||
* @returns {object} AST event handlers. | ||
*/ | ||
function create(context) { | ||
const sourceCode = context.getSourceCode() | ||
const disabledArea = DisabledArea.get(sourceCode) | ||
return { | ||
Program() { | ||
for (const entry of disabledArea.numberOfRelatedDisableDirectives) { | ||
const comment = entry[0] | ||
const count = entry[1] | ||
if (count >= 2) { | ||
context.report({ | ||
loc: utils.toForceLocation(comment.loc), | ||
message: "This `eslint-enable` comment affects {{count}} `eslint-disable` comments. An `eslint-enable` comment should be for an `eslint-disable` comment.", | ||
data: { count }, | ||
}) | ||
} | ||
} | ||
}, | ||
} | ||
} | ||
module.exports = { | ||
create, | ||
meta: { | ||
docs: { | ||
description: "disallows `eslint-enable` comments for multiple `eslint-disable` comments", | ||
description: | ||
"disallows `eslint-enable` comments for multiple `eslint-disable` comments", | ||
category: "Best Practices", | ||
recommended: true, | ||
url: "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/no-aggregating-enable.md", | ||
url: | ||
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.0/docs/rules/no-aggregating-enable.md", | ||
}, | ||
fixable: false, | ||
fixable: null, | ||
schema: [], | ||
}, | ||
create(context) { | ||
const sourceCode = context.getSourceCode() | ||
const disabledArea = DisabledArea.get(sourceCode) | ||
return { | ||
Program() { | ||
for (const entry of disabledArea.numberOfRelatedDisableDirectives) { | ||
const comment = entry[0] | ||
const count = entry[1] | ||
if (count >= 2) { | ||
context.report({ | ||
loc: utils.toForceLocation(comment.loc), | ||
message: | ||
"This `eslint-enable` comment affects {{count}} `eslint-disable` comments. An `eslint-enable` comment should be for an `eslint-disable` comment.", | ||
data: { count }, | ||
}) | ||
} | ||
} | ||
}, | ||
} | ||
}, | ||
} |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,13 +7,5 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
const DisabledArea = require("../disabled-area") | ||
const utils = require("../utils") | ||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
module.exports = { | ||
@@ -26,5 +17,6 @@ meta: { | ||
recommended: true, | ||
url: "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/no-duplicate-disable.md", | ||
url: | ||
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.0/docs/rules/no-duplicate-disable.md", | ||
}, | ||
fixable: false, | ||
fixable: null, | ||
schema: [], | ||
@@ -42,5 +34,5 @@ }, | ||
loc: utils.toRuleIdLocation(item.comment, item.ruleId), | ||
message: (item.ruleId) ? | ||
"'{{ruleId}}' rule has been disabled already." : | ||
"ESLint rules have been disabled already.", | ||
message: item.ruleId | ||
? "'{{ruleId}}' rule has been disabled already." | ||
: "ESLint rules have been disabled already.", | ||
data: item, | ||
@@ -47,0 +39,0 @@ }) |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,6 +7,2 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
const Ignore = require("ignore") | ||
@@ -17,50 +12,13 @@ const DisabledArea = require("../disabled-area") | ||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
/** | ||
* Creates AST event handlers for no-restricted-disable. | ||
* | ||
* @param {RuleContext} context - The rule context. | ||
* @returns {object} AST event handlers. | ||
*/ | ||
function create(context) { | ||
const sourceCode = context.getSourceCode() | ||
const disabledArea = DisabledArea.get(sourceCode) | ||
if (context.options.length === 0) { | ||
return {} | ||
} | ||
const ig = new Ignore() | ||
for (const pattern of context.options) { | ||
ig.add(pattern) | ||
} | ||
return { | ||
Program() { | ||
for (const area of disabledArea.areas) { | ||
if (area.ruleId == null || ig.ignores(area.ruleId)) { | ||
context.report({ | ||
loc: utils.toRuleIdLocation(area.comment, area.ruleId), | ||
message: "Disabling '{{ruleId}}' is not allowed.", | ||
data: { ruleId: area.ruleId || String(context.options) }, | ||
}) | ||
} | ||
} | ||
}, | ||
} | ||
} | ||
module.exports = { | ||
create, | ||
meta: { | ||
docs: { | ||
description: "disallows `eslint-disable` comments about specific rules", | ||
description: | ||
"disallows `eslint-disable` comments about specific rules", | ||
category: "Stylistic Issues", | ||
recommended: false, | ||
url: "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/no-restricted-disable.md", | ||
url: | ||
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.0/docs/rules/no-restricted-disable.md", | ||
}, | ||
fixable: false, | ||
fixable: null, | ||
schema: { | ||
@@ -72,2 +30,35 @@ type: "array", | ||
}, | ||
create(context) { | ||
const sourceCode = context.getSourceCode() | ||
const disabledArea = DisabledArea.get(sourceCode) | ||
if (context.options.length === 0) { | ||
return {} | ||
} | ||
const ig = new Ignore() | ||
for (const pattern of context.options) { | ||
ig.add(pattern) | ||
} | ||
return { | ||
Program() { | ||
for (const area of disabledArea.areas) { | ||
if (area.ruleId == null || ig.ignores(area.ruleId)) { | ||
context.report({ | ||
loc: utils.toRuleIdLocation( | ||
area.comment, | ||
area.ruleId | ||
), | ||
message: "Disabling '{{ruleId}}' is not allowed.", | ||
data: { | ||
ruleId: area.ruleId || String(context.options), | ||
}, | ||
}) | ||
} | ||
} | ||
}, | ||
} | ||
}, | ||
} |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,12 +7,4 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
const utils = require("../utils") | ||
//------------------------------------------------------------------------------ | ||
// Helpers | ||
//------------------------------------------------------------------------------ | ||
const PATTERNS = { | ||
@@ -24,15 +15,13 @@ Block: /^\s*(eslint-disable)\s*(\S)?/, | ||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
module.exports = { | ||
meta: { | ||
docs: { | ||
description: "disallows `eslint-disable` comments without rule names", | ||
description: | ||
"disallows `eslint-disable` comments without rule names", | ||
category: "Best Practices", | ||
recommended: true, | ||
url: "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/no-unlimited-disable.md", | ||
url: | ||
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.0/docs/rules/no-unlimited-disable.md", | ||
}, | ||
fixable: false, | ||
fixable: null, | ||
schema: [], | ||
@@ -56,3 +45,4 @@ }, | ||
loc: utils.toForceLocation(comment.loc), | ||
message: "Unexpected unlimited '{{kind}}' comment. Specify some rule names to disable.", | ||
message: | ||
"Unexpected unlimited '{{kind}}' comment. Specify some rule names to disable.", | ||
data: { kind: m[1] }, | ||
@@ -59,0 +49,0 @@ }) |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,13 +7,5 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
// Patch `Linter#verify` to work. | ||
require("../patch").patch() | ||
const DisabledArea = require("../disabled-area") | ||
const utils = require("../utils") | ||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
module.exports = { | ||
@@ -25,61 +16,20 @@ meta: { | ||
category: "Best Practices", | ||
recommended: true, | ||
url: "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/no-unused-disable.md", | ||
recommended: false, | ||
url: | ||
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.0/docs/rules/no-unused-disable.md", | ||
}, | ||
fixable: false, | ||
fixable: null, | ||
schema: [], | ||
}, | ||
create(context) { | ||
const linter = context.eslint || context._linter | ||
const originalReport = linter.report | ||
const sourceCode = context.getSourceCode() | ||
const disabledArea = DisabledArea.get(sourceCode) | ||
// Override `report` method to mark disabled-area as reported. | ||
linter.report = function(ruleId, _severity, node, locationArg) { | ||
const location = (typeof locationArg === "string") | ||
? node.loc.start | ||
: locationArg.start || locationArg | ||
disabledArea.report(ruleId, location) | ||
originalReport.apply(this, arguments) | ||
} | ||
/** | ||
* Reports the result. | ||
* | ||
* @returns {void} | ||
*/ | ||
function report() { | ||
for (const area of disabledArea.areas) { | ||
if (area.reported) { | ||
continue | ||
} | ||
context.report({ | ||
loc: utils.toRuleIdLocation(area.comment, area.ruleId), | ||
message: (area.ruleId) ? | ||
"'{{ruleId}}' rule is disabled but never reported." : | ||
"ESLint rules are disabled but never reported.", | ||
data: area, | ||
}) | ||
} | ||
// Restore | ||
linter.report = originalReport | ||
} | ||
return { | ||
Program() { | ||
// Ensure that this listener is the last in `Program:exit` listeners | ||
// even if this rule was initialized before other rules. | ||
linter.on("Program:exit", report) | ||
}, | ||
"Program:exit"() { | ||
// Ensure that at least one Program:exit listener exists so that the report listener will be called. | ||
}, | ||
} | ||
create() { | ||
// This rule patches `Linter#verify` method and: | ||
// | ||
// 1. enables `reportUnusedDisableDirectives` option. | ||
// 2. verifies the code. | ||
// 3. converts `reportUnusedDisableDirectives` errors to `no-unused-disable` errors. | ||
// | ||
// So this rule itself does nothing. | ||
return {} | ||
}, | ||
} |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,13 +7,5 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
const DisabledArea = require("../disabled-area") | ||
const utils = require("../utils") | ||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
module.exports = { | ||
@@ -26,5 +17,6 @@ meta: { | ||
recommended: true, | ||
url: "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/no-unused-enable.md", | ||
url: | ||
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.0/docs/rules/no-unused-enable.md", | ||
}, | ||
fixable: false, | ||
fixable: null, | ||
schema: [], | ||
@@ -42,5 +34,5 @@ }, | ||
loc: utils.toRuleIdLocation(item.comment, item.ruleId), | ||
message: (item.ruleId) ? | ||
"'{{ruleId}}' rule is re-enabled but it has not been disabled." : | ||
"ESLint rules are re-enabled but those have not been disabled.", | ||
message: item.ruleId | ||
? "'{{ruleId}}' rule is re-enabled but it has not been disabled." | ||
: "ESLint rules are re-enabled but those have not been disabled.", | ||
data: item, | ||
@@ -47,0 +39,0 @@ }) |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,12 +7,3 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
const utils = require("../utils") | ||
//------------------------------------------------------------------------------ | ||
// Helpers | ||
//------------------------------------------------------------------------------ | ||
const PATTERNS = { | ||
@@ -24,6 +14,2 @@ Block: /^\s*(eslint(?:-disable|-enable|-env)?|exported|globals?)(?:\s|$)/, | ||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
module.exports = { | ||
@@ -35,29 +21,32 @@ meta: { | ||
recommended: false, | ||
url: "https://github.com/mysticatea/eslint-plugin-eslint-comments/tree/master/docs/rules/no-use.md", | ||
url: | ||
"https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/v3.0.0-beta.0/docs/rules/no-use.md", | ||
}, | ||
fixable: false, | ||
schema: [{ | ||
type: "object", | ||
properties: { | ||
allow: { | ||
type: "array", | ||
items: { | ||
enum: [ | ||
"eslint", | ||
"eslint-disable", | ||
"eslint-disable-line", | ||
"eslint-disable-next-line", | ||
"eslint-enable", | ||
"eslint-env", | ||
"exported", | ||
"global", | ||
"globals", | ||
], | ||
fixable: null, | ||
schema: [ | ||
{ | ||
type: "object", | ||
properties: { | ||
allow: { | ||
type: "array", | ||
items: { | ||
enum: [ | ||
"eslint", | ||
"eslint-disable", | ||
"eslint-disable-line", | ||
"eslint-disable-next-line", | ||
"eslint-enable", | ||
"eslint-env", | ||
"exported", | ||
"global", | ||
"globals", | ||
], | ||
}, | ||
additionalItems: false, | ||
uniqueItems: true, | ||
}, | ||
additionalItems: false, | ||
uniqueItems: true, | ||
}, | ||
additionalProperties: false, | ||
}, | ||
additionalProperties: false, | ||
}], | ||
], | ||
}, | ||
@@ -64,0 +53,0 @@ |
/** | ||
* @author Toru Nagashima | ||
* @copyright 2016 Toru Nagashima. All rights reserved. | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
@@ -8,18 +7,5 @@ */ | ||
//------------------------------------------------------------------------------ | ||
// Requirements | ||
//------------------------------------------------------------------------------ | ||
const escapeStringRegexp = require("escape-string-regexp") | ||
//------------------------------------------------------------------------------ | ||
// Helpers | ||
//------------------------------------------------------------------------------ | ||
const LINE_PATTERN = /[^\r\n\u2028\u2029]*(?:\r\n|[\r\n\u2028\u2029]|$)/g | ||
//------------------------------------------------------------------------------ | ||
// Exports | ||
//------------------------------------------------------------------------------ | ||
module.exports = { | ||
@@ -70,4 +56,8 @@ /** | ||
line: start.line, | ||
column: 2 + start.column + m.index + m[1].length + | ||
ruleId.length, | ||
column: | ||
2 + | ||
start.column + | ||
m.index + | ||
m[1].length + | ||
ruleId.length, | ||
}, | ||
@@ -74,0 +64,0 @@ } |
{ | ||
"name": "eslint-plugin-eslint-comments", | ||
"version": "2.0.2", | ||
"description": "Additional ESLint rules for directive comments of ESLint.", | ||
"version": "3.0.0-beta.0", | ||
"description": "Additional ESLint rules for ESLint directive comments.", | ||
"engines": { | ||
"node": "^4.0.0 || >=6.0.0" | ||
"node": ">=6.5.0" | ||
}, | ||
@@ -13,16 +13,16 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"eslint": ">=4.7.0" | ||
"eslint": ">=4.19.1" | ||
}, | ||
"dependencies": { | ||
"escape-string-regexp": "^1.0.5", | ||
"ignore": "^3.3.7" | ||
"ignore": "^3.3.8" | ||
}, | ||
"devDependencies": { | ||
"chokidar-cli": "^1.2.0", | ||
"codecov": "^3.0.0", | ||
"eslint": "^4.10.0", | ||
"eslint-config-mysticatea": "^12.0.0", | ||
"mocha": "^4.0.0", | ||
"npm-run-all": "^4.1.1", | ||
"nyc": "^11.2.1", | ||
"@types/node": "^10.0.4", | ||
"codecov": "^3.0.1", | ||
"cross-spawn": "^6.0.5", | ||
"eslint": "^4.19.1", | ||
"eslint-plugin-mysticatea": "^5.0.0-beta.5", | ||
"mocha": "^5.1.1", | ||
"nyc": "^11.7.1", | ||
"opener": "^1.4.3", | ||
@@ -32,9 +32,9 @@ "rimraf": "^2.6.2" | ||
"scripts": { | ||
"preversion": "run-s clean test build", | ||
"preversion": "npm test", | ||
"version": "eslint lib --fix && node scripts/update.js && git add .", | ||
"postversion": "git push && git push --tags", | ||
"build": "node scripts/build.js", | ||
"clean": "rimraf .nyc_output coverage index.js", | ||
"lint": "eslint lib scripts tests", | ||
"test": "nyc mocha \"tests/lib/**/*.js\" --reporter progress", | ||
"watch": "chokidar lib tests --initial --command \"npm test && nyc report --reporter lcov\"", | ||
"test": "nyc mocha \"tests/lib/**/*.js\" --reporter dot --timeout 4000", | ||
"watch": "mocha \"tests/lib/**/*.js\" --reporter dot --timeout 4000 --watch --growl", | ||
"coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html", | ||
@@ -41,0 +41,0 @@ "codecov": "nyc report --reporter lcovonly && codecov" |
@@ -9,3 +9,3 @@ # eslint-plugin-eslint-comments | ||
Additional ESLint rules for ESLint's directive-comments (e.g. `//eslint-disable-line`). | ||
Additional ESLint rules for ESLint directive comments (e.g. `//eslint-disable-line`). | ||
@@ -20,4 +20,4 @@ ## 💿 Installation | ||
- Node.js `^4.0.0`, `^6.0.0`, or newer. | ||
- ESLint `^4.7.0`, or newer. | ||
- Node.js `^6.5.0`, or newer versions. | ||
- ESLint `^4.19.1`, or newer versions. | ||
@@ -70,3 +70,3 @@ ## 📖 Usage | ||
| 🌟 | [eslint-comments/no-unlimited-disable](./docs/rules/no-unlimited-disable.md) | disallows `eslint-disable` comments without rule names | | ||
| 🌟 | [eslint-comments/no-unused-disable](./docs/rules/no-unused-disable.md) | disallows unused `eslint-disable` comments | | ||
| | [eslint-comments/no-unused-disable](./docs/rules/no-unused-disable.md) | disallows unused `eslint-disable` comments | | ||
| 🌟 | [eslint-comments/no-unused-enable](./docs/rules/no-unused-enable.md) | disallows unused `eslint-enable` comments | | ||
@@ -73,0 +73,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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
36528
15
841
1
1
Updatedignore@^3.3.8