With the code
import Sentence from './Sentence' const sentenceComponent = Sentence(sentenceSources)
where sentence is a function
And this is my package.json
"xo": {
"esnext": true,
"semicolon": false,
"space": 2,
"envs": [
"browser",
"node"
],
"rules": {
"new-cap": 0,
"comma-dangle": [2, "only-multiline"]
}
}
I always get this error for 'Sentance' in VS Code. I am exiting and restarting code every time I change package.json
A function with a name starting with an uppercase letter should only be used as a constructor. (babel/new-cap)
(alias) Sentence(sources: any): {
DOM: any;
}
import Sentence
I have tried variations of the rule like.
'new-cap': [0, {newIsCap: true, capIsNew: true}],
'new-cap': [2, {newIsCap: false, capIsNew: false}],
Try setting "babel/new-cap" rule, instead of "new-cap".
"rules": {
"babel/new-cap": 0
}
result!
Thanks. I did wonder what the babel prefix was for but could not find such rules in the ESLinit web site.
Reopening so I don't forget to better document this. It's a side-effect of using babel-eslint.
As a comment I occasionally got 2 errors at same time, one with babel/ and one without.
Also in VC Code I often had to switch back to a file several timer before the errors showed. Might be a bug or might be me.
babel-eslint is removed in master. Will do a release in the next few days.