-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With updated and stricter tests, outdated plugin no longer required.
- Loading branch information
Showing
8 changed files
with
53 additions
and
40 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { requireCoverageIgnoreReason } from './require-coverage-ignore-reason.js'; | ||
|
||
export default { | ||
rules: { | ||
'require-coverage-ignore-reason': requireCoverageIgnoreReason, | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
// Extracted from: https://github.com/graphql/graphql-js/pull/3388 related to: | ||
// https://github.com/istanbuljs/eslint-plugin-istanbul/pull/17 | ||
// Fixed reason length check and converted to ESM. | ||
|
||
export function requireCoverageIgnoreReason(context) { | ||
const istanbulRegExp = /^\s*istanbul\s+ignore\s+(if|else|next|file)\s+/; | ||
return { | ||
Program() { | ||
const sourceCode = context.getSourceCode(); | ||
|
||
for (const node of sourceCode.getAllComments()) { | ||
const comment = node.value; | ||
|
||
if (comment.match(istanbulRegExp)) { | ||
const reason = comment.replace(istanbulRegExp, ''); | ||
if (reason.length === 0) { | ||
context.report({ | ||
message: 'Add a reason why code coverage should be ignored', | ||
node, | ||
}); | ||
} | ||
} | ||
} | ||
}, | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ var something = { | |
return 'hello' + world | ||
}, | ||
world(hai = 2) { | ||
/* istanbul ignore next */ | ||
return hai; | ||
} | ||
}; |
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