Skip to content

Commit

Permalink
fix(eslint-plugin): [prefer-optional-chain] allow $ in identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Nov 27, 2019
1 parent f83f04b commit c72c3c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/eslint-plugin/src/rules/prefer-optional-chain.ts
Expand Up @@ -95,7 +95,7 @@ export default util.createRule({
`^${
// escape regex characters
leftText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
}[^a-zA-Z0-9_]`,
}[^a-zA-Z0-9_$]`,
);
if (
!matchRegex.test(rightText) &&
Expand Down
Expand Up @@ -126,6 +126,7 @@ ruleTester.run('prefer-optional-chain', rule, {
'nextToken && sourceCode.isSpaceBetweenTokens(prevToken, nextToken)',
'result && this.options.shouldPreserveNodeMaps',
'foo && fooBar.baz',
'match && match$1 !== undefined',
'foo !== null && foo !== undefined',
'x["y"] !== undefined && x["y"] !== null',
// currently do not handle complex computed properties
Expand Down

0 comments on commit c72c3c1

Please sign in to comment.