Code Formatting Best Practices for Low-Code/No-Code Platforms
Establish formatting guidelines to maintain readability and consistency in low-code/no-code environments.
0 likes
197 views
Rule Content
# Code Formatting Best Practices for Low-Code/No-Code Platforms
## Description
Establish formatting guidelines to maintain readability and consistency in low-code/no-code environments.
## Category
Code Formatting
## Category Context
Ensures consistent style in code by handling indentation, spacing, line breaks, and overall structure to keep code clean and readable.
## Rule
{
"name": "code_formatting_best_practices_low_code_no_code",
"description": "Enforces code formatting standards to maintain readability and consistency in low-code/no-code environments.",
"filters": [
{
"type": "file_extension",
"pattern": "\\.js$|\\.ts$|\\.jsx$|\\.tsx$|\\.html$|\\.css$|\\.json$"
}
],
"actions": [
{
"type": "suggest",
"message": "Ensure consistent indentation using 2 spaces per level.",
"pattern": "(?m)^(\\s{3}|\\t)"
},
{
"type": "suggest",
"message": "Use single quotes for strings in JavaScript and TypeScript files.",
"pattern": "(?<!\\\\)\"(.*?)\""
},
{
"type": "suggest",
"message": "Include a newline at the end of each file.",
"pattern": "(?<!\\n)\\z"
},
{
"type": "suggest",
"message": "Limit line length to 80 characters for improved readability.",
"pattern": "(?m)^.{81,}$"
},
{
"type": "suggest",
"message": "Use camelCase for variable and function names.",
"pattern": "(?<![a-zA-Z0-9])([a-z]+_[a-z]+)(?=[^a-zA-Z0-9])"
},
{
"type": "suggest",
"message": "Use kebab-case for CSS class names.",
"pattern": "\\.([a-z]+_[a-z]+)"
},
{
"type": "suggest",
"message": "Use PascalCase for component names in React.",
"pattern": "(?<=function |class )([a-z][a-zA-Z0-9]*)"
},
{
"type": "suggest",
"message": "Ensure consistent use of semicolons at the end of statements in JavaScript and TypeScript files.",
"pattern": "(?<!;|\\{|\\}|\\[|\\]|\\(|\\)|\\n)\\s*\\n"
},
{
"type": "suggest",
"message": "Use consistent spacing around operators.",
"pattern": "(?<!\\s)([=+\\-*/<>!&|]{1,2})(?!\\s)"
},
{
"type": "suggest",
"message": "Use consistent spacing after commas.",
"pattern": ",(?!\\s)"
}
],
"examples": [
{
"input": "const my_variable = 'value';",
"output": "const myVariable = 'value';"
},
{
"input": "function my_function() {",
"output": "function myFunction() {"
},
{
"input": ".my_class {",
"output": ".my-class {"
},
{
"input": "const sum=a+b;",
"output": "const sum = a + b;"
},
{
"input": "const arr = [1,2,3];",
"output": "const arr = [1, 2, 3];"
}
],
"metadata": {
"priority": "high",
"version": "1.0",
"tags": [
"code-quality",
"best-practices",
"low-code",
"no-code"
]
}
}