Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  15] [ 2]  / answers: 1 / hits: 25916  / 5 Years ago, wed, november 20, 2019, 12:00:00

Local environment:




  • IDE: vscode

  • Language mode: JavasSript React



import React from 'react';


A syntax error message appears:



Replace `'react'` with `react`eslint(prettier/prettier)


How can I configure it?






in .eslintrc.js



module.exports = {
root: true,
extends: '@react-native-community',
rules: {
quotes: [1, 'single'],
}
};



Thank you for your answer. Rules can be solved



But I want to know where @react-native-community comes from. I didn't see this file.


More From » reactjs

 Answers
11

You can try something like this, it works for me.



package.json



  devDependencies: {
eslint-plugin-prettier: ^3.1.1,
prettier: ^1.18.2
},


.eslintrc



{
extends: react-app,
plugins: [prettier],
rules: {
prettier/prettier: error
}
}


.prettierrc



{
semi: false,
trailingComma: all,
singleQuote: true,
printWidth: 80,
tabWidth: 3
}

[#51459] Tuesday, November 12, 2019, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dequant

Total Points: 88
Total Questions: 99
Total Answers: 95

Location: Ukraine
Member since Sun, Dec 13, 2020
4 Years ago
;