Skip to content

Commit

Permalink
Create STYLE_GUIDELINES.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ajay-dhangar authored Dec 17, 2023
1 parent b2885c5 commit 38d21e1
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions STYLE_GUIDELINES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# JavaScript Mastery Style Guidelines

Welcome to JavaScript Mastery! We appreciate your contributions to the project. To maintain a consistent and readable codebase, please follow these style guidelines when submitting changes.

## JavaScript Style

- Use camelCase for variable and function names (e.g., `myVariable`, `myFunction`).
- Use 2 spaces for indentation.
- Prefer single quotes for string literals.
- Always use `const` or `let` to declare variables. Avoid using `var`.
- Use `===` for equality checks unless `==` is explicitly needed.

```javascript
// Good
const myVariable = 42;

// Bad - using var
var anotherVariable = 'hello';

// Bad - using == instead of ===
if (someValue == 'example') {
// code
}
```

## HTML and CSS Style

- Use 2 spaces for indentation in HTML and CSS.
- Use lowercase for HTML tags and attributes.
- Use meaningful names for classes and IDs in HTML and CSS.
- Prefer Flexbox or Grid layout for positioning elements in CSS.

```html
<!-- Good -->
<div class="container">
<p id="main-paragraph">This is a paragraph.</p>
</div>

<!-- Bad - using uppercase in tags -->
<DIV class="Container">
<P ID="mainParagraph">This is a paragraph.</P>
</DIV>
```

## Git Commit Messages

- Write clear and concise commit messages.
- Use present tense (e.g., "Add feature" instead of "Added feature").
- Keep each commit focused on a single change.

```plaintext
# Good
git commit -m "Add validation for user input"
# Bad - unclear or too broad
git commit -m "Update code"
```

## Pull Requests

- Include a brief description of your changes in the pull request.
- Reference any relevant issues in your pull request.

Thank you for following these guidelines. Your contributions are valuable to the JavaScript Mastery project!

0 comments on commit 38d21e1

Please sign in to comment.