My colleague and I are working on same project in different parts of app. But we got certain files which his prettier and my prettier are overwriting each time we push our code to the github. Here is the example of his prettier:
const initialState = {
login: {
testValue1: "hello",
testValue2: "world",
testValue3: true,
testValue4: "SomeValue",
},
} as unknown as { example: InitialState; example1: ExampleState };
Example of my prettier:
const initialState = ({
login: {
testValue1: "hello",
testValue2: "world",
testValue3: true,
testValue4: "SomeValue",
},
} as unknown) as { example: InitialState; example1: ExampleState };
So the difference are brackets which one machine putting there and another one is removing. How can we solve this small issue and have a consistent Prettier?
Forgot to mention that I have .prettierrc
:
{
"printWidth": 100,
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": false
}
Faced the same problem
What i did:
npx prettier --version
to check what version installed in node_modules/
. (in my case versions from package.json and one from node_modules/
were different)
rm -rf node_modules
to delete node_modules folder
yarn
or npm install
Done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With