Reputation: 1857
I have two problems:
1) i can not push to our team repo since I have warrnings in my code and eslint react when I try to push.
2) That i actally get these warrnings in my local enviorment which noone else in the team does.
The thing is that I am the only one in the team that is getting the erros when trying to push.
What I have done:
installed a older version of eslint (5.16.0) -- nothing changed.
Tried to modify the warrnings in code:
a warrning regarding code that is not used:
const App: React.FC = () => {
{
const [view, setView] = useState('SignUp') // error here saying view is declared but not used.
/*
const VIEW_STATES: {[key: string]: string} = {
SignUp: <SignUp />,
Success: <SuccessView />,
Error: <ErrorView />,
}
*/
return (
<>
<Header />
<main className="opt-main opt--bg-sm">
<div className="-container">
<div className="-row">
<div className="-offset-sm-2 -col-sm-8 -offset-md-3 -col-md-6">
<div className="opt--container">
<SignUp />
</div>
</div>
</div>
</div>
</main>
<Footer />
</>
)
}
}
When removing the above unused code then I get:
"Nested block is redundant"...
Again this is only happening on my pc. Colleagues do not have that problem and Im stuck right now and can not push my changes.
also tried:
{
"extends": "react-app",
"rules": {
"Handling warnings": {
"quiet": true,
"max-warnings": -10
}
}
}
What can I do?
Upvotes: 0
Views: 199
Reputation: 1857
After a few hours on this and after posting a noticed that someone had installed husky in our enviorment.
Since eslint was showing the error i thought it was the problem.
Uninstalled husky and all the problems vent with it.
Would remove the question if could since it is missleading in this case. Hopefully someone might stubble upon this.
Upvotes: 0
Reputation: 13256
view is declared but not used
That seems to be true: you should either use it, or remove it, that's the right way to go. You did mentioned you tried that, and then hit:
"Nested block is redundant"
This is due to an extra outer pair of { }
braces. The end of your first line contains a () => {
, but then the next line also starts with {
, unnecessarily. Remove the extra {
and final }
, and it should work ok.
Upvotes: 2
Reputation: 15851
You can disable eslint rules on a single line with the following comment:
const mycode = {..} // eslint-disble line
Upvotes: 0