You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add option to ignore files outside the workspace - #2227
Opening a local file outside the current workspace can make the extension load and run an unrelated ESLint configuration. The existing behavior is useful for single-file workflows, so changing it unconditionally would break compatibility.
Design
Add an opt-in eslint.ignoreOutsideWorkspace resource setting, defaulting to false.
When enabled and at least one workspace folder is open, skip local file: documents that do not belong to any workspace folder.
Keep untitled and virtual documents unchanged, and keep standalone-file validation working when no folder is open.
Apply the boundary before explicit eslint.validate rules so the option consistently blocks external files.
Re-evaluate synced documents when workspace folders are added or removed, in addition to configuration changes.
Extract the validator behind a small injectable workspace interface so boundary behavior can be tested without a VS Code host. Preserve legacy eslint.validate entry validation, including rejecting non-boolean autoFix values.
Tests
npm run compile
npm run lint --prefix client
npm run lint --prefix server
npm test (client: 25 passed; server: 5 passed)
git diff --check
Regression tests reject string, null, numeric, object, and array autoFix values; these seven cases failed before the guard fix and pass afterward. Valid legacy entries and subsequent valid language entries remain accepted.
Preserve autoFix validation in the extracted type guard
client/src/validator.ts:17
The extracted type guard no longer validates the deprecated autoFix property. A malformed entry such as { "language": "javascript", "autoFix": "false" } is now accepted and forces validation on, whereas the previous ValidateItem.is rejected it. Preserve the old guard semantics so this refactor does not change how invalid settings are handled.
Dirk Bäumer (@dbaeumer) Could you take another look at this PR when you have a chance? The earlier workspace-boundary and typing comments were addressed in 34bb14a, and the latest b3b5bf9 restores the legacy autoFix validation behavior identified in the follow-up review. The current head is b3b5bf9; the review threads are resolved.
I validated the current branch locally with TypeScript compilation, client/server lint, 25 client tests, and 5 server tests. The CLA check has passed. GitHub's “VS Code PR Check” has remained in progress since September 21, so I cannot claim that check is complete.
* Report ESLint rule performance stats in an output channel (#2057)
When the `stats: true` ESLint option is set via `eslint.options`, the
server now aggregates per-rule timing data from each lint report and sends
it to the client over a new `eslint/stats` notification. The client logs
the timings to a dedicated "ESLint Stats" output channel, sorted by time
descending, with a new `eslint.showStatsOutputChannel` command to reveal it.
Fixes#2057
(part 1: server stats aggregation + protocol + tests)
* Report ESLint rule performance stats in an output channel (#2057)
When the `stats: true` ESLint option is set via `eslint.options`, the
server now aggregates per-rule timing data from each lint report and sends
it to the client over a new `eslint/stats` notification. The client logs
the timings to a dedicated "ESLint Stats" output channel, sorted by time
descending, with a new `eslint.showStatsOutputChannel` command to reveal it.
Fixes#2057
(part 2: client stats output channel + command)
* Move stats output helpers into the ESLintClient namespace
Addresses dbaeumer's review on #2248: the stats-channel helpers now live inside the existing ESLintClient namespace instead of being exported at module top level.
* Send only the document URI in eslint/stats; render via vscode.Uri on the client
The server no longer computes a file path for the stats report. The
client parses the URI with the VS Code API and prints fsPath for file
documents, the URI string otherwise, so untitled documents keep
distinguishable identities instead of collapsing onto synthetic
workspace paths.
* Sync with upstream main (conflict resolution, part 1/3)
Merge upstream PR #2227 (Validator moved to client/src/validator.ts);
re-applied eslint.showStatsOutputChannel command registrations.
* Sync with upstream main (conflict resolution, part 2/3)
Merge upstream PR #2227 (Validator moved to client/src/validator.ts);
re-applied eslint.showStatsOutputChannel command registrations.
* Sync with upstream main (conflict resolution, part 3/3)
Merge upstream PR #2227 (Validator moved to client/src/validator.ts);
re-applied eslint.showStatsOutputChannel command registrations.
* Restore CRLF line endings on upstream-synced files
* Move Stats* import to top of file to avoid merge conflicts with upstream import refactoring
* Refactor ESLint stats notification into shared reporter
* Report ESLint stats from fix and formatting runs
* Fix shared stats reporter structure
* Fix stats URI scope in fix and format runs
* Enable configured ESLint stats for fix runs
* Type ESLint stats option for fix runs
* Remove redundant stats option override
* Pass remote-host context to validator
* Pass VS Code remote host to validator
* Test workspace filtering on remote hosts
* Define remote host context for validator
* Skip workspace exclusion on remote hosts
* Import remote host information from VS Code
* Remove remote-host validator change, keep PR scoped to stats feature
Reverts the remote-host handling in the Validator (the remoteName
condition in the ignoreOutsideWorkspace check, the ValidateEnvironment
context, and the env plumbing in extension.ts) together with its test.
validator.ts and validator.test.ts return to their upstream form; the
PR now contains only the ESLint rule-performance stats feature.
---------
Co-authored-by: Dirk Bäumer <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Opening a local file outside the current workspace can make the extension load and run an unrelated ESLint configuration. The existing behavior is useful for single-file workflows, so changing it unconditionally would break compatibility.
Design
eslint.ignoreOutsideWorkspaceresource setting, defaulting tofalse.file:documents that do not belong to any workspace folder.eslint.validaterules so the option consistently blocks external files.eslint.validateentry validation, including rejecting non-booleanautoFixvalues.Tests
npm run compilenpm run lint --prefix clientnpm run lint --prefix servernpm test(client: 25 passed; server: 5 passed)git diff --checkautoFixvalues; these seven cases failed before the guard fix and pass afterward. Valid legacy entries and subsequent valid language entries remain accepted.Fixes #1805