CODING_STANDARDS.md 1.4 KB

Coding Standards

1. Variable Naming

Meaningful variable names, file names, folder names. Use abbreviations for words over ten characters. Abbreviations must be over three characters.

  • update-btn (refresh button), device-list, user-profile-settings (profile = abbreviation)
  • btn (too vague), d1 (meaningless), temp (unclear), us (abbreviation too short)

2. Word Separation: Kebab-Case

Use hyphens (-) for multi-word names.

3. Comments: One Block, One Comment, English Only

4. No Try-Catch

Never use try-catch. Let errors crash.

5. GUI File Structure: Separate JSX, JS, SCSS

GUI components must split into three files:

  • .jsx: Layout only (no logic, no styles)
  • .js: Logic only (functions, state, business logic)
  • .scss: Styles only (no logic, no JSX)

Never write logic or inline styles in .jsx files.

6. Code Simplicity: Minimal Code

Use the least code to implement functionality.

7. No Console.log

Do not add any console.log statements in production code.

8. Avoid Creating Script Files

Do not create script files unnecessarily. If you can call PowerShell directly, use PowerShell instead of creating a separate script file.

9. Ask Before Creating New Files

If you need to create any new files, you must ask first.

10. Prefer Switch Statements Over If-Else Chains

Use switch statements instead of multiple if-else chains when checking the same variable against multiple values.