Permalink
Cannot retrieve contributors at this time
42 lines (38 sloc)
1.31 KB
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?
codeql-action/node_modules/eslint-plugin-eslint-comments/lib/rules/no-unused-enable.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Toru Nagashima <https://github.com/mysticatea> | |
* See LICENSE file in root directory for full license. | |
*/ | |
"use strict" | |
const DisabledArea = require("../internal/disabled-area") | |
const utils = require("../internal/utils") | |
module.exports = { | |
meta: { | |
docs: { | |
description: "disallow unused `eslint-enable` comments", | |
category: "Best Practices", | |
recommended: true, | |
url: | |
"https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/no-unused-enable.html", | |
}, | |
fixable: null, | |
schema: [], | |
type: "problem", | |
}, | |
create(context) { | |
const sourceCode = context.getSourceCode() | |
const disabledArea = DisabledArea.get(sourceCode) | |
return { | |
Program() { | |
for (const item of disabledArea.unusedEnableDirectives) { | |
context.report({ | |
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.", | |
data: item, | |
}) | |
} | |
}, | |
} | |
}, | |
} |