Commit b9ebc7e
committed
fix(no-v-html): add CallExpression support to ignorePattern option (#2949)
This commit extends the `ignorePattern` option to support function call expressions
like `$sanitize(test)`, not just simple variable identifiers like `htmlSafe`.
Changes:
- Add new `shouldIgnore()` helper function that handles both Identifier and
CallExpression expression types
- For Identifiers, use the `name` property directly for optimal performance
- For CallExpressions and other expression types, use `sourceCode.getText()`
to get the full expression text
- Update the visitor to pass `sourceCode` to the new helper function
This allows users to configure patterns like `^\$sanitize\(` to match function
call expressions where the function name matches the pattern.
Tests:
- Add test case for CallExpression matching with ignorePattern `^\$sanitize\(`
- All existing tests continue to pass1 parent 5ec36ce commit b9ebc7e
File tree
3 files changed
+35
-3
lines changed- .changeset
- lib/rules
- tests/lib/rules
3 files changed
+35
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
39 | 60 | | |
40 | 61 | | |
41 | 62 | | |
| 63 | + | |
| 64 | + | |
42 | 65 | | |
43 | | - | |
44 | 66 | | |
45 | 67 | | |
46 | | - | |
47 | | - | |
| 68 | + | |
| 69 | + | |
48 | 70 | | |
49 | 71 | | |
50 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
| |||
0 commit comments