`new-cap` reporting wrong position for lowercase constructors
See original GitHub issueI 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?
- configuration: eslint-config-xo
- parser: XO
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:
- Created 8 years ago
- Comments:13 (9 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@radiovisual Alright, thanks for the info and for following up 👍
It appears this has been solved, so closing.