User Tools

Site Tools


computer.setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
computer.setup [2022/05/18 13:48] admincomputer.setup [2025/11/04 10:39] (current) – [Tools and Environments] ig_mb
Line 30: Line 30:
 ==== Tools and Environments ==== ==== Tools and Environments ====
  
 +=== Prettier ===
 +
 +Prettier is an opinionated code formatter. You can install it for vscode from the marketplace from https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode. 
 +Not all projects are setup to use prettier. Make sure to configure your vscode to only enable prettier if it is able to find a configuration file.
 +
 +{{:vscode-settings-prettier-require-config.png?400|}}
 +
 +You can setup a project to use prettier by creating a .prettierrc file with the following content:
 +
 +  {
 + "tabWidth": 4,
 + "useTabs": true,
 + "printWidth": 200,
 + "trailingComma": "all",
 + "singleQuote": false,
 + "bracketSpacing": true,
 + "semi": true,
 + "overrides": [
 + {
 + "files": "package.json",
 + "options": {
 + "useTabs": false,
 + "tabWidth": 2
 + }
 + }
 + ]
 +  }
 +
 +You can format many files with prettier by executing the following command:
 +
 +  npx prettier --write "**/*.{file extension (json or ts)}"
 +  
 +
 +F.e. in order to format all json and typescript files in all folders underneath the current directory you would use 
 +
 +  npx prettier --write "**/*.json" "**/*.ts"
 +
 +You can exclude files from being formatted by creating a .prettierignore file. This file uses the same syntax as .gitignore.
 +
 +In order to prevent prettier from formatting info.json files for geometries, you could create a .prettierignore with the following content: 
 +
 +''%%**/Geometries/**/info.json%%''
 ==== Source and files repositories aka GIT ==== ==== Source and files repositories aka GIT ====
  
computer.setup.1652874534.txt.gz · Last modified: 2024/04/04 08:04 (external edit)