zufuliu / notepad4

Notepad4 (Notepad2⨯2, Notepad2++) is a light-weight Scintilla based text editor for Windows with syntax highlighting, code folding, auto-completion and API list for many programming languages and documents, bundled with file browser plugin matepath.
Other
2.56k stars 179 forks source link

Set js/json/css/ts file default indent and tab width to 2 #750

Closed lifenjoiner closed 7 months ago

lifenjoiner commented 7 months ago

Those famous projects prefers 2.

lifenjoiner commented 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.

zufuliu commented 7 months ago

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

lifenjoiner commented 7 months ago

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.

zufuliu commented 7 months ago

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

lifenjoiner commented 7 months ago

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".