Closed lifenjoiner closed 7 months ago
js: The engine node.js lib deno runtime The frameworks react bootstrap jquery core is not, but its tutorial examples are.
ts: typescript itself vuejs core angular freeCodeCamp
css: firefox css getting started w3c css tutorial
json: firefox json tutorial
For json, it may vary. When it is webpage/js related, it would keep on the same page. And their derives. Those projects have great influence.
Of course, code styles are personal preferences. But align to the most used styles would be better.
Typescript appears used 4 spaces in it's own sources (also for JSON) https://github.com/microsoft/TypeScript/blob/main/src/tsc/tsc.ts https://github.com/microsoft/TypeScript/blob/main/src/tsc/tsconfig.json
Typescript appears used 4 spaces in it's own sources (also for JSON)
So, like jquery, the core is 4, and its tutorial is 2.
data for some CSS and JS frameworks (2 spaces probably due to VSCode's default configuration): Bootstrap: js 2, css 2 Foundation: js 2, css 2 Pure: css 4 Bulma: css 2 Semantic UI: js 2, css 2 UI Kit: js 4, css 4 Materialize: js 2, css 2 Milligram: css 2 Skeleton: css 2 Tailwind: js 2 Spectre: css 2 Base: css 2 Picnic: css 2
React: js 2 Express: js 2 Next: ts 2 Vue: ts 2 Angular: ts 2 Svelte: ts 2 NestJS: ts 2 NuxtJs: ts 2 Gatsby: ts 2
There is even https://standardjs.com/rules.html saying "Use 2 spaces for indentation". Don't know who those guys are. But they have "Who uses JavaScript Standard Style".
Those famous projects prefers 2.