Commit graph

814 commits

Author SHA1 Message Date
Orta Therox 07fd7bce64
Intl 2021 Updates (#45647)
* Import of Intl.Locale from #39664

* Handle updating es2020.intl and add es2021 for new DateTimeFormatOptions options - re: #39664

* Extends DateTimeFormatOptions for new Intl APIs - re: #45420

* Handle migrating Intl.NumberFormat.formatToParts to es2018 (keeping esnext.intl around)

* Adds Intl.DisplayNames to es2020 - re: #44022

* Remove attributes added in es2021 from es2020 - re: #42944

* Add a reference to es2021 in the command line parser

* Adds some docs about the lib files

* Baselines

* Allow undefined in Intl inputs to allow for ergonomic usage of exactOptionalPropertyTypes - see #45652

* Adds some tests covering the APIs

* Apply suggestions from code review

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>

* Handle PR feedback

* More review improvements

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-09-08 10:43:01 +01:00
Orta Therox 32168ed653
Add support for raising if you set a tsconfig entry of target/module with the right setting in the root (#44964)
* Add support for raising if you set a tsconfig entry of target/module with the right setting in the root

* Switch to check for any compiler option in the root which doesn't include compilerOptions

* Get green

* Apply suggestions from code review

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>

* Update src/compiler/commandLineParser.ts

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

Co-authored-by: Andrew Branch <andrewbranch@users.noreply.github.com>
Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-09-08 10:17:43 +01:00
Orta Therox f9a3d85b00
Fix the default text for --useDefineForClassFields (#45513)
* Fix the default text for --useDefineForClassFields

* Update with feedback
2021-09-01 15:10:47 +01:00
Orta Therox 1f85123821
Revisions for the new --help (#44800)
* WIP on refining the new --help

* Fix types in the boolean trivial lint rule

* Update baselines

* More work

* Updates the color logic

* Simplifies the CLI color code

* Use cyan instead of blue for win powershell/command prompt

* Use bright white when blue is probably going to look off

* Fix NO_COLOR

* Adds a test to cover NO_COLOR

* Update src/compiler/diagnosticMessages.json

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

* Update compiler diagnostic text

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-08-05 16:41:01 +01:00
Oleksandr T c0821aeacd
fix(44926): change noImplicitOverride description (#44929) 2021-07-07 18:43:44 +01:00
Ryan Cavanaugh 5afe42e14e
Rename strictOptionalProperties -> exactOptionalPropertyTypes and remove from strict family (#44626) 2021-06-17 15:12:19 -07:00
Song Gao 971133d5d0
New command line help developer experience. (#44157)
* refactor help CLI output.

* fix typo and omit false condition boolean output.

* fix typo

* add line break

* add --plugins option to basic option category.

* add ts icon and remove old print help function.

* better command description for --jsx.

* Fix test

* fix lint

* Improvements to the UX

* Fix tests

* fix test.

* add missing help out.

* use environemnt variable to control test case.

* fix merge issues.

* No `No Category`

* make getWidthOfTerminal optional.

* fix test

* fix review.

* fix review.

* Update baselines

Co-authored-by: Orta <git@orta.io>
2021-06-16 14:18:00 +01:00
Orta Therox b74b8977d5
Update descriptions for all compiler options (#44409)
* Add new descriptions to compiler options

* Update baselines
2021-06-15 21:20:14 +01:00
Sheetal Nandi 9df7ecb38b
Handle strict flag when writing tsbuildinfo (#44394)
* Add test showing how setting strict is not preserved in tsbuildinfo
Test for #44305

* Handle strict flag when writing tsbuildinfo
Fixes #44305

* Apply suggestions from code review

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
2021-06-03 16:14:58 -07:00
Daniel Rosenwasser 9906092db2
Add flag to change catch variables' default types to unknown (#41013)
* Add test case for 'useUnknownInCatchVariables'.

* Add new 'useUnknownInCatchVariables' flag.

* Accepted baselines.

* Add test for catch variable explicitly typed as 'any'.

* Accepted baselines.

* Move option under 'strict'.

* Accepted baselines.

* 'useUnknownInCatchVariables' is strict in command line help.
2021-06-03 13:12:56 -07:00
Orta Therox 9d345e7734
Rename TSConfig option categories (#42514)
* Update the category descriptions for the tsconfig options

* Gets tests green

* Whitespace change

* Drop command line options from --init

* Go back to the old re-build baseline

* Fix numbers

* Remove formatting options from --showconfig

* Dpon't show output formatting changes in showConfig

* Update baselines

* Update baselines
2021-06-03 12:21:04 +01:00
Anders Hejlsberg 391f9ffb85
Strict optional properties (#43947)
* Introduce --strictOptionalProperties compiler switch

* Accept new baselines

* Removing missingType when printing back optional properties

* Accept new baselines

* Fix linting issue

* Use getNonMissingTypeOfSymbol in getTypeOfSymbolAtLocation

* Properly elaborate errors involving optional properties

* Accept new baselines

* Properly check optional properties in tuple types

* Accept new baselines

* Add missing tuple type check

* More permissive check of strict optional properties and index signatures

* Add tests

* Fix lint issues

* Accept new baselines
2021-06-01 14:52:16 -07:00
Sheetal Nandi 2ffd35de4d
More updates to program reuse with different option changes (#44276) 2021-05-26 15:57:43 -07:00
Andrew Casey 3ffa245f07
Cache parsed path mapping patterns (#44078)
* Cache parsed path mapping patterns

If a project has many of them (e.g. 1800), parsing the patterns
repeatedly can take up a lot of time.

* Move cache to ConfigFileSpecs

* Inline constants

* Simplify cache access
2021-05-26 09:40:42 -07:00
Wesley Wigham fcabb5c0cc
Simplify or optimize regexes with polynomial time worst cases (#44197)
* Simplify or optimize regexes with polynomial time worst cases

* PR feedback & cleanup

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>

* Use builtin scanner function for checking whitespace in fallback method (its faster)

Co-authored-by: David Michon <dmichon-msft@users.noreply.github.com>
2021-05-24 15:28:52 -07:00
Oleksandr T db01e84700
feat(eslint): consistent-type-assertions (#43556) 2021-05-18 06:20:57 -07:00
Josh Goldberg fe4a6709da
Specified diagnostic for CLI flags mismatched with/out --build (#43199)
* Specified diagnostic for CLI flags missing a required --build

* Switched to an alternateMode member

* Added --build-incompatible flags too

* Small fixups to remove a hardcoding

* Switched to ||= factories

* Not a function

* I think I get it now
2021-04-07 16:03:17 -07:00
Wenlu Wang 2f0c8b2bea
--noImplicitOverride (#39669)
* wip: add types

* wip

* Add cases

* Add some case

* Add more check

* accept baseline

* add abstract abd declare method

* add override in declaration

* accept baseline

* add property override

* Fix decalre modifier

* update baseline

* Add more cases

* make lint happy

* make lint happy

* Update description

* Add codefix

* simplify code

* accept baseline

* Update desc

* Accept baseline

* Add override completions

* filter out implements field in override context

* fix tests

* Add parameter property check

* Accept baseline

* acept baseline

* Add parameter property to declaration code action

* Add quickfix for override parameter property

* fix code style

* Add override with interface tests

* Add more cases about modifier position

* rename flag

* rename flags

* Added tests.

* Accepted baselines.

* Always issue errors for unnecessary 'override' modifiers.

* Accepted baselines.

* Override perf (#4)

* try cache check result

* pre check for override

* Do not issue error if implement abstract

* Add abstract-spec check

* Avoid override dead lock

* Add more case

* Add codefix for new error

* Fix error message

* Add jsdoc override tag (#6)

* Override jsdoc tag (#7)

* accept baseline

* Disallow codefix in js

* update baseline

* Omit override in d.ts

* Add more case in js

* Accept baseline

* fix override js test

* fix crlf

* Revert merge conflict changes

* Accept baseline

* Avoid space

* Fix CR issues

* Accept baseline

* Fix typo and add more check

* Fix error name

Co-authored-by: Daniel Rosenwasser <Daniel.Rosenwasser@microsoft.com>
2021-03-26 16:29:22 -07:00
Sheetal Nandi a545ab1ac2
Cache resolved project references and watch wild card directories from them to update them (#42929)
* Test for not watchiong referenced projects fileNames and invalidating it

* Add watching wild card directories and caching parsed command line for projects so that its shared

* Handle config file watching and commandline cache together

* Watch extended files for commndline cache instead of project

* Use extended config cache now that we are watching extended config files

* Structure for getParsedCommandLine from the LS

* Adding some more skeleton with todos

* getParsedCommandLine on WatchCompilerHost

* Tests for Watch, LS scenarios

* Handle getParsedCommandLine so we are looking at all things for referenced

* Cleanup and commenting

* Test for transitive references with tsc-watch

* Cache parsed command line even if host implements getParsedCommandLine

* Cleanup

* Cleanup

* Some tests to verify exclude from referenced project doesnt trigger the update

* Baseline when program is same

* Test for incremental scenario

* Tests for output from referenced project

* Comments
2021-03-26 13:23:03 -07:00
Kagami Sascha Rosylight f4d0ea6539
Add target: ES2021 (#41239)
* Support `target: es2020`

* use CRLF

* update symbols

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-10 13:31:25 -08:00
Sheetal Nandi 0cf834ceec
Move fixed chunk size polling as a watch option and move it out of server (#42542)
* Move fixed chunk size polling as a watch option and move it out of server
Fixes #41549

* Feedback
2021-03-02 16:45:53 -08:00
Andrew Branch 2a01f923ca
Improve JSON parser error recovery (#42657)
* Improve JSON parser error recovery

* Add error baselines

* Move tsconfig root checking out of common JSON checking function

* Use new function in parseConfigFileTextToJson

* Fix test

* Replace non-null assertion with explicit debug assertion
2021-02-23 09:31:09 -08:00
Sheetal Nandi c3e132da59
Keep extended config's raw file, include, exclude relative to itself and correct it when setting extending options (#42544)
* Test when config file extends is incorrectly computed
Test for #40720

* Keep extended config's raw file, include, exclude relative to itself and correct it when setting extending options
Fixes #40720
2021-02-03 11:09:06 -08:00
Orta Therox 055f363fba
Reverts #39277 removing bundledPackageName (#41499)
* Reverts #39277

* Bring back modeyule resolution for the test runner
2021-01-08 10:55:34 +00:00
Oleksandr T 4dc82fdfba
fix(41845): add missing values to diagnostic message related to jsx option (#41873) 2020-12-09 13:41:15 -08:00
Sheetal Nandi 2eca17d7c1
Keep track of why files are in the program (#40011)
* --explainFiles currently hardcoded

* Move configFileSpecs to configFile so it can be used in program later

* Explain root file inclusion reason and explain include files in the log

* Baseline explainFiles

* Fix incorrectly reporting of file list two times in --b mode

* Fix unnecessary new lines in output represented incorretly in the baseline

* More tests

* More cleaning up

* Keep listing files in same order as list files, just add explaination

* Fix double listing of file names when the program has errors

* Make diagnostic chains for file include reason

* Add explaination for the file include to diagnostics for program

* Harness ls incorrectly adding tsconfig as the root file

* Fix incorrect use of path for calculating absolute path

* Fix the root file in fourslash

* Test project service options merge

* Add config file name to matched by include explaination

* Add test for when the file changes and program is reused completely but related file information is reattached to correct location

* Handle file preprocessing diagnostics updates when program is reused and related information location changes

* Moved types to types.ts

* Refactoring and cleanup

* More cleanup

* More refatoring

* Handle synthetic imports

* Baselines after merge
2020-12-08 16:10:05 -08:00
kingwl 31e686b996 Fix codefix for noPropertyAccessFromIndexSignature 2020-12-03 11:51:41 +08:00
Sheetal Nandi 76cf8fd78b
Add way to exclude files and directories to watch (#39243)
* Parse excludeDirectories and excludeFiles

* Use watch factory in typings installer

* Some refactoring for watchFactory

* Create Noop watcher if file or directory being watched is excluded

* Baselines without using exclude watch options

* Baselines including exclude option

* Handle exclude options in the system watches

* Add test without exclude option for recursive directory watching

* Test baselines with exclude option

* Always set sysLog

* Test for exclude option in server

* Add exclude options in the config file and fix the test

* Fix host configuration for server

* Handle host configuration for watch options

* Fix sysLog time log so baselines can be clean

* Handle reloadProjects to reload the project from scratch

* Ensure that file updates are reflected

* Feedback

* Feedback
2020-11-04 13:30:06 -08:00
Wenlu Wang ce8d702586
Add support for pedantic property access (#40171)
* Add support for pedantic property access

* accept baseline

* Update diag message

* Avoid pedantic

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-11-02 15:19:00 -08:00
Wesley Wigham 8493ee8824
Add mroe incremental-affecting affixes to compiler options, add incremental test for changing jsxImportSource 2020-10-30 16:01:27 -07:00
Wesley Wigham fe3b3436e6
Add affectsModuleResolution: true ot jsx and jsxImportSource options 2020-10-30 15:38:20 -07:00
Sheetal Nandi 6bde4b5c02
Fix missing file name of extended source file in synchronizeProjectList when it is missing on disk (#41222)
Fixes #40136
2020-10-29 12:18:43 -07:00
Jesse Trinity 08e4f369fb
Add editor configurable filename-based ATA (#40952)
* add typeAcquisition:inferTypings

* remove unused property

* handle inferred and external projects separately

* update missed rename

* fix tests

* pass as external compilerOption

* update test

* remove hostConfig reference

* change option name

* remove extraneous property

* add inferredProjectCompilerOptions
2020-10-19 09:53:58 -07:00
Nathan Shively-Sanders fc783a9000
Fix missed tasks to add esnext.weakref (#40981)
Follow up to #38232, based on #33844
2020-10-07 11:06:04 -07:00
Andrew Branch dc8952d308
jsx option affects emit (#40775) 2020-09-25 12:20:29 -07:00
Ryan Cavanaugh 3d235b42a0
--noUncheckedIndexedAccess (#39560)
* Initial implementation + tests

* linty

* Support destructuring declarations and assignments

* lint

* Fix destructuring assignment and element access into known properties

* Update baselines

* Rename flag to unUncheckedIndexedAccess

* Add test for unique symbol indexing

* Fix flag order in baselines

Co-authored-by: Andrew Branch <andrew@wheream.io>
2020-09-11 14:43:10 -07:00
Andrew Branch 9c8d11b5ed
Allow 'paths' without 'baseUrl' (#40101)
* Allow paths without baseUrl

* Remove exception for leading * paths

* Add comment, remove commented code

* Update baselines

* Remove unnecessary default

* Fix test harness

* Fix baseline

* Resolve relative to host.getCurrentDirectory() with createProgram API
2020-09-11 12:58:40 -07:00
Orta Therox aa2756a5d7
Updates Dom lib with TSJS changes, adding a new library for webworker iterable (#40500)
* Updates Dom lib with TSJS changes, adding a new library for webworker iterable

Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>

* Fixes tests

Co-authored-by: Nathan Shively-Sanders <nathansa@microsoft.com>
2020-09-11 15:36:00 -04:00
Wesley Wigham a36f17c1f8
Add emit support for jsx/jsxs experimental jsx runtime api (#39199) 2020-09-11 10:44:52 -07:00
Jack Moore 4a3b195772
Add lib es2020.sharedmemory (#39541) 2020-09-11 11:34:01 -04:00
Orta Therox cdafb7157b
Replaces the default module index resolver with '/index' instead of '' when handling internal routing for dts bundles (#39277)
* Adds support for declaring the bundled name of a dts module export

Co-authored-by: Wesley Wigham <wwigham@gmail.com>

* Adds baselines

* Update the tests

* Try to reduce the scope of the bundledPackageName error

* Use the flag in more baselines

* Get it green

* More tests

* Handle more feedback

* More test cleanup

* Set the moduleResolution for the tsconfigs

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2020-09-11 08:12:07 -04:00
Andrew Casey a0479da1e5 Revert System changes and consume fs directly 2020-08-21 17:07:13 -07:00
Andrew Casey 5d60972ef4 Trace key operations
Produce output in Chrome's event tracing format so that it can be viewed
in Chrome/Edge.
2020-08-21 17:07:12 -07:00
Sheetal Nandi c95cffe111
Ensure file, include and exclude specs used are strings (#40041)
* Test displaying failure when specs used are not strings

* Ensure specs used are strings
Fixes #38164, #39856

* Feedback
2020-08-13 17:08:20 -07:00
Sheetal Nandi e92afacc44
Add disableReferencedProjectLoad to stop loading child projects to allow users to disable loading large solutions (#39593)
* Use disableReferencedProjectLoad to stop loading child projects to allow users to disable loading large solutions
Fixes #39144

* Handle indirect references

* PR feedback
2020-07-21 14:24:15 -07:00
Ron Buckton 9d5cd280ef Merge branch 'master' into migrateMapsAndSets
# Conflicts:
#	src/compiler/checker.ts
#	src/compiler/commandLineParser.ts
#	src/compiler/core.ts
#	src/compiler/moduleNameResolver.ts
#	src/compiler/transformers/declarations.ts
#	src/compiler/tsbuildPublic.ts
#	src/compiler/types.ts
#	src/compiler/utilities.ts
#	src/harness/client.ts
#	src/server/editorServices.ts
#	src/server/typingsCache.ts
#	src/server/utilities.ts
#	src/services/codefixes/convertToAsyncFunction.ts
#	src/services/documentRegistry.ts
#	src/services/importTracker.ts
#	src/services/refactorProvider.ts
#	src/services/refactors/extractSymbol.ts
#	src/testRunner/unittests/programApi.ts
#	src/typingsInstallerCore/typingsInstaller.ts
#	tests/baselines/reference/api/tsserverlibrary.d.ts
#	tests/baselines/reference/api/typescript.d.ts
2020-07-07 13:53:46 -07:00
Ron Buckton 7b942b4fa8
Revert the type change to ts.Map (#39366) 2020-07-01 17:00:26 -07:00
Ron Buckton 611b77f2e6 Migrate more places to use Map/Set 2020-06-26 10:15:53 -07:00
Ron Buckton eb2f4e2337
Switch to ES Map/Set internally (#33771)
* Add full implemention of Map and Set to shims

* Update default Map interface

* Remove WeakMap/WeakSet

* Add tests for set shim

* Update most usages of Map<K, true> to Set

* PR Feedback

* Fix lint issues

* Change key in fsWatchCallback

* Simpler shim, more tests

* Fix typo in collection shim
2020-06-26 10:12:47 -07:00
Andrew Branch 086e00de91
Expand auto-import to all package.json dependencies (#38923)
* Start experiment

* Add logging

* Go back to a single program

* Fix forEachExternalModuleToImportFrom

* Move auxiliary program to language service

* Add logging

* Don’t use resolution cache

* Fix(?) containingProjects for ScriptInfo in auxiliary program

* Fix ScriptInfo project inclusion

* Add test for default project of auto-importable ScriptInfo

* Add fourslash server test

* Don’t create auto import provider inside node_modules

* Add monorepo-like test

* WIP

* Naively ensure autoImportProvider is up to date after package.json change

* Start limiting when auto update provider gets updated

* Respond to changes in node_modules

* Don’t create auto-import provider until a file is open that would use it

e.g., don’t create them during cross-project find-all-refs

* Clean up naming, @internal marking, and fix empty project creation bug

* Drop devDependencies, include peerDependencies

* Add additional compiler options

* Fix interaction with importSuggestionsCache

* Move option to UserPreferences, allow inclusion of devDependencies

* Don’t filter out peerDependencies

* Watch unparseable package.jsons

* But don’t filter packages out due to an invalid package.json

* Update test

* Don’t use autoImportProvider in codefixes where it can never be used (or any refactors)

* Add CompletionEntry property for telemetry

* Add assertion for isPackageJsonImport to fourslash

* Fix missing pushSymbol argument

* Add isPackageJsonImport to tests and API baselines

* Fix unit test

* Host auto import provider in new Project kind

* Fix InferredProject attaching on AutoImportProvider-included files, load eagerly

* Update Public APIs

* Simplify PackageJsonCache host

* Remove unneeded markAsDirty

* Defer project finished event until after AutoImportProvider is created

* Make AutoImportProviderProject always report isOrphan = true

* Close and remove AutoImportProviderProject when host project closes

* Don’t set pendingEnsureProjectForOpenFiles

* Use hasAddedOrRemovedFiles instead of hasNewProgram

* Use host-wide watchOptions for package.json watching

* Add to `printProjects`

* Clean up

* Get autoImportProvider directly from LanguageServiceHost

* Clean up

* Clean up

* Close auto import provider on disableLanguageService

* Move AutoImportProvider preload to project updateGraph

* Clear auto import suggestion cache when provider program changes

* Fix tests

* Revert yet-unneeded change

* Use projectService host for module resolution host

* Don’t re-resolve type directives if nothing has changed

* Update src/server/project.ts

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>

* Use ts.emptyArray

Co-authored-by: Sheetal Nandi <shkamat@microsoft.com>
2020-06-22 16:34:27 -07:00