Back to all reviewers

Code example consistency

vitejs/vite
Based on 2 comments
Markdown

Ensure code examples in documentation and comments are syntactically correct and properly marked with the appropriate language identifier. This maintains a professional appearance and prevents readers from copying incorrect code.

Code Style Markdown

Reviewer Prompt

Ensure code examples in documentation and comments are syntactically correct and properly marked with the appropriate language identifier. This maintains a professional appearance and prevents readers from copying incorrect code.

Key guidelines:

  • Match language markers to the syntax used (e.g., use ```ts for TypeScript syntax with generics)
  • Include all necessary syntax elements like commas and semicolons
  • Avoid mixing TypeScript and JavaScript syntax in examples marked as plain JavaScript

Example - INCORRECT:

function myPlugin() {
  const state = new Map<Environment, { count: number }>()
  return {
    name: 'my-plugin',
    buildStart() {
      state.set(this.environment, { count: 0 })
    // Missing comma here!
    transform(code) {
      // ...
    }
  }
}

Example - CORRECT:

function myPlugin() {
  const state = new Map<Environment, { count: number }>()
  return {
    name: 'my-plugin',
    buildStart() {
      state.set(this.environment, { count: 0 })
    }, // Proper comma after function
    transform(code) {
      // ...
    }
  }
}

Or alternatively with plain JS:

function myPlugin() {
  const state = new Map()
  return {
    name: 'my-plugin',
    buildStart() {
      state.set(this.environment, { count: 0 })
    },
    transform(code) {
      // ...
    }
  }
}
2
Comments Analyzed
Markdown
Primary Language
Code Style
Category

Source Discussions