So this is my index.tsx: and this is my eslintrc.js: i have tried to install babel-eslint, and add it like a parser? but it didin`t help so here`s the question, how to solve the problem “error Parsing error: Unexpected token !”? Answer Set typescript-eslint as your parser by adding “parser&#…
Tag: eslint
Javascript match for eslint
I am using match like this: text.match(v = /(d+.d+.d+.d+)/g). But When es-lint run it shows an error that v is not defined I tried this: text.match(‘v = /(d+.d+.d+.d+)/g’) But now match is not working. Answer It looks like you’re trying to do this: but inline. You generally should not be ass…
Numeric value in front of type/Object’s parameter name
I feel so dumb right now, but… I am facing an issue where I am trying to fetch data from API but the api has JSON object parameters with numeric values in front of them. Something like {1stxxxx: ‘value’, 2ndxxx: ‘value’} But that gives me error in eslint: An identifier or keyword…
Is it possible to remove unused imports with Prettier?
I have an Expo React Native app that has a ton of unused imports in components. I have Prettier setup for code formatting, is it possible to configure Prettier to also remove any unused imports across the project? I can’t see anything in the docs and I don’t know if there is a way to add extra esl…
ESLint: how to sort import members with eslint-plugin-import?
I’m trying to add the sorting of import members such as this rule in sort-member. However, since I’m already using eslint-plugin-import, there is a conflict because each of these rules is trying to sort imports based on different parameters: sort-member sorts following the order [“none”…
Is eslint pre-commit hook in CRA bootstrapped application required?
My react application is bootstrapped using CRA(react-scripts v4.0.0) and I want to add a code formatter (prettier to be specific) that must format the code before committing the changes to my git repo. I know that eslint is a dependency of react-scripts and linting is done using ‘eslint-webpack-plugin'(…
ESLint “no-implicit-globals” rule is being ignored
I’m working with some old Sencha Touch code, written in old-style JavaScript, that I’m trying to clean up. It’s too easy with this code to simply misspell a variable and not see the error, because nothing is being flagged as global or undefined. I’m trying to use ESLint to address this…
Getting warning in ‘eslint-plugin-react-settings’ while running eslint
Getting the: warning: React version specified in eslint-plugin-react-settings must be a valid semver version, or “detect”; got “latest”’ while running eslint. What is the reason behind this and how to resolve it? Screenshot of the issue Answer There will be an Object defined in your .eslintr…
React Hook is called in function that is neither a React function component nor a custom React Hook function
I have this following ESLint warning : React Hook “useBuilderFeatureFlagContext” is called in function “Slide.RenderBuilder” that is neither a React function component nor a custom React Hook function. and this is the following component : How do I write a rule that can whitelist this …
Eslint throwing “Parsing error: Unexpected token” while using TypeScript
I installed @types/greensock and started using gsap with TypeScript. Everything works fine, but the ScrollTo plugin is giving this eslint error (image attached). Someone knows something about it? Here is the eslint error: Here is my .eslintrc: Here is my code: Answer I have been told in the GreenSock forum th…