Back to all reviewers

Maintain consistent code style

vuejs/core
Based on 5 comments
TypeScript

Follow project-wide code style conventions to ensure consistency and readability. Key practices include: 1. Use consistent spacing and formatting: - Maintain blank lines between test cases

Code Style TypeScript

Reviewer Prompt

Follow project-wide code style conventions to ensure consistency and readability. Key practices include:

  1. Use consistent spacing and formatting:
    • Maintain blank lines between test cases
    • Proper indentation and line breaks for imports
    • Follow established quote style (single vs double)
  2. Prefer clean control flow:
    • Use early returns instead of nested if/else chains
    • Avoid unnecessary conditional nesting

Example of clean control flow:

// Instead of:
function isCoreComponent(tag: string): symbol | void {
  if (isBuiltInType(tag, 'Teleport')) {
    return TELEPORT
  } else if (isBuiltInType(tag, 'Suspense')) {
    return SUSPENSE
  } else if (isBuiltInType(tag, 'KeepAlive')) {
    return KEEP_ALIVE
  }
}

// Prefer:
function isCoreComponent(tag: string): symbol | void {
  if (isBuiltInType(tag, 'Teleport')) {
    return TELEPORT
  }
  if (isBuiltInType(tag, 'Suspense')) {
    return SUSPENSE
  }
  if (isBuiltInType(tag, 'KeepAlive')) {
    return KEEP_ALIVE
  }
}

Use automated tools like ESLint and Prettier to enforce consistent formatting. When making changes, ensure they align with the existing codebase style rather than introducing new patterns.

5
Comments Analyzed
TypeScript
Primary Language
Code Style
Category

Source Discussions