mcu-debug / rtos-views

RTOS views for microcontrollers
MIT License
24 stars 11 forks source link

Project format settings #10

Closed PhilippHaefele closed 1 year ago

PhilippHaefele commented 1 year ago

If i currently save a file it's formatted as intended via the settings.

But it seems that the settings that are used at my place are not used @haneefdm place.

I did find following issues so far:

I created https://github.com/mcu-debug/rtos-views/pull/9 for the first 3 points

haneefdm commented 1 year ago

railing commas are added => seems to be ok, but do we want them?

Where do you see this? So, the default is 'es5' it appears. I don't want trailing commas, so I added this. Will that suffice?

"prettier.trailingComma": "none",

inner parentheses are removed in if statements (and dome other places) => i really like to add the inner parentheses for better readability when there is more than 1 condition part inside

This has been annoying me. This seems to be an open issue with prettierl

https://github.com/prettier/prettier/issues/187 https://github.com/prettier/prettier/issues/3805

And, I am never sure it did it right.

haneefdm commented 1 year ago

I found this. Not sure this is exactly what we want.

https://github.com/kevin940726/eslint-plugin-no-mixed-operators

akhba01 commented 1 year ago

can someone help me I write js code like this : ((HourNow / 12) 360) + ((minuteNow / 60) 360) + 90 but after I saved and prettier formatted it to: (HourNow / 12) 360 + (minuteNow / 60) 360 + 90;

PhilippHaefele commented 1 year ago

I need to check this tomorrow, but it seems that we can use eslint for formatting only. See https://daveceddia.com/vscode-use-eslintrc/

We could get rid of prettier then and most likely the eslint plugin from above will work also.

@haneefdm What do you think about this approach?

PhilippHaefele commented 1 year ago

can someone help me

I write js code like this :

((HourNow / 12) 360) + ((minuteNow / 60) 360) + 90

but after I saved and prettier formatted it to:

(HourNow / 12) 360 + (minuteNow / 60) 360 + 90;

I don't think there's a real fix to this. You can only tell prettier to not format some code by adding a // prettier-ignore comment

haneefdm commented 1 year ago

For now, use temp. variables for each major sub-expression.

haneefdm commented 1 year ago

I am closing this for now.