Extended eslint configuration is not behaving as expected #9213
-
| In my CRA (react-scripts v3.4.1) I have extended eslint in my  {
  "eslintConfig": {
    "extends": "react-app",
    "rules": {
      "semi": ["error", "never"],
      "indent": ["error", "tab", { "SwitchCase": 1 }],
      "quotes": ["error", "single"]
    }
  },
}The property in question is  My  Now my editor (VSCode) doesn't complain, but when I run  For reference here is the component containing the block its referencing: const Main = () => {
	const [ profile, setProfile ] = React.useState<any>()
	const [ error, setError ] = React.useState<any>()
	React.useEffect(() => {
		fetch(`/api/profile/${crypto.randomBytes(16).toString('hex')}`)
			.then(res => {
				if (!res.ok) {
					throw Error(res.statusText)
				}
				res.json()
			})
			.then(res => {
				setProfile(res)
			})
			.catch(err => {
				switch (err.message) { // line 29
					case 'Not Found':
						setError('User Not Found')
						break
					default:
						setError(err.message)
				}
			})
	}, [])
	return (
		<main>
			<h2>Profile</h2>
			<pre><code>{JSON.stringify(error || profile, undefined, 2)}</code></pre>
		</main>
	)
}Any ideas what I'm doing wrong? | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
| Of course after I post I manage to fix it... all I did was  | 
Beta Was this translation helpful? Give feedback.
Of course after I post I manage to fix it... all I did was
SHIFT+TABand thenTABover the inner part of the switch statement and it fixed itself. Very strange behavior... maybe caching or something up with TS? I'll leave this open so someone else can comment if they have further ideas or whatever.