Move Configs to Project Templates
See original GitHub issueToday, several of the extensions for VS Code write or update various configuration files from the extension. Examples are the jsconfig.json, .eslintrc from LWC, changing values in .vscode/settings.json from the core extension and LWC.
I find this pattern of having the extensions write config files to be jarring and unfamiliar. I canβt think of any other tools that do this. We have also seen problems (https://github.com/forcedotcom/salesforcedx-vscode/issues/1049) from customers when we update these files - specifically for local settings.
Instead of writing configuration files and settings from extensions we should include those files and settings in the project or other templates and the extensions should check for their presence and provide proper warnings when they are not included.
We already have done most of this work with the updated project create template. It now will include the following out of the box:
βββ README.md
βββ .gitignore
βββ .forceignore
βββ .prettierrc
βββ .prettierignore
βββ .vscode
β βββ extensions.json
β βββ settings.json
β βββ launch.json
βββ config
β βββ project-scratch-def.json
βββ force-app
β βββ main
β βββ default
β βββ applications
β βββ aura
β βββ classes
β βββ contentassets
β βββ flexipages
β βββ layouts
β βββ lwc
β β βββ .eslintrc.json
β βββ objects
β βββ permissionsets
β βββ staticresources
β βββ tabs
β βββ triggers
βββ sfdx-project.json
So you will already get most of what you need to have configured in an extension in the default template. If we added a few things such as the jsconfig.json
file then we could eliminate the need for extensions to write files/settings individually.
This does bring up the problem of what happens if the settings/config files change. We have in the past discussed the idea of a CLI command called force:project:update
that would update your project files to the latest version. This is useful for changes to the schema of the sfdx-project.json
or updating/adding config files with new settings.
Additionally, there could be functionality in the command fource:project:update --check
that does a check of your projects version settings. With this command, we could do a single check that your project was in the right state from the core VS Code extension - one place to manage all the configs and settings. We would then prompt people to upgrade their project if needed. This would remove the need for every extension to implement this themselves.
Additionally, we need to put local user configurations in a new place outside of .vscode/settings.json
. That file is meant to be used for project settings, not user settings. If we do have local, extension specific settings we should adopt something like .sfdx/settings.json
that is not checked into source control.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top GitHub Comments
Sorry, I should have been more clear. This issue isnβt actually about having them in the template - it is about removing the behavior of the extension from writing them at all. So the first step was adding them to the template. Now we need to make it so the extension does not write these files at all but rather just checks to make sure they exist and provide so information on how to create them.
Got it, thanks for clarifying π