Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,24 +1,22 @@
|
||||
module.exports = {
|
||||
create: function (context) {
|
||||
return {
|
||||
TaggedTemplateExpression(node) {
|
||||
if (context.getFilename().endsWith('themes.ts')) {
|
||||
return;
|
||||
create: (context) => ({
|
||||
TaggedTemplateExpression(node) {
|
||||
if (context.getFilename().endsWith("themes.ts")) {
|
||||
return;
|
||||
}
|
||||
|
||||
node.quasi.quasis.forEach((quasi) => {
|
||||
const colorRegex =
|
||||
/(?:rgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(,\s*\d+\.?\d*)?\))|(?:#[0-9a-fA-F]{6})/i;
|
||||
|
||||
if (colorRegex.test(quasi.value.raw)) {
|
||||
context.report({
|
||||
node,
|
||||
message:
|
||||
"Do not use hardcoded RGBA or Hex colors. Please use a color from the theme file.",
|
||||
});
|
||||
}
|
||||
|
||||
node.quasi.quasis.forEach((quasi) => {
|
||||
const colorRegex =
|
||||
/(?:rgba?\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})(,\s*\d+\.?\d*)?\))|(?:#[0-9a-fA-F]{6})/i;
|
||||
|
||||
if (colorRegex.test(quasi.value.raw)) {
|
||||
context.report({
|
||||
node,
|
||||
message:
|
||||
'Do not use hardcoded RGBA or Hex colors. Please use a color from the theme file.',
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user