mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
|
/**
|
||
|
* @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: {
|
||
|
type: "problem",
|
||
|
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: [],
|
||
|
},
|
||
|
|
||
|
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,
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
},
|
||
|
}
|