eslint-plugin-no-comments
Advanced tools
Comparing version 1.0.5 to 1.0.7
29
index.js
module.exports = { | ||
rules: { | ||
'disallowComments': { | ||
create: function(context) { | ||
"rules": { | ||
"disallowComments": { | ||
meta: { | ||
type: "problem", | ||
docs: { | ||
description: "Comments are not allowed in this project as they can cause unnecessary noise or leak into production code. Check configuration to see the exceptions from this rule." | ||
}, | ||
fixable: "code", | ||
}, | ||
"create"(context) { | ||
const sourceCode = context.getSourceCode(); | ||
function processComment(comment) { | ||
const re = /^\s?(global|eslint)/ | ||
const re = /^\s?(global|eslint)/; | ||
if (comment && !re.test(comment.value)) { | ||
context.report({ | ||
node: null, | ||
loc: comment.loc, | ||
message: 'Comments are forbidden', | ||
fix(fixer) { | ||
return fixer.remove(comment) | ||
return fixer.remove(comment); | ||
}, | ||
"loc": comment.loc, | ||
"message": "Comments are forbidden", | ||
"node": null | ||
}); | ||
@@ -23,7 +30,7 @@ } | ||
comments.forEach(processComment); | ||
}, | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
} | ||
} | ||
}; |
{ | ||
"name": "eslint-plugin-no-comments", | ||
"version": "1.0.5", | ||
"version": "1.0.7", | ||
"description": "ESLint plugin to disallow comment blocks", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,5 +19,5 @@ # eslint-plugin-no-comments | ||
{ | ||
"plugins": ["eslint-plugin-no-comments"], | ||
"plugins": ["no-comments"], | ||
"rules": { | ||
"eslint-plugin-no-comments/disallowComments": "error" | ||
"no-comments/disallowComments": "error" | ||
} | ||
@@ -24,0 +24,0 @@ } |
3883
34