0

Trying to fix the error since long , not able to figure it out why I am getting errors due to some prettier/prettier thing which keeps on saying that 'Insert ;' / 'Insert enter' in my react-native project.

Also showing error in App.js ERROR: Line 1:9 : Replace View,.Text with .View, .Text. prettier/prettier

Here is my .eslintrc.js file :

module.exports = {
    root:true,
    extends:'@react-native-community'
}

Here is my prettier.js file :

module.exports = {
    arrowParens:'avoid',
    bracketSameLine:true,
    bracketSpacing:false,
    singleQuote:true,
    trailingComma: 'all',
}

App.js first line

import {View , Text} from 'react-native'

I have installed the need eslint and other packages but it didn't solved.Also I don't have any VScode extensions related to them installed. Any help would be appreciated !

3 Answers 3

0

have you tried to installing prettier - code formatter . and also try to enable format on save How do you format code on save in VS Code

Sign up to request clarification or add additional context in comments.

Comments

0

Got the answer after searching a lot!

Change eslintrc.js a bit as below:

module.exports = { root:true, extends:'@react-native-community' rules:{ 'prettier/prettier':0 } }

That would solve the issue!

Comments

0

Here is my .eslintrc.js file before :

module.exports = {
    root:true,
    extends:'@react-native-community'
}

Here is my .eslintrc.js file After:

 module.exports = {
  root: true,
  extends: '@react-native',
  rules: {
    "prettier/prettier": "off",
  },
  arrowParens:'avoid',
    bracketSameLine:true,
    bracketSpacing:false,
    singleQuote:true,
    trailingComma: 'all',
};

This Works fine!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.