Skip to content
Permalink
9bfb9ba527
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
57 lines (52 sloc) 1.8 KB
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const utils = require("../internal/utils")
module.exports = {
meta: {
docs: {
description:
"disallow `eslint-disable` comments without rule names",
category: "Best Practices",
recommended: true,
url:
"https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-unlimited-disable.html",
},
fixable: null,
schema: [],
type: "suggestion",
},
create(context) {
const sourceCode = context.getSourceCode()
return {
Program() {
for (const comment of sourceCode.getAllComments()) {
const directiveComment = utils.parseDirectiveComment(
comment
)
if (directiveComment == null) {
continue
}
const kind = directiveComment.kind
if (
kind !== "eslint-disable" &&
kind !== "eslint-disable-line" &&
kind !== "eslint-disable-next-line"
) {
continue
}
if (!directiveComment.value) {
context.report({
loc: utils.toForceLocation(comment.loc),
message:
"Unexpected unlimited '{{kind}}' comment. Specify some rule names to disable.",
data: { kind: directiveComment.kind },
})
}
}
},
}
},
}