kiwiirc-custom/build/eslint/rules/class-name-prefix.js
Georg b3dd3db30b
Adding show_password_box
Signed-off-by: Georg <georg@lysergic.dev>
2021-06-25 07:28:29 +02:00

40 lines
1.4 KiB
JavaScript

module.exports = {
meta: {
docs: {
description: 'html class names must start with `u-` or `kiwi-`',
category: 'base',
url: null,
},
fixable: null,
schema: [],
},
create: function (context) {
return context.parserServices.defineTemplateBodyVisitor({
"VAttribute[key.name='class']"(node) {
let classes = node.value.value.split(' ');
classes.forEach((c) => {
// Ignore empty and fontawesome classes
if (!c || c === 'fa' || c.startsWith('fa-')) {
return;
}
if (!c.startsWith('kiwi-') &&
!c.startsWith('u-') &&
// Special exception for google recaptcha - welcome screen.
!c.startsWith('g-') &&
!c.startsWith('irc-fg-') &&
!c.startsWith('irc-bg-')
) {
context.report({
node: node,
message: 'Expected class name to start with `kiwi-` or `u-` ({{ class }})',
data: {
class: c,
},
});
}
});
},
});
},
};