Skip to content

@kazupon/prefer-inline-code-words-comments

enforce the use of inline code for specific words on comments

  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

Rule Details

This rule enforces that specific words or phrases are always wrapped in inline code (backticks) when they appear in Comments. This is useful for:

  • Ensuring technical terms, API names, or function names are consistently formatted as code
  • Maintaining consistent styling for programming-related terminology
  • Automatically applying code formatting to specified words

Fail

Some examples of incorrect code for this rule:

Pass

Some examples of correct code for this rule:

🔧 Options

This rule requires configuration of the words that should be wrapped in inline code.

json
{
  "@kazupon/prefer-inline-code-words-comments": [
    "error",
    {
      "words": ["console.log", "fetch"]
    }
  ]
}
  • words (required):
    • Strings representing the words that should always be wrapped in inline code when they appear in comments.

Nothing.

Version

This rule was introduced in @kazupon/eslint-plugin v0.6.0

Implementation