I have react-native code. I install ESLint. I use it but its show error. While I use single quotes it show me error Replace ‘react-native’ with “react-native” eslint(prettier/prettier) And when I use double qoutes it show me another error String must use singlequote. eslint(quotes) here is the screenshot: What i want is, how to remove error messages about using single
Tag: eslint
Eslint: how to handle no-use-before-define for dependent functions?
I have 2 dependent functions that call each others, so one or the other has to be declared first which fires an eslint no-use-before-define error. I know I can disable the rule but is there any better way do do this? Simplified example: I can’t merge a and b as they both need to be called separately somewhere else in
How to avoid the ‘no-param-reassign’ rule with a input’s handleChange?
I’m working to build a React Textarea that auto grows/shrinks as the user types. I’ve built my component inspired by this codepen: https://codepen.io/Libor_G/pen/eyzwOx While I have this working nicely, I’m getting an es-lint error I’m unsure how to correctly resolve. eslint is not liking that I’m using the event param in the handleChange function. What is the right way to
Eslint glob (**) is not considering all directories recursively
I am using OSX, in my package.json file I have the script entry: “lint”: “eslint ./src/**/*.js” However, when I run npm lint only the 1st level of directories are being considered for linting, eg. ./src/dir/* not ./src/dir/nested_dir/*. I was under the impression that ** glob indicated recursive search? Does anyone know how I can make this behave as expected? Answer
Cannot fix eslint rule on indenting case statements in switch statement
Here is a screenshot of my sublime text window showing the eslint error being thrown for the switch / case statement. I want to have to indent 4 spaces, as the code shows. and here are 4 different attempts to try to allow for an indent of 4 spaces, via modifications in the .eslintrc file in my react app. I
How to add a keyboard listener to my onClick handler?
I have the following: My CSS: I need this because I need the textarea’s placeholder are to be horizontally and vertically centered in the page. Given textareas can’t vertically center text, I need to keep the height of the textarea short. I therefore need to make it so when the user clicks outside of the textarea, thinking they are clicking
Build error while compiling create-react-app
I am new to Reactjs and am started learning it. I have been trying to start a basic hello world program but its failing at compilation level. Created a start up hello-word program with create-react-app hello-world it gave me a nice folder structure with bunch of files. And Here you can see the compilation error Here the error states cannot
How can I use ESLint no-unused-vars for a block of code?
I need to disable some variable checks in ESLint. Currently, I am using this code, but am not getting the desired result: Two questions: Is there a variant which can enable no-unused-vars for a block of code? Something like… Or could I make Hey a global variable so that it can be ignored everywhere? Answer To disable the @typescript-eslint/no-unused-vars warning:
How to remove ESlint error no-unresolved from importing ‘react’
no-unresolved https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md After installing eslint-import-resolver-webpack My .eslintrc config My package.json Webpack Answer You can add an option to ignore case: This thread at github also describes how the linter was checking case for parts of the path which come before the folder containing package.json. If you for example have the path: C:/Workspace/app and you navigate to it using cd C:/workspace/app
How to configure eslint indent for WebStorm?
How to set “indent” in .eslintr.json to match the default used in WebStorm? Everything I’ve tried so far, as per the official documentation can’t match it: “indent”: [“error”, 2] – gives many Expected indentation of 2 spaces but found 4 “indent”: [“error”, 4] – gives many Expected indentation of 4 spaces but found 8 “indent”: [“error”, 8] – gives many