Update scripts and documentation to use nx and new monorepo architecture (#2912)
* Update scripts and documentation to use nx and new monorepo architecture * Start fixing docker * Migrate eslint plugin and postgres setup * Fix docker * Fix patches * Fix * fix: wip try to fix the patches * Apply patches --------- Co-authored-by: Jérémy Magrin <jeremy.magrin@gmail.com>
This commit is contained in:
@ -0,0 +1,62 @@
|
||||
import {
|
||||
AST_NODE_TYPES,
|
||||
ESLintUtils,
|
||||
TSESTree,
|
||||
} from "@typescript-eslint/utils";
|
||||
|
||||
const createRule = ESLintUtils.RuleCreator(() => `https://docs.twenty.com`);
|
||||
|
||||
const styledComponentsPrefixedWithStyledRule = createRule({
|
||||
create: (context) => {
|
||||
return {
|
||||
VariableDeclarator: (node: TSESTree.VariableDeclarator) => {
|
||||
const templateExpr = node.init;
|
||||
if (templateExpr?.type !== AST_NODE_TYPES.TaggedTemplateExpression) {
|
||||
return;
|
||||
}
|
||||
const tag = templateExpr.tag;
|
||||
const tagged =
|
||||
tag.type === AST_NODE_TYPES.MemberExpression
|
||||
? tag.object
|
||||
: tag.type === AST_NODE_TYPES.CallExpression
|
||||
? tag.callee
|
||||
: null;
|
||||
if (
|
||||
tagged?.type === AST_NODE_TYPES.Identifier &&
|
||||
tagged.name === "styled"
|
||||
) {
|
||||
const variable = node.id as TSESTree.Identifier;
|
||||
if (variable.name.startsWith("Styled")) {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
messageId: "noStyledPrefix",
|
||||
data: {
|
||||
componentName: variable.name,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
name: "styled-components-prefixed-with-styled",
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
docs: {
|
||||
description: "Warn when StyledComponents are not prefixed with Styled",
|
||||
recommended: "recommended",
|
||||
},
|
||||
messages: {
|
||||
noStyledPrefix:
|
||||
"{{componentName}} is a StyledComponent and is not prefixed with Styled.",
|
||||
},
|
||||
fixable: "code",
|
||||
schema: [],
|
||||
},
|
||||
defaultOptions: [],
|
||||
});
|
||||
|
||||
module.exports = styledComponentsPrefixedWithStyledRule;
|
||||
|
||||
export default styledComponentsPrefixedWithStyledRule;
|
||||
Reference in New Issue
Block a user