Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/rules/template-no-implicit-this.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ module.exports = {
properties: {
allow: {
type: 'array',
items: { type: 'string' },
uniqueItems: true,
items: { anyOf: [{ type: 'string' }, { instanceof: 'RegExp' }] },
uniqueItems: false,
},
},
additionalProperties: false,
Expand Down Expand Up @@ -145,8 +145,8 @@ module.exports = {
return;
}

// Skip paths matching the allow list (exact match only)
if (allowList.includes(path)) {
// Skip paths matching the allow list (exact string or regex)
if (allowList.some((item) => (item instanceof RegExp ? item.test(path) : item === path))) {
return;
}

Expand Down
5 changes: 5 additions & 0 deletions tests/lib/rules/template-no-implicit-this.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ hbsRuleTester.run('template-no-implicit-this', rule, {
code: '{{book-details}}',
options: [{ allow: ['book-details'] }],
},
// Allow config option — regex pattern
{
code: '{{data-test-foo}}',
options: [{ allow: [/^data-test-.+/] }],
},
],
invalid: [
{
Expand Down
Loading