ALWAYS USER FIRST!
Assign tasks on Trello, push code to GitLab, etc. Write to me about the branch merge flow as follows: feature -> dev -> test code thoroughly -> main.
-
Use TypeScript: All code must be written in TypeScript to leverage static typing and additional TypeScript features.
-
Interfaces and Inheritance: Utilize interfaces for type checking. Extend and inherit data types using
extends
and[]
. -
Type or Non-value Data Types: Employ
Type
for arrays that contain only primitive data. -
File Extensions: Components must use the
.tsx
extension, while other files must use.ts
for runtime files. Do not use.js
. -
Use Complex Data Types: Favor the use of complex data types such as objects, arrays, classes, functions over primitive data.
-
Type Declarations: All functions and props must specify the complete input type and the type of output data.
-
Code Comments: Include clear code comments. Utilize JSDoc for documenting classes, functions, etc.
-
API Reuse: APIs that are reused frequently, like httpClient, Redis, must be well documented and readily accessible.
-
Error Handling: Avoid ignoring errors, warnings, and the use of
any
/unknown
types. Handle them appropriately to maintain code quality and stability. -
Unused Variables: Remove any unused variables, states, and console.log statements.
-
Code Reuse: Enforce the separation of functions when the same code is reused twice within the same function.
-
Transformers: Employ clear transformers that are synchronized with the backend, have a clear structure, and are synchronized with the frontend.
-
Limit Redundant Code: Minimize the use of redundant if/else statements. Opt for more efficient control structures when possible.
-
Folder Structure: Organize code into logical folders such as helpers, utils, services, components. Child components that are used only in one screen should have their own folder.
-
Function-less Code: Aim for code with fewer functions. Apply functional programming principles wherever applicable.
-
API Calls: Avoid direct backend API calls. Always make calls through a common function for ease of processing.
-
Code Formatting: Code should be formatted with an indentation of 2 spaces. Strings must use single quotes.
-
Self-Testing: Conduct self-testing first, complete the feature, document it thoroughly, and then proceed to push.
-
Documentation: A
docs
folder is required to comprehensively document new feature functionalities. -
Commit Messages: Commit messages should follow the format "Action: Description", e.g., "fixed bug: dog is not defined in house".
-
Language: All requirements, assigned tasks, and documentation should be in English.
{
"singleQuote": true,
"tabWidth": 2
}
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"next/core-web-vitals",
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {}
}