Skip to content
tai-kun's Vite+ Lint Plugins
Esc
↑↓navigate↵open⌘Jpreview
On this page

spaced-comment

Require whitespace after the comment marker and before the closing marker.

  • Rule ID: tai-kun/spaced-comment
  • Auto-fix: Yes

Reports comments without whitespace after // or /*, or before */. Comments that intentionally omit the space, such as directives and license banners, are exempt.

Configuration

Add the rule to lint.rules in vite.config.ts to enable it.

"tai-kun/spaced-comment": "error",

Examples

Invalid

//comment
/*comment*/

Valid

// comment
/* comment */

Notes

  • Comments starting with ///, //!, //#, //@, or /*! are exempt.
  • Annotations starting with /*# (e.g. /*#__PURE__*/) are exempt.
  • Decorative comments made only of punctuation, such as //----, are exempt.
  • JSDoc comments like /**comment*/ are also checked.

Was this page helpful?