Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

capitalized-comments conflicts with default-case ("// no default")

See original GitHub issue

Tell us about your environment

  • ESLint Version: 3.11.1
  • Node Version: 7.2.0
  • npm Version: 4.0.2

What parser (default, Babel-ESLint, etc.) are you using? babel

Please show your full configuration:

module.exports = {
  rules: {
    'capitalized-comments': 1,
    'default-case': 1,

What did you do? Please include the actual source code causing the issue.

The following code snippet triggers the capitalized-comments rule violation for the "no default" comment. Fixing it by using "No default" instead, the rule default-case is triggered because "No default" is not recognised as a valid marker of intentionally not providing a default case.

switch (item) {
  case 'this':
    return 1
  case 'that':
    return 2
  // no default

What did you expect to happen?

I expected that using "No default" would not trigger the default-case rule violation.

What actually happened? Please include the actual, raw output from ESLint.

The default-case rule violation was triggered because it does not recognise "No default" as a valid “I intentionally omitted default case here” marker.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:23 (23 by maintainers)

github_iconTop GitHub Comments

not-an-aardvarkcommented, Dec 6, 2016

Let’s go ahead and implement the original proposal (to just make “// no default” case-insensitive), and then maybe we can reconsider making all regexes case-insensitive later.

platinumazurecommented, Nov 29, 2016

(EDIT 2016-11-29T19:17:00Z: Proposal now favors allowing full case insensitivity for default pattern only. No changes will be proposed for custom commentPatterns.)

Here’s a proposal (and I’ll champion this).

What rule do you want to change?


Does this change cause the rule to produce more or fewer warnings?


How will the change be implemented? (New option, new default behavior, etc.)?

New default behavior: Make the “no default” default comment pattern case-insensitive in the default-case rule.

Please provide some example code that this change will affect:

// Example 1
switch (foo) {
    case 1:
    // No default

// Example 2 (current tolerated comment)
switch (foo) {
    case 1:
    // no default

// Example 3 (variant capitalization)
switch (foo) {
    case 1:
    // NO Default

What does the rule currently do for this code?

Example 1: Warns on the // No default comment Example 2: Does not warn on the // no default comment Example 3: Warns on the // NO Default comment

What will the rule do after it’s changed?

Example 1: No longer warn on // No default Example 2: Continue to not warn on // no default Example 3: No longer warn on // NO Default comment

Read more comments on GitHub >

github_iconTop Results From Across the Web

capitalized-comments - ESLint - Pluggable JavaScript Linter
This rule will not issue warnings when non-cased letters are used. By default, this rule will require a non-lowercase letter at the beginning...
Read more >
Should .net comments start with a capital letter and end with a ...
Arguably, one does not need a comment at all, but since one is provided, I would think that the second one is better....
Read more >
Robot Framework User Guide
The default values for test setup and teardown. Test Template: The default template keyword to use. Test Timeout: The default value for test...
Read more >
Git case sensitivity - Azure Repos - Microsoft Learn
The Windows and macOS file systems are case-insensitive (but case-preserving) by default. Most Linux filesystems are case-sensitive.
Read more >
PEP 8 – Style Guide for Python Code
This PEP takes no explicit position on how (or whether) to further ... The default wrapping in most tools disrupts the visual structure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found