Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[0.7.7.0] .prettierrc.js options not working anymore #49110

Open
flixyudh opened this issue Feb 1, 2025 · 0 comments
Open

[0.7.7.0] .prettierrc.js options not working anymore #49110

flixyudh opened this issue Feb 1, 2025 · 0 comments

Comments

@flixyudh
Copy link

flixyudh commented Feb 1, 2025

Description

I've a default config for prettier, and I want to show an eslint error if the code is not following prettier config. but I notice that .prettierrc.js is not working. is it expected behavior or does the .prettierrc.js is not needed anymore?

Steps to reproduce

  1. init project npx @react-native-community/cli@latest init prettierError
  2. add the following config into .prettierrc.js
module.exports = {
  arrowParens: 'avoid',
  bracketSameLine: true,
  bracketSpacing: false,
  singleQuote: true,
  jsxSingleQuote: true, // <<< new option
  singleAttributePerLine: true, // <<< new option
  trailingComma: 'all',
};
  1. copy this code into App.tsx
import React from 'react';
import {View, useWindowDimensions, Text, SafeAreaView} from 'react-native';

const App = props => {
  const {width, height} = useWindowDimensions();
  const a = "WAKWAW"

  React.useEffect(() => {}, []);

  return (
    <SafeAreaView style={{flex: 1}} id="wakwaw">
      <Text>App</Text>
    </SafeAreaView>
  );
};

App.displayName = 'App';

export default App;
  1. run npx prettier App.tsx --config-precedence=file-override --check --loglevel=debug (add --write argument to run the formatter)

React Native Version

0.77.0

Affected Platforms

Other (please specify)

Output of npx react-native info

failed running `npx react-native info` using `Template Reproducer`


> npx react-native info

⚠️ react-native depends on @react-native-community/cli for cli commands. To fix update your package.json to include:


  "devDependencies": {
    "@react-native-community/cli": "latest",
  }

Stacktrace or Logs

VSCode

Reproducer

https://github.com/flixyudh/prettierError

Screenshots and Videos

No response

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant