1410 Commits

Author SHA1 Message Date
Andy
982c8d0af9
Add suggestion diagnostics for unused label and unreachable code (#24261)
* Add suggestion diagnostics for unused label and unreachable code

* Always error on unused left hand side of comma
2018-05-22 07:56:29 -07:00
Andy
802dc2bb9b
fixUnusedIdentifier: If every VariableDeclaration is unused, remove the VariableStatement (#24231) 2018-05-21 15:54:33 -07:00
Daniel Rosenwasser
3563a0576d Use single quotes around 'typeof' in message. 2018-05-18 23:44:38 -07:00
Andy
3eb66da155
Add code fix to remove unused label (#24037)
* Add code fix to remove unused label

* Test with trivia and fix indentation with dedented label
2018-05-18 15:25:24 -07:00
王文璐
5d233054c3 add quick fix for import type missing typeof 2018-05-17 16:35:20 +08:00
Andy
6ae4d3a516
Add code fix to remove unreachable code (#24028)
* Add code fix to remove unreachable code

* Code review

* Preserve more kinds of statements
2018-05-10 16:44:48 -07:00
Andy
7271ec1240
Add 'move to new file' refactor (#23726)
* Add 'move to new file' refactor

* Code review, and support commonjs

* Compute movedSymbols completely before using, and support `export import`

* Fix assertion error: sort empty change before non-empty change

* Remove extra newline

* Add allowTextChangesInNewFiles preference

* Add the new file to 'files' in tsconfig

* Avoid parameter initializer

* Update API baselines

* Use path relative to tsconfig.json

* Code review

* Fix error where node in tsconfig file was missing a source file
2018-05-10 11:17:04 -07:00
Mohamed Hegazy
9ea4d93823
Merge pull request #23957 from paulkoerbitz/16675-better-error-message-for-dynamic-import
Fix #16675: Better error message for dynamic import with ES2015 modules
2018-05-09 09:42:58 -07:00
Paul Koerbitz
89d2baede7 Adress review comments 2018-05-09 10:53:27 +02:00
Andy
5725428f2d
fixUnusedIdentifier: Handle destructure with all bindings unused (#23805)
* fixUnusedIdentifier: Handle destructure with all bindings unused

* Add parameters test

* Add test for 'for' loop
2018-05-08 13:33:55 -07:00
Paul Koerbitz
ba360cfc4f Make error message for dynamic imports when module is ES2015 more helpful 2018-05-08 07:45:48 +02:00
Ryan Cavanaugh
ffa0ccba2a Project References Core support 2018-05-07 15:12:50 -07:00
Sheetal Nandi
c4143ae0c1 Update the message for resolveJsonModule as per PR feedback 2018-05-04 11:14:39 -07:00
Sheetal Nandi
15f9ea3d14 Merge branch 'master' into requireJson 2018-05-03 15:35:54 -07:00
Andy
cee4289f58
Add code fix to convert 'require' in a '.ts' file to an 'import' (#23711)
* Add code fix to convert 'require' in a '.ts' file to an 'import'

* Only add suggestion for modules

* Revert "Only add suggestion for modules"

This reverts commit b1a728fdacacf7089e8995f6a5caddac27ef5e62.
2018-05-01 09:24:02 -07:00
Sheetal Nandi
579748bc2b Merge branch 'master' into requireJson 2018-04-30 11:44:09 -07:00
Daniel Rosenwasser
9672116d8c Merge remote-tracking branch 'origin/master' into importDotMeta 2018-04-25 22:21:56 -07:00
Andy
583bcea603
Always parse an argument for an ElementAccessExpression (#23683) 2018-04-25 10:08:35 -07:00
Andy
969aa45ea5
Improve error message for unused type (#23633) 2018-04-24 08:54:42 -07:00
Anders Hejlsberg
0179d97403
Merge pull request #23592 from Microsoft/improveIndexTypes
Support number and symbol named properties with keyof and mapped types
2018-04-23 13:22:56 -07:00
Andy
a7c08e4691
Make code fix to add 'this.' work for statics (#23527)
* Make code fix to add 'this.' work for statics

* Add 'C.' instead of 'this.'

* DanielRosenwasser code review
2018-04-19 15:39:44 -07:00
Josh Goldberg
9dff614bd2 Combined the "Found X error(s)" and "Compilation" complete --watch messages 2018-04-17 01:47:43 -07:00
Anders Hejlsberg
16cd5580a6 Merge branch 'master' into improveIndexTypes
# Conflicts:
#	src/compiler/checker.ts
#	src/server/utilities.ts
2018-04-16 16:18:29 -07:00
Sheetal Nandi
ce08af4dfe Merge branch 'master' into requireJson 2018-04-13 15:26:16 -07:00
Daniel Rosenwasser
56f4b2eea4 Provide an error when using 'import.meta' without setting 'esnext'. 2018-04-10 16:12:00 -07:00
Wenlu Wang
9c0671d661 add refactor of convert private field to getter and setter (#22143)
* add refactor of convert private field to getter and setter

* fix refactor

* stash

* refactor accessor generate

* revert merge union type

* refeactor and accept baseline

* add support of PropertyAssignment and StringLiteral

* add support for js file

* allow static modifier in js file
2018-04-10 11:51:41 -07:00
Andy
556a8010b9
Fix bug: ensure 'reportsUnnecessary' is actually sent by tsserver (#23293) 2018-04-10 10:15:15 -07:00
Anders Hejlsberg
ff20f38405 Add support for numbers and symbols in keyof (but keep it disabled) 2018-04-09 07:45:13 -10:00
Mohamed Hegazy
da312398f5
Merge pull request #23050 from gagoman/fix/22923
Fix issue #22923
2018-04-06 09:31:43 -07:00
Sheetal Nandi
a14396320b Resolve json modules only when --resolveJsonModule is specified 2018-04-05 15:37:13 -07:00
Alex Khomchenko
134b3411ee Fix issue #22923 2018-04-05 21:39:33 +02:00
Andy
24842b4002
When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors (#22361)
* When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors

* Improve performance: do not add unused suggestion diagnostics unless asking for a suggestion

* Add "unused" flag to diagnostics

* Code review

* reportsUnused -> reportsUnnecessary

* Fix test
2018-04-05 12:33:00 -07:00
Mohamed Hegazy
e2bd282414
Merge pull request #22254 from JoshuaKGoldberg/pretty-watch-error-summaries
Added an errors summary for --pretty --watch results
2018-04-04 16:08:31 -07:00
Wesley Wigham
414bc49cc4
Module or import types (#22592)
* Type side of import types

* Value side of import types

* Accept library changes

* Refined implementation, more tests

* Allow resolutions to be performed late if the resolution still results in a file already in the build

* Add another test case

* Add some jsdoc usages

* Allow nodebuilder to use import types where appropriate

* Parse & check generic instantiations

* use import types in nodebuilder for typeof module symbols

* Wire up go to definition for import types

* Accept updated type/symbol baselines now that symbols are wired in

* PR feedback

* Fix changes from merge

* Walk back late import handling

* Remove unused diagnostic

* Remove unrelated changes

* Use recursive function over loop

* Emit type arguments

* undo unrelated change

* Test for and support import type nodes in bundled declaration emit
2018-04-02 10:18:23 -07:00
Josh Goldberg
d268279c8e Merge branch 'master' into pretty-watch-error-summaries 2018-04-01 21:44:55 -07:00
Mohamed Hegazy
e3f02b5608
Merge pull request #22275 from delftswa2018/21617-detailed-error-forof-iterators
Fix #21617: Give detailed message on `for-of` of iterators without downlevelIteration
2018-03-29 15:43:00 -07:00
Andy
9d713b6db6
Error on rest parameter with trailing comma (#22262)
* Error on rest parameter with trailing comma

* Error on binding patterns and improve error location
2018-03-29 13:12:23 -07:00
Andy
a9aca81601
Error on for (const x in never) (#22988)
* Error on `for (const x in never)`

* Update diagnostic

* Provide argument to diagnostic
2018-03-29 11:39:30 -07:00
Andy
65659d7297
Don't allow to iterate over 'never' (#22964)
* Don't allow to iterate over 'never'

* Include type in error message
2018-03-29 10:01:21 -07:00
Andy
3e32e15895
Add 'fixAllDescription' property to CodeFixAction (#22616)
* Add 'fixAllDescription' property to CodeFixAction

* Code review

* Add to protocol

* Make fixAllDescription be just a string
2018-03-27 18:21:21 -07:00
Wesley Wigham
6af764c560
Declaration maps and transparent goto definition using them (#22658)
* Add compiler option to enable declaration sourcemaps

* Transparent goto definition for sourcemapped declaration files

* Post-rebase touchups

* Rename API methods

* Fix lints

* Fix typo in name XD

* Log sourcemap decode errors

* Share the cache more, but also invalidate it more

* Remove todo

* Enable mapping on go to implementation as well

* Allow fourslash to test declaration maps mroe easily

* more test

* Handle sourceRoot

* Add tests documenting current behavior with other sourcemapping flags

* Ignore inline options for declaration file maps, simplify dispatch in emitter

* Change program diagnostic

* Fix nit

* Use charCodeAt

* Rename internal methods + veriables

* Avoid filter

* span -> position

* Use character codes

* Dont parse our sourcemap names until we need to start using them

* zero-index parsed positions

* Handle sourceMappingURL comments, including base64 encoded ones

* Unittest b64 decoder, make mroe robust to handle unicode properly

* Fix lint

* declarationMaps -> declarationMap

* Even more feedback

* USE Mroe lenient combined regexp

* only match base64 characters

* Fix nit
2018-03-26 12:15:34 -07:00
Nathan Shively-Sanders
3728ec353a
Improve unmatched jsdoc param error (#22577)
* Improve unmatched jsdoc parameter error message

* Remove extraneous carriage return
2018-03-14 12:36:01 -07:00
Nathan Shively-Sanders
677d860b44
No error on unmatchable @param tags (#22510)
* No errr on unmatchable `@param` tags

Such as when the initializer is not a function, or when the function
mentions `arguments` in its body.

* Do not require dummy param for JS uses of arguments

1. JS functions that use `arguments` do not require a dummy parameter in
order to get a type for the synthetic `args` parameter if there is an
`@param` with a `...` type.
2.JS functions that use `arguments` and have an `@param` must have a
type that is a `...` type.

* Check for array type instead of syntactic `...`

* Address PR comments

* Update baselines
2018-03-14 10:17:54 -07:00
Josh Goldberg
c5d2bb6367 Merge branch 'master' into pretty-watch-error-summaries
# Conflicts:
#	src/compiler/diagnosticMessages.json
#	src/compiler/watch.ts
2018-03-09 09:37:26 -08:00
Josh Goldberg
9cf5538763 Simplified error message counts; internalized reporting to createWatchCompilerHost
Instead of modifying the logic in both `tsc.ts`to `watch.ts` by splitting `emitFilesAndReportErrors` in two, this adds an optional function parameter to report them.
Removes file counting for diagnostic messages, as they might not be coming from files.

Next commit will include tests.
2018-03-08 20:47:45 -08:00
Andy
1f7a5097fa
When every import is unused, error on the entire import declaration (#22386)
* When every import is unused, error on the entire import declaration

* Code review

* Store key in map value
2018-03-07 14:42:09 -08:00
Andy
e5f91f5948
Convert annotateWithTypeFromJSDoc refactor to a codefix (#22336)
* Convert annotateWithTypeFromJSDoc refactor to a codefix

* Compute isJsFile once at top
2018-03-06 07:49:21 -08:00
Andy
2ac2291b84
Convert use-default-import refactor to a codefix (#22334) 2018-03-05 12:43:01 -08:00
Andy
87c3cca3f0
Make convertFunctionToEs6Class a codefix (#22241)
* Make convertFunctionToEs6Class a codefix

* Change diagnostic message
2018-03-02 12:57:29 -08:00
Wenlu Wang
b15157356a add spelling suggestion support for module import (#22283) 2018-03-02 10:24:55 -08:00