What’s the difference between prettier-eslint, eslint-plugin-prettier and eslint-config-prettier?

tl;dr: Use eslint-config-prettier, you can ignore the rest. ESLint contains many rules and those that are formatting-related might conflict with Prettier, such as arrow-parens, space-before-function-paren, etc. Hence using them together will cause some issues. The following tools have been created to use ESLint and Prettier together. prettier-eslint eslint-plugin-prettier eslint-config-prettier What it is A JavaScript module … Read more

Unnecessary curly braces in C++

It’s sometimes nice since it gives you a new scope, where you can more “cleanly” declare new (automatic) variables. In C++ this is maybe not so important since you can introduce new variables anywhere, but perhaps the habit is from C, where you could not do this until C99. 🙂 Since C++ has destructors, it … Read more

What is the proper way to format a multi-line dict in Python?

I use #3. Same for long lists, tuples, etc. It doesn’t require adding any extra spaces beyond the indentations. As always, be consistent. mydict = { “key1”: 1, “key2”: 2, “key3”: 3, } mylist = [ (1, ‘hello’), (2, ‘world’), ] nested = { a: [ (1, ‘a’), (2, ‘b’), ], b: [ (3, ‘c’), … Read more