feat:Adding prettier as a dev dependency and formatting the whole code#59
feat:Adding prettier as a dev dependency and formatting the whole code#59abhishekkumar08 wants to merge 1 commit intoreact-native-elements:masterfrom
Conversation
|
Deploy preview for rne-playground ready! Built with commit 724040f |
| Example: | ||
|
|
||
| **Snack** : https://snack.expo.io/xxx | ||
|
|
||
| - Steps | ||
|
|
||
| 1. Go to '...' |
There was a problem hiding this comment.
Please try making some change, adding spaces doesn't help
|
|
||
| ```sh | ||
| npm i | ||
| ``` | ||
|
|
||
| 3. Run the development server | ||
|
|
||
| ```sh |
There was a problem hiding this comment.
only spaces are added to the file?
| "postinstall": "patch-package", | ||
| "format": "prettier --write \"**/*.{js,jsx,json,md}\"" |
There was a problem hiding this comment.
please avoid changing the packages.... (can cause merge conflict for others PR's)
| "type": "image/png", | ||
| "sizes": "512x512" | ||
| } | ||
| } |
| import { | ||
| SafeAreaInsetsContext, | ||
| SafeAreaProvider, | ||
| } from "react-native-safe-area-context"; | ||
|
|
||
| import Root from "./containers"; | ||
| import "./App.css"; |
There was a problem hiding this comment.
This doesn't make any sense. only spaces have been added all over the place.
| import React from 'react'; | ||
| import ReactDOM from 'react-dom'; | ||
| import App from './App'; | ||
| import React from "react"; | ||
| import ReactDOM from "react-dom"; | ||
| import App from "./App"; | ||
|
|
||
| it('renders without crashing', () => { | ||
| const div = document.createElement('div'); |
There was a problem hiding this comment.
replacements " " to ' ' and vice-a-versa.
| import React from "react"; | ||
| import ReactDOM from "react-dom"; | ||
| import "./index.css"; | ||
| import App from "./App"; | ||
| import * as serviceWorker from "./serviceWorker"; | ||
| import "react-native-safe-area-context"; | ||
|
|
||
| ReactDOM.render(<App />, document.getElementById('root')); | ||
| ReactDOM.render(<App />, document.getElementById("root")); | ||
|
|
There was a problem hiding this comment.
This change will create conflict for other PR's
| .catch((error) => { | ||
| console.error("Error during service worker registration:", error); | ||
| }); | ||
| } | ||
|
|
||
| function checkValidServiceWorker(swUrl, config) { | ||
| // Check if the service worker can be found. If it can't reload the page. | ||
| fetch(swUrl) | ||
| .then(response => { | ||
| .then((response) => { | ||
| // Ensure service worker exists, and that we really are getting a JS file. | ||
| const contentType = response.headers.get('content-type'); | ||
| const contentType = response.headers.get("content-type"); | ||
| if ( | ||
| response.status === 404 || | ||
| (contentType != null && contentType.indexOf('javascript') === -1) | ||
| (contentType != null && contentType.indexOf("javascript") === -1) | ||
| ) { | ||
| // No service worker found. Probably a different app. Reload the page. | ||
| navigator.serviceWorker.ready.then(registration => { | ||
| navigator.serviceWorker.ready.then((registration) => { | ||
| registration.unregister().then(() => { | ||
| window.location.reload(); | ||
| }); |
There was a problem hiding this comment.
replacements " " to ' ' and vice-a-versa.
| "No internet connection found. App is running in offline mode." | ||
| ); | ||
| }); | ||
| } | ||
|
|
||
| export function unregister() { | ||
| if ('serviceWorker' in navigator) { | ||
| navigator.serviceWorker.ready.then(registration => { | ||
| if ("serviceWorker" in navigator) { | ||
| navigator.serviceWorker.ready.then((registration) => { |
There was a problem hiding this comment.
replacements " " to ' ' and vice-a-versa.
|
@abhishekkumar08, please have a look at ...... |
If you try to understand the PR, it adds prettier to the code base which is a code formatter, I just installed it as a dev dependency and ran the command for it to format the whole code base. Thanks for the review. @Uyadav207 |
|
@abhishekkumar08, ok if it's prettier also... the changes made are quite huge and this will create
I hope you understand? 😊 |
|
@Uyadav207 Yeah bro I got your point 😄 . Thanks for the suggestion, any other way how should I do this change? |
There was a problem hiding this comment.
but issue #56 #57 and pr made on these are almost the same adding prettier as a dev dependency is not a good idea. we need to run npm run format every time before we make a pr?
in #56 we are adding a file... which will automatically format the code in vs code if the prettier
the extension is installed.
just keep an eye on the repo if any pr is merged in this repo make sure you update your repo and format its code again |
Exactly. |
This is a breaking change. Need to wait for all PR to get merge than if we push your change.... Then it would not cause any conflict... but syncing the fork then would be necessary for all contributors... Is this making any sense ? |
|
@abhishekkumar08 already created an issue and made a PR about the same thing earlier than you. Kindly work on some other issues. |
@Uyadav207 Initially it may seem a conflicting change but it will be beneficial in long go as developers contributing to the project will be following same styling. |
yes it will help a lot . |
Fixes:#58