Skip to content

Commit

Permalink
renamed regexps variable names for better understanding
Browse files Browse the repository at this point in the history
  • Loading branch information
Rec0iL99 committed Nov 17, 2023
1 parent 1b1dea5 commit b997d58
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/rules/no-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,19 @@ module.exports = {
* node.
*/
function maybeAsiHazard(node) {
const OPT_OUT_PATTERN = /^[-[(/+`]/u; // One of [(/+-`
const CONTINUATION_PATTERN = /^[:;{]/u; // One of :;{
const SAFE_TOKENS_BEFORE = /^[:;{]$/u; // One of :;{
const UNSAFE_CHARS_AFTER = /^[-[(/+`]/u; // One of [(/+-`

const tokenBefore = sourceCode.getTokenBefore(node.parent.parent);
const tokenAfter = sourceCode.getTokenAfter(node.parent.parent);

return (
Boolean(tokenAfter) &&
OPT_OUT_PATTERN.test(tokenAfter.value) &&
UNSAFE_CHARS_AFTER.test(tokenAfter.value) &&
tokenAfter.value !== "++" &&
tokenAfter.value !== "--" &&
Boolean(tokenBefore) &&
!CONTINUATION_PATTERN.test(tokenBefore.value) &&
!SAFE_TOKENS_BEFORE.test(tokenBefore.value) &&
tokenBefore.value !== "++" &&
tokenBefore.value !== "--"
);
Expand Down

0 comments on commit b997d58

Please sign in to comment.