Skip to content

Commit 0d426e4

Browse files
committed
Merge branch 'master' into use-jsonc-parser
2 parents bf75310 + 9be979b commit 0d426e4

File tree

5 files changed

+58
-16
lines changed

5 files changed

+58
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# CHANGELOG
2+
## 0.7.9
3+
### Minor
4+
- Add support for linting comments
25
## 0.6.9
36
### Patch
47
- Add eslint 7 unit testing

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = {
5454
ignoreCase
5555
} = checkOptions(context.options[0] || {});
5656
const sourceCode = context.getSourceCode();
57-
const comments = sourceCode.getAllComments();
57+
5858
const allPatterns = Object.assign({}, STANDARD_PATTERNS, additionalRegexes);
5959
const allDelimiters = additionalDelimiters.concat([" "]);
6060

@@ -112,6 +112,10 @@ module.exports = {
112112
});
113113
}
114114

115+
//Check all comments
116+
const comments = sourceCode.getAllComments();
117+
comments.forEach(comment => checkString(comment.value,comment));
118+
115119
return {
116120
Literal(node) {
117121
const { value } = node;

package-lock.json

Lines changed: 39 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-no-secrets",
3-
"version": "0.7.10",
3+
"version": "0.8.10",
44
"description": "An eslint rule that searches for potential secrets/keys in code",
55
"main": "index.js",
66
"scripts": {

tests/lib/rules/no-secrets.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ class A {
6969

7070
const IS_REALLY_A_NAMESPACE_TEST = `
7171
const NAMESPACE_CLASSNAME = 'Validation.JSONSchemaValidationUtilsImplFactory';
72-
`
72+
`;
73+
74+
const COMMENTS_TEST = `
75+
// const password = "ZWVTjPQSdhwRgl204Hc51YCsritMIzn8B=/p9UyeX7xu6KkAGqfm3FJ+oObLDNEva";
76+
const password = "";
77+
`;
7378
/**
7479
* Test to make sure regular expressions aren't triggered by the entropy check
7580
*/
@@ -170,6 +175,10 @@ const TESTS = {
170175
{
171176
code:SECRET_LOWERCASE_STRING,
172177
errors:[HIGH_ENTROPY_MSG]
178+
},
179+
{
180+
code: COMMENTS_TEST,
181+
errors:[HIGH_ENTROPY_MSG]
173182
}
174183
].concat(PATTERN_MATCH_TESTS)
175184
};

0 commit comments

Comments
 (0)