Skip to content

Tag: eslint

Disallow implicit accessing of window properties

I’m looking for an ESLint rule that disallows usage like location and only allows window.location. I’ve combed through the rules, but didn’t find one, does anyone know? Answer The no-restricted-globals rule will help you with this. Add this to your .eslintrc file So in the above example esli…

How to Extend Eslint to work with create-react-app

I’m working on a React application and I would like to have a linter set up so that I can see all the warning/errors in the console. The docs doesn’t say much: https://create-react-app.dev/docs/setting-up-your-editor/ I have added EXTEND_ESLINT=true in my .env.dev file and I have created a .eslint…

Why eslint throw that error, and how can I get rid of it?

I wrote a function to return sessionStorage data and eslint throw error correlated with the return statement in an arrow function Expected to return a value at the end of arrow function consistent-return Answer This is pretty simple, ESLint is telling you that the functions might exit without returning, in yo…

disable linting inside comments

I want eslint to stop linting inside comments // and /* */. when in comments I want to have freedom to write as I please. (disable 80 char limitation etc..) that’s pretty basic in my opinion and yet I can’t find it anywhere, is there a predefined rule to do that? Thanks Answer Sure, to disable lin…