Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable eslint(prettier/prettier) single quotes error

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:

screenshot

What i want is, how to remove error messages about using single quotes? I prefer using single quotes instead double quotes.

like image 780
alfianrehanusa Avatar asked Aug 04 '19 03:08

alfianrehanusa


People also ask

How do I turn off ESLint quotes?

To completely disable the quotes rule, set it to either 0 or off in your eslint configuration file (see the different configuration formats here). Example for disabling in json configuration file: { "rules": { "quotes": "off", ... } }

What is ESLint config Prettier?

Turns off all rules that are unnecessary or might conflict with [Prettier]. This lets you use your favorite shareable config without letting its stylistic choices get in the way when using Prettier.

How do I turn off rules in ESLint JSON?

1) Disabling "All rules" Two ways you can do this: Put /* eslint-disable-line */ at the end of the line(s), or /* eslint-disable-next-line */ right before the line.


2 Answers

In addition to @Barmar answer, you could also use prettier configuration on a .eslintrc.js file using the following, property:

rules: {
    // ...
    'prettier/prettier': ['error', { singleQuote: true }]
  }
like image 155
albertTaberner Avatar answered Sep 21 '22 09:09

albertTaberner


In your ESLint configuration you want:

quotes: [2, "single"]

In you Pretty configuration you want:

single-quote: true

You should also be consistent in your use of quotes, so you should use single quotes in the second import line:

import App from './App';
like image 28
Barmar Avatar answered Sep 17 '22 09:09

Barmar