Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pull request] Code specification #544

Closed
unitwk opened this issue Feb 4, 2022 · 0 comments
Closed

[Pull request] Code specification #544

unitwk opened this issue Feb 4, 2022 · 0 comments
Labels

Comments

@unitwk
Copy link
Member

unitwk commented Feb 4, 2022

Why do you need this?

The code of open source projects usually exists for several years or even more than ten years. Due to the different habits of each developer, the combined code style is also different, so we need to have certain constraints to make the code live in a long-term and healthy manner.


When is this not needed?

If your Pull Request affects code within 40 lines, then you don't need to bother, **no need to format the plugin according to the code, just program it in your own style.

But variable names must be in camel case.


Naming conventions

TypeScript/JavaScript code variable names must be in camel case. Such as: user instanceUuid requestData

All http request parameters must be separated by underscores, with some exceptions that already exist. Such as user_id instance_uuid


Code style

Using Prettier Formatting Plugin

For development, please use VSCode for development, and must install the Prettier code formatting tool.

In the project root directory, there are already defined .prettierrc.json formatting standard files for constraints, and VSCode will automatically unify the code style.

If it doesn't work after installation, you may also need the Use...Format Document button in the right-click menu to select Prettier as the default formatting tool.

Other options

If you think it is very complicated, then please do not format any unmodified code. For example, if you modify 20 lines of code, but accidentally format 200 lines of code automatically, such PR will not be accepted.


Git Commit Information Scheme

This regulation is not mandatory, only recommended

• feat: indicates a commit to add a new feature
• fix: Indicates a commit to fix a bug
• build: Indicates that the commit modifies the build system or external dependencies
• ci: Indicates that the commit modifies a continuous build, continuous deployment configuration or script
• docs: Indicates that the commit modifies the documentation
• perf: Indicates that the commit was optimized for performance
• refactor: indicates that the commit was refactored
• style: Indicates that the submission has modified the code format problem
• test: Indicates that the commit adds or modifies the test case
• revert: roll back to the previous version
• chore: changes to the build process or auxiliary tools
• res: Indicates art resources, usually suitable for mobile terminals (our company's custom classification)

Avoid submitting Package.json files

Around the version of Node 16, the package-lock.json file of the current version will be automatically upgraded and updated, and there will probably be nearly hundreds of lines of JSON code changed. Please reject or restore the code when submitting the code. Revise.

Please do not commit any changes to the package.json package-lock.json files unless you have installed/upgraded new dependencies.


@unitwk unitwk pinned this issue Feb 4, 2022
@unitwk unitwk added the Notice label Feb 4, 2022
@MCSManager MCSManager locked and limited conversation to collaborators Feb 4, 2022
@unitwk unitwk unpinned this issue May 19, 2022
@unitwk unitwk closed this as completed Sep 1, 2022
@unitwk unitwk changed the title [Pull request] 代码开发规范 [Pull request] Code specification Nov 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant