Auto Prefix Command
The autoPrefix command updates VSCode settings to enable automatic formatting with Prettier.
🛠 Installation
To run this command, follow these steps:
npm install @in-ch/setup -g
🚀 Usage
To apply automatic formatting settings in VSCode, run:
ics autoPrefix
What It Does
-
Checks for updates before applying changes.
-
Ensures the Prettier extension is installed in VSCode.
-
Updates
settings.json
with the appropriate formatting configurations. -
Ensures settings are correctly merged without overwriting existing configurations.
VSCode Settings Applied
This command modifies the following settings in settings.json
:
{
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
}
Example Output
Checking for updates...
Updating VSCode settings...
Ensuring Prettier extension is installed...
VSCode settings.json updated successfully!
🔖 Advanced Usage
If you need to manually update VSCode settings, you can locate settings.json here:
-
Windows:
%APPDATA%/Code/User/settings.json
-
Mac:
~/Library/Application Support/Code/User/settings.json
-
Linux:
~/.config/Code/User/settings.json
❓ Troubleshooting
-
Command Not Found? Ensure @in-ch/setup is installed globally using
npm list -g --depth=0
. -
Permission Errors? Try running the command with sudo (Mac/Linux) or in an admin shell (Windows).
-
Config Not Applying? Double-check that the necessary files were generated and referenced in your project.