38 Commits

Author SHA1 Message Date
Isabel Duan
52eaa7b02f
Enable --isolatedDeclarations on TS codebase (#59635)
Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
Co-authored-by: Andrew Branch <andrew@wheream.io>
2024-09-15 18:10:52 -07:00
Lars Kappert
752135eb40
Remove unused exports & dead code (using Knip) (#56817)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
2024-06-27 14:24:01 -07:00
Jake Bailey
16beff101a
Use explicit extensions for imports within src (#58421) 2024-05-06 17:07:54 -07:00
Jake Bailey
72f413cea0
Remove deprecated originalKeywordKind and isInJSDocNamespace (#58228) 2024-04-17 15:28:07 -07:00
Jake Bailey
4cedfe40b0
Update dprint, don't force multiline imports for imports of single name (#58038) 2024-04-02 10:58:16 -07:00
Jake Bailey
5e8c261b6a
dprint the codebase (#54820) 2023-08-16 14:26:38 -07:00
Jake Bailey
3b43d841d1
Enable eslint rules prefer-rest-params and prefer-spread (#55181) 2023-08-11 15:07:06 -07:00
Jake Bailey
2a8436c529
Use eslint-plugin-simple-import-sort (#52090) 2023-02-02 14:36:21 -08:00
Ron Buckton
f526e16b2d
Remove outdated deprecations (#52314) 2023-01-20 12:19:13 -05:00
Ron Buckton
5b18979697
Implement the Stage 3 Decorators Proposal (#50820) 2023-01-19 17:54:12 -05:00
Ron Buckton
9cdba994ac
Remove some properties from Identifier (#52170) 2023-01-12 17:20:12 -05:00
Jake Bailey
00dc0b6674
Flip imports to case insensitive sorting (#51579) 2022-11-17 15:35:28 -08:00
Jake Bailey
2d2a4343b8
Reformat imports to be one identifier per line (#51565) 2022-11-17 13:42:18 -08:00
Jake Bailey
4d53a1f8f1
Move deprecate from Debug to deprecatedCompat (#51522) 2022-11-15 16:00:33 -08:00
Jake Bailey
9f64a3a58c
Remove ts.{Map,Set,ESMap,Iterator} and associated types (#51439) 2022-11-09 15:06:31 -08:00
Jake Bailey
c65142244c Add dts bundling
This adds a "small" d.ts bundler script. This script is very basic,
using Node printing to produce its output. Generally speaking, this is
inadvisable as it completely disregards name shadowing, globals, etc.
However, in our case, we don't care about the globals, and we can opt to
restructure our codebase in order to avoid conflict, which we largely
had to do anyway when we were namespaces and everything was in scope.
2022-11-07 13:35:48 -08:00
Jake Bailey
4139807e75 Add build via esbuild
This configures the existing build tasks to use esbuild by default. If
using the plain files is desired, passing `--bundle=false` will build
using plain files and still produce a runnable system.

This is only a basic build; a more efficient build is provided later
when gulp is replaced by hereby.
2022-11-07 13:34:44 -08:00
Jake Bailey
36e29448e9 Get codebase building pre bundling
This isn't totally complete, but enough to get everything building and
tests running manually. The next commit will make the build work fully.
2022-11-07 13:34:44 -08:00
Jake Bailey
d12116d8da Fix all internal JSDoc comments
If these are regular comments, then they won't appear in our d.ts files.
But, now we are relying on an external d.ts bundler to produce our final
merged, so they need to be present in the "input" d.ts files, meaning
they have to be JSDoc comments.

These comments only work today because all of our builds load their TS
files from scratch, so they see the actual source files and their
non-JSDoc comments.

The comments also need to be attached to a declaration, not floating,
otherwise they won't be used by api-extractor, so move them if needed.
2022-11-07 13:34:44 -08:00
Jake Bailey
07758c08ab Generated module conversion step - inlineImports
This step converts as many explicit accesses as possible in favor of direct imports from the modules in which things were declared. This restores the code (as much as possible) back to how it looked originally before the explicitify step, e.g. instead of "ts.Node" and "ts.Symbol", we have just "Node" and "Symbol".
2022-11-07 13:33:07 -08:00
Jake Bailey
b6c0538826 Generated module conversion step - stripNamespaces
This step converts each file into an exported module by hoisting the namespace bodies into the global scope and transferring internal markers down onto declarations as needed.

The namespaces are reconstructed as "barrel"-style modules, which are identical to the old namespace objects in structure. These reconstructed namespaces are then imported in the newly module-ified files, making existing expressions like "ts." valid.
2022-11-07 13:32:03 -08:00
Jake Bailey
9a0b85ce2a Generated module conversion step - explicitify
This step makes all implicit namespace accesses explicit, e.g. "Node" turns into "ts.Node".
2022-11-07 13:29:05 -08:00
Jake Bailey
94724a8c2e Generated module conversion step - unindent
This step makes further commits look clearer by unindenting all of the top level namespaces preemptively.
2022-11-07 13:28:13 -08:00
Jake Bailey
df89c7457d Make a few changes to allow all code to be loaded as one project 2022-11-07 13:27:19 -08:00
Ron Buckton
a4cabe725b
Support for auto-accessor fields from the Stage 3 Decorators proposal (#49705)
* Support for auto-accessor fields

* Add tests, ensure accessors are initialized in ctor

* classFields cleanup and PR feedback
2022-09-12 15:12:11 -04:00
Jake Bailey
6362fb2dce
Replace eslint rulesdir with eslint-plugin-local, convert eslint rules to JS (#50380) 2022-08-22 13:46:03 -07:00
Ron Buckton
284837d66b
Fixes for decorators property deprecations (#50343)
* Change type of deprecated 'decorators' property

* fix 'Invalid Arguments' error for create/update constructor in factory

* Update deprecation comments

* Make 'decorators' optional and 'undefined'

* Rename '_decorators' to 'illegalDecorators'

* Update baselines
2022-08-19 14:27:26 -04:00
Ron Buckton
1e65b330a7
Merge 'decorators' into 'modifiers' on various nodes (#49089)
* Merge 'decorators' into 'modifiers' on various Nodes

* Drop RESERVED argument in favor of removing parameter

* Ignore grammar error nodes when asserting invariants

* Revert 'illegalX' property renames

* PR Feedback
2022-06-09 17:24:02 -07:00
Andrew Branch
796be45118
Update signatures to avoid post-LKG error (#48677) 2022-04-13 16:36:35 -07:00
Andrew Branch
02787cfde1
Make LKG and nightly declaration emit the same (#48641) 2022-04-11 12:33:57 -07:00
Wenlu Wang
ec114b8931
Import assertion (#40698)
* Add parsing

* fix all api

* check gramma of import call

* Add more part of assertion

* Add some case

* Add baseline

* use module insted of target

* strip assertion in d.ts

* Update new baseline

* accept baseline

* Revert error number changes

* Update diagnostic message

* Accept baseline

* rename path

* Fix cr issues

* Accept baseline

* Accept baseline

* Error if assertion and typeonly import

* Accept baseline

* Make lint happy

* Add some comment

* Fix cr issues

* Fix more issue

* Incorporate PR feedback, fix module resolution for import()

* Add contextual type and completions for ImportCall options argument

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
2021-09-20 14:15:22 -07:00
Nathan Shively-Sanders
dcc27ebaf2
@link support, second try (#43312)
* Revert "Revert "Editor support for link tag (#41877)" (#43302)"

This reverts commit 451d4354b94e533907ef3b6362a89435f67577a3.

* Fix parsing @link at end of comment

* Parse comments as string when no @link occurs

* fix lint
2021-03-22 16:39:35 -07:00
Nathan Shively-Sanders
451d4354b9
Revert "Editor support for link tag (#41877)" (#43302)
This reverts commit ec77bff33226fb01f4e38b20e481f8c1fcd9e6c0.
2021-03-18 14:42:25 -07:00
Nathan Shively-Sanders
ec77bff332
Editor support for link tag (#41877)
* Initial scribbles

* Compiles but provides spans instead of location pairs

Probably need to fork the services/server types and provide a conversion
with Session.toFileSpan. Not sure where to put the conversion.

* Switch to DocumentSpan

In theory this is already better supported, but not sure practise bears
that out.

* Builds w/protocol types + conversions

* cleanup:better names and scrub TODOs

* fix test harness too

* Misc

1. Simplify protocol after talking to @mjbvz.
2. Add more tests.
3. Initial notes about where to add parsing.

* Parse and store links in the compiler

The text of the link is still stored in the comment text, but that's now
kept in an object instead of just a string. Each link has the parse for
the entity reference, if there is one.

Needs lots more tests -- this just makes all the existing jsdoc tests
pass.

* more tests and some fixes

* Fix other failing tests

* fix bad merge

* polish parser

* improve names and array types

* slight tweaks

* remove some done TODOs

* more tests + resulting fixes

* add+fix cross-module tests

* Support `@see {@link`

Plus find-all-refs support equivalent to @see's.

* add server test

* Make comments actually part of the AST

* Add span for link.name in language service/protocol

* Make checker optional in getJSDocTags

Also change to JSDocCommentText from JSDocCommentComment

* Use getTokenValue instead of getTokenText

Measure twice, slice once

* Add missing support for top-level links

The language service and protocol were missing support for top-level
links. This commit adds that plumbing.

* add string back to comment type in node constructors

* Full parse of link tags and jsdoc comment text

- Doesn't pass fourslash yet, I'm going to switch to baselines for
  failures there.
- Still needs some work on the protocol to convert file+offset to
  file+line+offset.

* fix lint

* Fix missing newlines in inferFromUsage codefix

* Parse jsdoc comments as text node/link array

And switch to line+character offsets in the protocol

* Fix fourslash tests

Mostly ones that can't be baselined, but I switched a couple more over
to baselines

* Improve types and documentation

* Test+fix @link emit, scrub other TODOs

* update API baselines

* test that goto-def works with @link

* Split link displaypart into 3

One for link prefix and suffix, one for link name, and one for link
text.

* update baselines

* Provide JSDocTagInfo.text: string to full clients by default

Instead of upgrading them to displayparts.

* Real server tests

* Disambiguate {@link} and @param x {type}

They are ambiguous; previously the parser preferred the type
interpretation, but will now look ahead and parse links instead when the
prefix is `{@link`.

* Add explanatory comment in test

* fix location in richResponse in protocol

* update API baseline

* Address PR comments

1. Add a cross-file goto-def test.
2. Switch from per-message args to UserPreference.

* use arraysEqual from core
2021-03-16 16:26:01 -07:00
Ron Buckton
68b0323b72
Refactor emit substitution into transform (#42676)
* Refactor emit substitution into transform

* Add reusable state machine for binary expressions

* Allow emitBinary to use state machine for comments/sourcemaps

* Switch core trampoline state back to arrays

* Switch binder to parallel stacks, temporarily partially revert emitBinary

* Add link to benchmark when posting perf results

* Ensure work stacks are per-execution

* Reenable comments and sourcemaps
2021-02-25 23:01:41 -08:00
Ron Buckton
0d284e6c26
Add support for abstract constructor types (#36392)
* Add support for abstract constructor types

* Add backwards-compatible overloads for creating/updating constructor types

* Reverting use of 'abstract' in lib/es5.d.ts due to eslint issues

* Update baseline due to reverting lib

* Add error for failing to mark an mixin class as abstract

* Fix declaration/quick info for abstract construct signatures
2021-01-07 17:11:14 -08:00
Ron Buckton
9b1fec29b4 Fix deprecation messages to point to correct APIs 2020-12-03 15:34:06 -08:00
Daniel Rosenwasser
373b352333
Rename 'compat' to 'deprecatedCompat'. (#41000) 2020-11-02 14:25:12 -08:00