Commit graph

31469 commits

Author SHA1 Message Date
Nathan Shively-Sanders 06fb724cd1
Improve uncalled function checks (#41599)
Fixes #41586
Fixes #41588

1. For binary expressions, if the immediate parent is an IfStatement,
then check the body of the if statement. I didn't walk upward to find an
IfStatement because in my experimentation I found that binary expression
uncalled-function errors are only issued when the expression is on the left of the
top-most binary expression.

2. For property accesses with interspersed calls, I added a
CallExpression case. In fact, any expression could appear here, but I
only want to fix calls for now since that's all we've observed in
Definitely Typed, and we didn't see anything else in the user tests or RWC
tests. I also didn't examine parameters of the intermediate call
expressions, but I don't think it's needed since the intent is to avoid
false positives.
2020-11-30 14:27:19 -08:00
Oleksandr T 23b3eb685f
fix(41621): fixUnusedIdentifier - allow deleting prefix/postfix unary operators (#41624) 2020-11-30 13:58:47 -08:00
Oleksandr T 1bd8e388ae
fix(41688): completions with infer keyword (#41704) 2020-11-30 11:56:12 -08:00
TypeScript Bot ee57040276 Update package-lock.json 2020-11-27 06:21:31 +00:00
Anders Hejlsberg 411c6d04c6
Fix getTypeFacts for pattern template literal types (#41693)
* Normalize `${string}` to just string, fix getTypeFacts

* Add tests

* Accept new baselines
2020-11-26 06:55:01 -10:00
TypeScript Bot d616d8fc11 Update package-lock.json 2020-11-26 06:21:13 +00:00
Anders Hejlsberg ec1490fb44
Properly cache types for shared control flow nodes (#41665)
* Properly cache shared flow node types

* Add test
2020-11-25 14:51:38 -10:00
Song Gao d5779c75d3
replace whole path if directory separator appears for import completion. (#41412)
* replace whole path if directory separator appears.

* Fix.

* revert change.

* Fix test case.

* add test.

* fix as suggested.

* revert useless change

* adapt to code change.

* fix baseline for test file.
2020-11-25 09:37:08 -08:00
Oleksandr T 242e0202cf
fix(41216): update baseline (#41687) 2020-11-25 09:11:42 -08:00
Andrew Branch 3fa30f4826
Remove obsolete go-to-definition code after CommonJS alias changes (#41522)
* Remove obsolete code

* Revert package-lock change
2020-11-25 09:01:56 -08:00
csigs 86429aae33
LEGO: Merge pull request 41678
LEGO: Merge pull request 41678
2020-11-24 16:11:30 -08:00
csigs dbcbe9369d LEGO: check in for master to temporary branch. 2020-11-25 00:11:00 +00:00
Oleksandr T 5adb55eb18
feat(41216): show JSDoc for aliases (#41452) 2020-11-24 14:40:51 -08:00
Andrew Casey a6ebf5d79a
Trace checkDeferredNode to cover JSX elements (#41572) 2020-11-24 14:33:15 -08:00
Andrew Casey 4c8418ee19
Use stricter types for tracing event arguments (#41217)
* Use stricter types for tracing event arguments

In local development, I've routinely passed the wrong local and ended up
having JSON.stringify throw.

* Make the type recursive

Courtesy of @rbuckton

* Fix lint error
2020-11-24 14:33:00 -08:00
Oleksandr T 03877260f8
fix(41194): ignore jsxFrag identifier in import declarations (#41441) 2020-11-24 14:29:47 -08:00
csigs d070acf29d
LEGO: Merge pull request 41673
LEGO: Merge pull request 41673
2020-11-24 10:11:17 -08:00
csigs 64702dee11 LEGO: check in for master to temporary branch. 2020-11-24 18:10:46 +00:00
csigs 72bb0eb0e6
LEGO: Merge pull request 41670
LEGO: Merge pull request 41670
2020-11-24 04:11:15 -08:00
csigs 0e2d8b4a5a LEGO: check in for master to temporary branch. 2020-11-24 12:10:42 +00:00
Guerric Phalippou d338c20c15
Add a comment to clarify the #private field (#41547)
* add a comment to clarify the #private field

* small fix
2020-11-23 22:34:27 -08:00
Oleksandr T d163ab67c8
fix(41240): allow emitting numeric with underscored separators as-is in esnext target (#41435) 2020-11-23 17:01:42 -08:00
csigs e60753339f
LEGO: Merge pull request 41661
LEGO: Merge pull request 41661
2020-11-23 16:11:22 -08:00
csigs 3328fda2ff LEGO: check in for master to temporary branch. 2020-11-24 00:10:50 +00:00
Jean Pierre 71559a5c0c
Fix show deprecated suggestion for alias (#41128)
* Fix show deprecated suggestion for alias

* Fix failing tests

* Avoid duplicated kind modifiers
2020-11-23 15:50:12 -08:00
Andrew Casey 669305b914
Pass throwIfNoEntry to fs.statSync (#41604)
Future versions of node will be able to return undefined, rather than
allocating and throwing an exception, when a file is not found.

See https://github.com/nodejs/node/pull/33716
2020-11-23 12:43:00 -08:00
TypeScript Bot 54f8d38535 Update package-lock.json 2020-11-23 06:20:23 +00:00
Nathan Shively-Sanders d057f7a992
Remove-unused-identifiers codefix skips assigned identifiers (#41168)
* Remove-all-unused-identifiers skips assigned identifiers

Previously, fixUnusedIdentifier worked the same in fix-all mode as for a
single fix: identifiers with assignments would be deleted:

```ts
function f(a) { }
f(1)
```

becomes

```ts
function f() { }
f()
```

But any kind of argument will be deleted, even one with side effects.
For a single codefix invocation, this is probably OK.
But for fix-all, this could lead to multiple changes
spread throughout a large file.

Now fix-all will only delete parameters and variable declarations with
no assignments:

```ts
function f(a) { }
function g(a) { }
f(1)
g
let x = 1
let y
```

becomes

```
function f(a) { }
function g() { }
f(1)
g
let x = 1
```

* Don't remove assigned parameters for single codefix either

* add optional parameter test case

* Skip initialised params and binding elements

Based on PR feedback from @amcasey

* fixAll removes unused binding patterns completely

* Fixes from comments

Thanks @amcasey for the thorough review

* fix trailing space lint

* correctly remove-all array binding
2020-11-21 09:57:17 -08:00
Daniel Rosenwasser f4157b41db
Add an action to update baselines/fix lints (#39898)
* Add an action to update baselines/fix lints

* Change email
2020-11-20 16:03:58 -08:00
Andrew Casey 68925b66f4
Split line and node counts by file extension (#39720)
* Split line and node counts by file extension

Continue to show only a summary for --diagnostics.

* Use SourceFile.isDeclarationFile
2020-11-20 15:03:11 -08:00
TypeScript Bot eac0f6dc30 Update package-lock.json 2020-11-20 06:19:39 +00:00
Andrew Branch 308814f6fa
Update JSX test errors (#41602) 2020-11-19 16:38:08 -08:00
Martin Probst 6b04f50394
Do not parse template arguments in JavaScript files. (#36673)
Fixes #36662.
2020-11-19 11:41:35 -08:00
Sheetal Nandi 2cc67ec0a6
If there are no open files, do not schedule ensureProjectForOpenFiles (#41537) 2020-11-18 16:10:11 -08:00
Oleksandr T 9bbbe5c0c7
fix(41227): change message about incorrect property access with possible replacement with static access (#41275) 2020-11-18 12:50:32 -08:00
Nathan Shively-Sanders d3abd35428
Unused Identifier codefix better understands constructors and methods (#41555)
* Unuse Identifier codefix understands constructors

Previously, it did not look for `super()` and `new this()` calls when
determining whether a constructor parameter could be deleted.

* better names, fix off-by-1 bug

* Codefix understands super methods now too

This unifies the code, changing it considerably.
2020-11-18 11:19:43 -08:00
TypeScript Bot 6643d97385 Update package-lock.json 2020-11-18 06:19:14 +00:00
Mateusz Burzyński 09eb3d3b9c
Fix/jsx global preferred over config implicit (#41476)
* Add actual baselines for a problem with global namespace being preferred over config & pragma implicit ones

* Fixed an issue with global React namespace being preferred over config & pragma implicit ones

* Do not try to mark JSX classic runtime symbols as used when automatic runtime is used
2020-11-17 17:52:32 -08:00
Oleksandr T 6369d89711
fix(41492): make more friendly handling the missing call function in binary expressions (#41502) 2020-11-17 09:42:27 -08:00
Andrew Casey 79ffd03f8b
Add tracing support to tsserver (#41374)
* Add tracing support to tsserver

Read the `TSS_TRACE` environment variable to determine which directory
trace files should be written to.

Notable changes from tsc tracing:
1) Drop all tracepoints that depend on type IDs
2) Write output to trace.PID.json
3) New, server-specific events (request/response, cancellation, etc)

* Drop try-finally blocks that aren't strictly necessary

* Fix lint error

* Trace background work (for diagnostics)

* Move try-finally blocks into session so tsc doesn't use them

* Add missing try-finally

* Use consistent capitalization

* Inline canPop call where underlying variable is available

* Clarify comments

* Include PID in build-mode file names

* Introduce more efficient popAll function

* Trace throwIfCancellationRequested rather than isCancellationRequested

* Remove unnecessary try-finally blocks

* Add a command-line argument for consistency with logging

* Fix rebase issues

* Address PR feedback

* Rename completionEvents to eventStack

* Drop assertStackEmpty as hard-to-maintain and marginally valuable

* Rename stepCancellation to stepCanceledEarly

* Rename stepEarlyCancellation to stepCanceled and use flag instead

* Check correct variable on exit
2020-11-16 09:26:28 -08:00
TypeScript Bot 4885dec80d Update package-lock.json 2020-11-15 06:17:33 +00:00
TypeScript Bot 566faa7a01 Update package-lock.json 2020-11-13 06:17:47 +00:00
TypeScript Bot d7f8d8de73 Update package-lock.json 2020-11-12 06:17:29 +00:00
Ron Buckton 64a6e6c30d
Merge pull request #41507 from microsoft/fix32890
Fix definition of ts.Iterator
2020-11-11 20:50:09 -08:00
Ron Buckton 54e54f4f19 Fix definition of ts.Iterator 2020-11-11 18:42:12 -08:00
Wesley Wigham 573768aaf5
Merge pull request #41506 from weswigham/fix-post-LK-build
Fix post-LKG build
2020-11-11 17:14:01 -08:00
Wesley Wigham ebaa926f39
Fix post-LKG build 2020-11-11 16:50:08 -08:00
Wesley Wigham bfea348e40
Actually install playwright in artifact build script
Now that it's not installed by default
2020-11-11 16:33:39 -08:00
Andrew Casey f79a78cd54
Merge pull request #41498 from amcasey/RemoveBeginEnd
Fold tracing.begin and end into push and pop
2020-11-11 15:23:11 -08:00
Andrew Casey e8996a34a9 Remove redundant type annotation 2020-11-11 13:56:27 -08:00