Commit Graph

22 Commits

Author SHA1 Message Date
Matt Bierner
e483059807
Clean up some type assertions (#211751)
Clean up some assertions

Mostly just removing extra type assertions or adding them to a better spot

Also addresses some missing semicolons that snuck in somehow
2024-04-30 18:39:44 -07:00
Matt Bierner
001929db91
Add eslint rule for disallowing dangerous type assertions (#211669)
This adds a new (off by default) eslint rule that disables two specific types of dangerous type assertions:

```ts
<Type>{...};
{...} as Type;
```

These are bad because they can easily hide missing properties and strictness errors

Right now just adding this rule but will assign out fixes to owners in different areas of the code
2024-04-30 11:27:22 -07:00
Matt Bierner
ae91138701
Add eslint rule for potentially unsafe disposable patterns (#209555)
`DisposableStore`/`MutableDisposable` properties should almost always be `readonly`. Otherwise it's easy to accidentally overwrite the property and leak the previous value. This commonly happens with code such as:

```ts
class Foo {
     private disposables = new DisposableStore();

     bar() {
         this.disposables = new DisposableStore(); // leaks old values
         ...
     }
```

This change adds an eslint rule to enforce this and adopts `readonly` for the caught cases. I only needed to add 2 suppression comments, which seems like an acceptable tradeoff for helping catch a common mistake
2024-04-04 10:34:45 -07:00
Matt Bierner
1e765ade0e
Fix injected services becoming public by mistake (#209513)
* Fix injected services becoming public by mistake

Fixes cases of `@IFooService readonly foo: IFooService`. This makes the service public, which is likely not expected and also means we can't mangle it

* Fix name

* Remove unused props
2024-04-04 08:06:16 +02:00
Peng Lyu
cfa5001723
Allow type imports only in webview preloads (#204639) 2024-02-07 10:00:30 -08:00
Johannes Rieken
5bf577b08a
make sure super.dispose is called inside overridden dispose methods (#200342) 2023-12-08 13:45:44 +01:00
Connor Peet
16c469a671
eng: add a lint rule for ensureNoDisposablesAreLeakedInTestSuite (#200089)
Adds a lint rule that ensures ensureNoDisposablesAreLeakedInTestSuite
is called in suites. It grandfathers in existing files that were lacking
the call entirely.

This PR also includes manual fixes to files that used the function
already but were missing it in one or more suites, which the lint rule
detects.
2023-12-05 14:35:27 -08:00
Benjamin Pasero
cb9c48673f
aux window - reduce deprecated $window usages (#197800)
* aux window - reduce deprecated $window usages

* aux window - reduce deprecated $window usages

* aux window - reduce deprecated $window usages

* aux window - reduce deprecated $window usages
2023-11-09 09:09:02 +01:00
Tyler James Leonhardt
a27dc7725c
Introduce localize2 function (#194750)
* Introduce `localize2` function

This is syntax sugar around:
```
{ value localize('id', "Hello"), original: 'Hello' }
```

That will now be returned when you do:
```
localize2('id', "Hello");
```

* fix merge conflic

* new source map due to updated deps
2023-10-04 12:57:38 -07:00
Connor Peet
331e445eff
eng: add a basic 'must use result' and ensure assertSnapshot result is used (#194744)
* eng: add a basic 'must use result' and ensure assertSnapshot result is used

Fixes #194570

* fix found lint
2023-10-03 20:08:56 +01:00
Alex Ross
34442b8b39
Warn on async suites (#188378)
Part of #187718
2023-07-28 17:04:23 +01:00
Johannes
8c19d3f0e7
add lint rule for AMD node imports 2023-07-04 11:31:36 +02:00
Johannes Rieken
69cd1439e5
from ESM land bring over amdX-util and bring over one of its usages (#186748)
* from ESM land bring over amdX-util and bring over one of its usages

* fix tsec violation

* one more exemption

* grrrr

* last try, fingers crossed
2023-06-30 09:05:06 -07:00
Johannes Rieken
654c61dcb1
add lint-rule to discourage native private fields (#186735) 2023-06-30 06:13:18 -07:00
Johannes Rieken
89b615d105
add lint rule to prevent type discrimination properties in API types (#180829)
re https://github.com/microsoft/vscode/issues/63943 and other
2023-04-25 11:22:28 -07:00
Robo
e5f61433b5
chore: update to Electron 22 (#177600)
* Revert "chore: revert to Electron 19 (#175851)"

This reverts commit 3a11b47eee.

* chore: bump electron@22.3.3

* build: use custom version for V8 sandbox

* chore: update electron@22.4.1

* chore: enable forceAllocationsToV8Sandbox for extension host

* chore: bump electron@22.4.2

* chore: bump electron@22.4.3

* sandbox - cleanup from electron 22 update (#178919)

* Revert "chore: revert to Electron 19 (#175851)"

This reverts commit 3a11b47eee.

* chore: bump electron@22.3.3

* build: use custom version for V8 sandbox

* chore: update electron@22.4.1

* chore: enable forceAllocationsToV8Sandbox for extension host

* chore: bump electron@22.4.2

* chore: bump electron@22.4.3

* temp: update distro

* sandbox - cleanup from electron 22 update

* missing comile

* more changes

* fix build

* restore

* 💄

* compile

---------

Co-authored-by: deepak1556 <hop2deep@gmail.com>

---------

Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
2023-04-03 09:09:31 +02:00
Alex Ross
89c4f61de2
Alexr00/showLocalAPI (#173798)
* Propose "allowLocal" open dialog option API
Part of #131138

* Update comment

* allowUIResources API proposal
Part of #131138

* Fix scheme ordering and update doc comment
2023-02-09 09:53:24 +01:00
Matt Bierner
09bfa65d9a
Add eslint rule for suite.only (#170994)
Follow up from #170970
2023-01-10 19:57:05 +01:00
Matt Bierner
8a37410ce2
Adopt l10n for extension-editing (#165523)
For #164438
2022-11-04 12:04:47 -07:00
Matt Bierner
cd29f751eb
Adopt l10n for markdown extension (#165448)
For #164438

Also makes our eslint rules understand `vscode.l10n.t(`
2022-11-04 09:49:49 +01:00
Johannes Rieken
98546b2287
eslint: add a new rule to enforce declare _serviceBrand: undefined (#165396) 2022-11-03 10:32:37 -07:00
Matt Bierner
5e92794be6
Re-enable running our eslint rules using ts-node (#159495)
Resubmission of #157532 with the following changes:

- Use `eslint-plugin-local` instead of `yarn` link to run our plugins
- Move our plugins to a top level `.eslintplugin` dir (as required by `eslint-plugin-local`)
- Update all names to `local/`
2022-08-30 08:40:04 +02:00