PowerShell / PowerShell/vscode-powershell
Have PowerShell formatter remove trailing whitespace when formatting a file
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 547
- PR merge metrics
- No merged PRs in 30d
Description
Prerequisites
- I have written a descriptive issue title.
- I have searched all issues to ensure it has not already been reported.
Summary
When allowing the PSScriptAnalyzerSettings.psd1 to show Information-level problems, it adds a lot of overhead in formatting files that have lines with trailing whitespaces. Since this recommendation is mostly aesthetic/non-breaking, as is the automated code formatting in general, I'd like to see the formatter for PowerShell remove these trailing whitespaces characters.
Because we can't store a centralized configuration for PSScriptAnalyzerSettings.psd1 in source control at the repo/workspace level to have it be taken automatically be any user working on that repo, having per-user rules to suppress this aren't really practical. I did see a separate thread in this project's issues noting individual users can set a configuration flag to do this, but again, having every user do that themselves vs. having a central linting rule is frustrating to maintain adherence on. Short of having a CI/CD pipeline hard reject any PSScriptAnalyzer errors to force them to check in cleaned code, an automated approach is best.
Proposed Design
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name a source file or test. Start by locating the PowerShell formatter implementation in this TypeScript VS Code extension and reproduce formatting on a file with trailing whitespace. Done means formatted output removes trailing whitespace without changing unrelated content, with coverage in the relevant formatting tests if they exist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100