question-mark
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.

`new-cap` reporting wrong position for lowercase constructors

See original GitHub issue

I seem to be getting some sort of false positive on new-cap. ESLint is complaining about a constructor starting with a lowercase letter at position 6:50:

6:50  error  A constructor name should not start with a lowercase letter  new-cap

…but that position does not have any constructors with lowercase letters:

5 |
6 |     editor.addCommand('mediawrapper', new CKEDITOR.dialogCommand('mediawrapperDialog'));
7 |                                              |
8 |                                              |
9 |                                              Position 6:50 --> no lowercase letters

To see the full source code, see the answers below:

What version of ESLint are you using? 2.3.0

What configuration and parser (Espree, Babel-ESLint, etc.) are you using?

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

I ran ESLint (via XO) on the following code:

var CKEDITOR = {};

CKEDITOR.plugins.add('mediawrapper', {
    icons: 'mediawrapper',
    init: function (editor) {
        editor.addCommand('mediawrapper', new CKEDITOR.dialogCommand('mediawrapperDialog'));
    }
});

What did you expect to happen?

I expected not to see an error on line 6, because there are no constructors starting with a lowercase letter in my code.

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

  6:50  error  A constructor name should not start with a lowercase letter  new-cap

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
kaicataldocommented, Apr 27, 2016

@radiovisual Alright, thanks for the info and for following up 👍

0reactions
nzakascommented, Aug 3, 2016

It appears this has been solved, so closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A constructor name should not start with a lowercase letter ...
Somewhere in your linter config, you've enabled new-cap , and now you're using a constructor that is lowercase. The rule is failing as...
Read more >
require constructor names to begin with a capital letter (new-cap ...
This rule has an object option: "newIsCap": true (default) requires all new operators to be called with uppercase-started functions. "newIsCap": ...
Read more >
Rules - ESLint - Pluggable JavaScript Linter
Some problems reported by this rule are automatically fixable by the --fix command ... new-cap. Require constructor names to begin with a capital...
Read more >
Airbnb JavaScript Style Guide()
They allow you to define all the properties of an object in one place. function getKey(k) { return `a key named ${k}`; }...
Read more >
sui-pre-commit-rules - npm
To avoid useless empty declarations in your code, this rule reports when you ... Bad: Hexadecimal color values must be 6 digits long,...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found