directive-selector to allow button[xcButton] style selectors
My Component/Directive prefixes are xc like so:
"directive-selector": [
true,
"attribute",
"xc",
"camelCase"
],
And I've created a Directive for button loaders that looks like:
<button xcButton [loading]="true">Submit</button>
The selector is: selector: 'button[xcButton]' but Codelyzer complains that it should be prefixed with xc. I feel like something like this should be allowed, or at least configurable to be
Hi @intellix , it seems legitimate. We will investigate. Thank you for this issue.
@intellix, the following spec passes:
it.only('should work with valid selector', () => {
const source = `
@Directive({
selector: 'button[xcButton]'
})
class Test {}
`;
assertSuccess('directive-selector', source, ['attribute', 'xc', 'camelCase']);
});
Would you provide a code snippet so we can reproduce the problem?
Ahah, now I see my folly :)
directive-selector: camelCase component-selector: kebab-case
I'm using a Component with an attribute selector because I wanna have styles and a template. It seems what I'd like to enforce is:
Attribute based selectors: camelCase Element based selectors: kebab-case
Currently I have to use kebab-case because it's a component: button[xc-button]
@mgechev It would be great to be able to achieve what @intellix said:
It seems what I'd like to enforce is:
Attribute based selectors: camelCase Element based selectors: kebab-case
If we configure "component-selector" like this:
"component-selector": [true, ["element", "attribute"], ["prefix"], ["kebab-case", "camelCase"], nothing is really enforced and one can create a component with kebab-case atrribute selector, which I would like to avoid.