Commit graph

409 commits

Author SHA1 Message Date
BigAru ad0614abea extract getEdits for string concatenation 2019-03-24 16:52:25 +01:00
BigAru 08ed6cf8bd optimize nodesToTemplate 2019-03-24 16:52:25 +01:00
BigAru 6721966504 extract creation of templateHead 2019-03-24 16:52:25 +01:00
BigAru cba0ddcbde only show toString if expression is not binary 2019-03-24 16:52:24 +01:00
BigAru 1594468250 add possibility to invoke from parentheses 2019-03-24 16:52:24 +01:00
BigAru 74e3cd758e remove parentheses also when expression at ending 2019-03-24 16:52:24 +01:00
BigAru 7d9e8f4e21 treat corner cases 2019-03-24 16:52:24 +01:00
BigAru 882e616009 optimize preceding expression 2019-03-24 16:52:24 +01:00
BigAru 6de23d766a do not offer refactoring for tagged templates 2019-03-24 16:52:24 +01:00
BigAru 6fe4663d92 combine preceding expressions to one 2019-03-24 16:52:24 +01:00
BigAru 3b284886b1 add toString visibility from expression and from middle part 2019-03-24 16:52:23 +01:00
BigAru 576271ef55 catch empty head of template literal 2019-03-24 16:52:23 +01:00
BigAru 2b299943f9 complete toString 2019-03-24 16:52:23 +01:00
BigAru fc13b2b43a add test cases 2019-03-24 16:52:23 +01:00
BigAru b84f95dc5d add working conversion to template literal 2019-03-24 16:52:23 +01:00
BigAru 03f0f88101 add diagnostic messages 2019-03-24 16:52:23 +01:00
BigAru 2db0745b64 add skeleton 2019-03-24 16:51:22 +01:00
Gabriela Araujo Britto 0f6f3b79b5
Fix find all references of inherited constructor (#30514)
* recursively look for inherited constructor references

* add test

* remove outdated comment

* add tests

* move function

* improve tests

* minor refactor

* fix convert params refactoring to deal with inherited constructor calls

* simplify refactor test
2019-03-22 15:17:50 -07:00
Gabriela Araujo Britto 84087d0e0a
Use shorthand property assignment in convert parameters to object (#30468)
* create shorthand property assignment in argument object when possible

* add shorthand property assignment test

* don't offer refactor on jsdoc comment

* add jsdoc test

* improve jsdoc test

* use crlf
2019-03-19 09:28:09 -07:00
Gabriela Britto 10b9051624
Fix convert to named parameters rest parameter tuple (#30286)
* check if rest parameter is of tuple type in isOptionalParameter

* expose isArrayType and isTupleType in checker

* don't offer refactor if rest parameter type is neither array nor tuple type

* add tests for rest parameters

* fix tests for renamed refactor

* remove unnecessary conditional operator
2019-03-18 10:31:38 -07:00
Gabriela Britto 1c8a359914
rename convert to named parameters (#30401) 2019-03-14 13:41:29 -07:00
Gabriela Araujo Britto 60b2d6a2f5 remove unnecessary closures 2019-03-05 16:56:30 -08:00
Gabriela Araujo Britto 98a146dcfc use getTouchingToken 2019-03-01 13:23:59 -08:00
Gabriela Araujo Britto cd060e75fe use interface for ValidVariableDeclaration 2019-03-01 09:17:44 -08:00
Gabriela Araujo Britto 1f91aa1c9b remove inlineable 2019-02-28 16:55:40 -08:00
Gabriela Araujo Britto 617d5af67e add diagnostics message for refactor description 2019-02-28 11:22:05 -08:00
Gabriela Araujo Britto 51616a4043 use sortAndDeduplicate instead of deduplicate 2019-02-28 09:50:57 -08:00
Gabriela Araujo Britto 7fd6868f8b minor refactors to convertToNamedParameters 2019-02-27 16:42:54 -08:00
Gabriela Araujo Britto 54c7996ff5 refactor getGroupReferences 2019-02-27 16:19:01 -08:00
Gabriela Araujo Britto e3a465ffa3 change startPosition and endPosition to leadingTriviaOption and trailingTriviaOption 2019-02-26 09:43:35 -08:00
Gabriela Araujo Britto ce42aa43a8 check usages of class if refactoring a constructor 2019-02-22 16:31:40 -08:00
Gabriela Araujo Britto e40442d46a minor refactors 2019-02-20 11:13:04 -08:00
Gabriela Araujo Britto 78968b1281 don't provide refactor in js file 2019-02-19 09:10:27 -08:00
Gabriela Araujo Britto a773046181 copy argument comments to property 2019-02-15 16:48:54 -08:00
Gabriela Araujo Britto b6c8382c78 replace argument list instead of whole call when refactoring 2019-02-15 15:51:20 -08:00
Gabriela Araujo Britto eef3da5b6b create new ConfigurableStart and ConfigurableEnd options and rename them 2019-02-15 15:38:10 -08:00
Gabriela Araujo Britto 05e9d6c9de fix reference checking 2019-02-13 15:34:18 -08:00
Gabriela Araujo Britto ec0e734708 return function expression name in getFunctionDeclarationNames 2019-02-13 11:36:59 -08:00
Gabriela Araujo Britto ef4db31e84 don't apply changes when unexpected reference is found 2019-02-13 11:35:44 -08:00
Gabriela Araujo Britto dbd84996aa don't apply refactor when parameter has decorators 2019-02-11 14:24:05 -08:00
Gabriela Araujo Britto dba631de80 copy comments when refactoring 2019-02-11 12:02:51 -08:00
Gabriela Araujo Britto 26f8ddd46a create functions for copying trailing comments and rename previous copyComment function 2019-02-11 12:01:02 -08:00
Gabriela Britto 7d86fda151 fix hasThisParameter to check for parameters length 2019-02-06 16:06:46 -08:00
Gabriela Britto b87392c22c fix duplication of leading and trailing comments on refactored function 2019-02-06 15:40:58 -08:00
Gabriela Britto 674800f25e implement refactor for functions with a rest parameter 2019-02-04 12:52:27 -08:00
Gabriela Britto bde97d1226 fix refactor to find super references 2019-02-01 16:43:44 -08:00
Gabriela Britto bf25ba4650 Don't refactor if variable declaration has type annotation 2019-02-01 13:09:53 -08:00
Gabriela Britto 1d94322ea0 preserve this parameter when refactoring 2019-01-29 16:44:30 -08:00
Gabriela Britto 9e62eb9fb4 Merge branch 'master' into convert-to-named-parameters 2019-01-28 16:00:47 -08:00
Gabriela Britto 3243b4b4f2 Refactor direct function calls 2019-01-28 15:52:44 -08:00
BigAru 5ec1201e3a exclude nested functions and classes at containingThis check 2019-01-23 19:36:00 +01:00
BigAru dbd58599f4 do not provide refactoring when it contains this
because this behaves differently in arrow than in function
2019-01-22 05:42:01 +01:00
BigAru 52e94d2b80 Merge remote-tracking branch 'upstream/master' into m-lambda-to-fn 2019-01-22 05:10:32 +01:00
Gabriela Britto 919ed79f3a implement new parameter creation 2019-01-18 16:49:11 -08:00
Andrew Casey 3e256e14dc Add fourslash tests 2019-01-16 19:18:25 -08:00
Andrew Casey 7102de77d3 Consider JSX namespace imports when moving statements between files
Each of the old and new files should end up with a JSX namespace import
iff it contains JSX.

Fixes #27939
2019-01-16 18:55:27 -08:00
Gabriela Britto 705ac60a59 WIP 2019-01-16 15:49:09 -08:00
Gabriela Britto 9aeeae54b0 create refactoring for converting to named parameters 2019-01-15 16:56:53 -08:00
Wesley Wigham 4f7184a587
Fix all new lint failures (#29080) 2018-12-18 11:34:02 -08:00
Andy Hanson 643678bb54 generateGetAccessorAndSetAccessor: Don't use FindAllReferences 2018-11-14 15:05:46 -08:00
Sheetal Nandi d569743640
Merge pull request #28194 from iliashkolyar/add_missing_apostrophe_in_codefix
Add missing apostrophe to codefix suggestion
2018-11-12 09:31:24 -08:00
Andy e335a360c8
Change 'if' in combined switch case to two separate cases (#28444) 2018-11-09 12:48:47 -08:00
BigAru dfb86acbb9 check if functionExpression name is used 2018-11-08 05:51:53 +01:00
BigAru 9a466f4e9c update getAvailableActions 2018-11-07 13:57:50 +01:00
BigAru 5dfc71c14a Merge remote-tracking branch 'upstream/master' into m-lambda-to-fn 2018-11-07 13:47:26 +01:00
BigAru dc81a7f668 apply feedback from pr 2018-11-07 10:49:59 +01:00
BigAru 739e1e9786 fix for unnecessary duplication of comment 2018-11-07 08:49:50 +01:00
Andy afbf89e3b3
Refactors can return ReadonlyArray<ApplicableRefactorInfo> (#28305)
* Refactors can return ReadonlyArray<ApplicableRefactorInfo>

* Remove unnecessary type assertions
2018-11-02 10:07:21 -07:00
Giovanni Heilmann 8bc7f43665 Make conditions more expressive 2018-10-31 14:27:36 +01:00
BigAru d97e07360c apply feedback from pr 2018-10-31 14:27:36 +01:00
BigAru 595131868f add testcase and apply feedback from pr 2018-10-31 14:27:36 +01:00
BigAru 649b53c8de apply feedback from pr 2018-10-31 14:27:36 +01:00
BigAru 3e7dcad726 make guideline compliant 2018-10-31 14:27:36 +01:00
BigAru 6bd26cd2e5 extract creation of funcDeclaration 2018-10-31 14:27:36 +01:00
BigAru a9cb623795 extract creation of block 2018-10-31 14:27:36 +01:00
BigAru 39c3928e5d refactor small progress 2018-10-31 14:27:36 +01:00
BigAru 6922f6c4ca refactor getInfo getAvailableActions 2018-10-31 14:27:36 +01:00
BigAru 7c78cd5c6f fix for tslint error 2018-10-31 14:27:36 +01:00
BigAru 62b9fccb98 fix bug modifiers by toNamed 2018-10-31 14:27:36 +01:00
BigAru e697856a7d change refactor name 2018-10-31 14:27:36 +01:00
BigAru 367f47e755 fix multi decl bug 2018-10-31 14:27:36 +01:00
BigAru 4c80de9078 add multi vardecl 2018-10-31 14:27:36 +01:00
BigAru f558f2f6cd add working getEditsForAction 2018-10-31 14:27:36 +01:00
BigAru 6cfbee7f30 add getAvailableActions 2018-10-31 14:27:36 +01:00
BigAru 8cb019d793 add skeleton 2018-10-31 14:27:36 +01:00
iliashkolyar 583dbc571e Add missing apostrophe to codefix suggestion 2018-10-28 23:18:19 +02:00
Andy d3d4f83f89
Remove hack to get target of GetAccessor symbol (#27868)
* Remove hack to get target of GetAccessor symbol

* Add tests and get moveToNewFile to work with binding patterns
2018-10-22 11:44:06 -07:00
Andy 0a97663843
Add 'prefixText' and 'suffixText' when renaming shorthand properties (#27356)
* Add 'prefixText' and 'suffixText' when renaming shorthand properties

* Make prefixText and suffixText missing instead of undefined

* Fix test
2018-09-26 16:58:01 -07:00
Nathan Shively-Sanders 6bd1da20c9
Rename JS-specific concepts (#26795)
* Rename JS concepts

1. Assignment declaration -- an assignment that is treated like a
declaration. Previously called [JS] special (assignment|declaration),
among other things.
2. Expando -- a value that can be used as a target in assignment
declarations. Currently, a class, function or empty object literal.
Functions are allowed in Typescript, too. Previously called a JS
container, JS initializer or expando object.
3. JavaScript -> Javascript. This is annoying to type, and looks like
'Java Script' in a camelCase world.

Everything is a pure rename as far as I know. The only test change is
the API baselines, which reflect the rename from SymbolFlags.JSContainer
to SymbolFlags.Assignment.

* Remove TODO

* Rename Javascript->JS

Note that this introduces a variable name collision in a couple of
places, which I resolved like this:

```ts
const isInJavascript = isInJSFile(node);
```
2018-09-12 10:44:46 -07:00
Andy 1a05f13aef
moveToNewFile: Don't remove empty named imports (#26265) 2018-08-07 12:54:46 -07:00
Andy d40d54984e
Support deleting all unused type parameters in a list, and deleting @template tag (#25748)
* Support deleting all unused type parameters in a list, and deleting @template tag

* Support type parameter in 'infer'
2018-07-27 11:55:31 -07:00
Andy 5f4a03c408
Ensure TypeChecker#getTypeAtLocation returns a defined result (#25583)
* Ensure TypeChecker#getTypeAtLocation returns a defined result

* Update additional baseline
2018-07-11 16:33:56 -07:00
Andy ded446573a
ChangeTracker: Combine deleteDeclaration, deleteNode, and deleteNodeInList (#25276)
* ChangeTracker: Combine deleteDeclaration, deleteNode, and deleteNodeInList

* Change name

* Update API (#24966)
2018-06-29 19:53:32 -07:00
Andy 13bc46d970
getTokenAtPosition: default includeJsDocComment to true (#25015)
* getTokenAtPosition: default includeJsDocComment to true

* Update API (#24966)

* Flip meaning of parameter

* Update API (#24966)

* Remove all `ignoreJsDocComment` uses (fixes #25162)
2018-06-26 16:20:44 -07:00
Andy 0b5b7ef547
Fix removal of default import (#25200) 2018-06-25 12:41:32 -07:00
Andy 806a661be3
Add refactor to convert named to default export and back (#24878)
* Add refactor to convert named to default export and back

* Support ambient module

* Handle declaration kinds that can't be default-exported

* Update API (#24966)
2018-06-25 10:34:24 -07:00
Andy 7f553f4f93
refactorConvertToGetAccessAndSetAccess: Don't trigger on leading trivia (#25054)
* refactorConvertToGetAccessAndSetAccess: Don't trigger on leading trivia

* Update API (#24966)
2018-06-19 13:46:03 -07:00
Andy 4a7a550502
moveToNewFile: Reuse code from importFixes for inserting import (#24957)
* moveToNewFile: Reuse code from importFixes for inserting import

* Fix test failures

* Update API baselines (#24966)
2018-06-14 15:41:47 -07:00
kingwl 0d730c008a Merge branch 'master' into add-braces 2018-06-09 01:32:53 +08:00
Andy 0fefaf286d
moveToNewFile: Infer quote preference (#24652) 2018-06-07 12:10:48 -07:00
Andy d8cea359f7
moveToNewFile: Update namespace imports (#24612) 2018-06-04 11:30:14 -07:00
Andy 046c5ea6c1
moveToNewFile: Ignore reference to global (#24651) 2018-06-04 10:35:23 -07:00
Andy 2cb46407b1
moveToNewFile: Remove newlines after last moved statement (#24503) 2018-05-30 15:16:03 -07:00
Andy 43bf039a94
Add refactor to convert namespace to named imports and back (#24469)
* Add refactor to convert namespace to named imports and back

* Add tests and comments

* Code review

* Handle shorthand property assignment and re-export

* Don't use forEachFreeIdentifier

* Fix rename after "."
2018-05-30 14:11:53 -07:00
王文璐 590476bf06 add more test and fix others 2018-05-25 10:25:52 +08:00
Andy bc570cd85f
moveToNewFile: Respect UserPreferences#quote (#24365) 2018-05-24 09:36:37 -07:00
王文璐 d470f32d8a Merge branch 'master' into add-braces 2018-05-24 18:03:02 +08:00
Wenlu Wang 4606709672 add code fix convert to mapped object type (#24286)
* add code fix convert to mapped object type

* add support for type literal and improve test

* fix typo

* add support for heritageClauses

* only determine declaration is not class
2018-05-23 14:09:49 -07:00
王文璐 de75f14d2b fix void return statement 2018-05-23 10:49:57 +08:00
王文璐 1a59eb3949 update body only 2018-05-23 10:22:17 +08:00
王文璐 0c06126d60 fix converter 2018-05-23 10:22:17 +08:00
王文璐 bd9a8b5c0c stash 2018-05-23 10:20:03 +08:00
王文璐 32be0c7099 add tests and fix 2018-05-23 10:19:08 +08:00
王文璐 5a69d9c255 add support for add or remove braces to arrow function 2018-05-23 10:16:59 +08:00
Andy ba63f49513
moveToNewFile: Don't provide refactor if selection is just imports (#24336) 2018-05-22 15:21:04 -07:00
Andy e53e56cf82
Enable '--strictNullChecks' (#22088)
* Enable '--strictNullChecks'

* Fix API baselines

* Make sys.getEnvironmentVariable non-nullable

* make properties optional instead of using `| undefined` in thier type

* reportDiagnostics should be required

* Declare firstAccessor as non-nullable

* Make `some` a type guard

* Fix `getEnvironmentVariable` definition in tests

* Pretend transformFlags are always defined

* Fix one more use of sys.getEnvironmentVariable

* `requiredResponse` accepts undefined, remove assertions

* Mark optional properties as optional instead of using `| undefined`

* Mark optional properties as optional instead of using ` | undefined`

* Remove unnecessary null assertions

* Put the bang on the declaration instead of every use

* Make `createMapFromTemplate` require a parameter

* Mark `EmitResult.emittedFiles` and `EmitResult.sourceMaps` as optional

* Plumb through undefined in emitLsit and EmitExpressionList

* `ElementAccessExpression.argumentExpression` can not be `undefined`

* Add overloads for `writeTokenText`

* Make `shouldWriteSeparatingLineTerminator` argument non-nullable

* Make `synthesizedNodeStartsOnNewLine` argument required

* `PropertyAssignment.initializer` cannot be undefined

* Use one `!` at declaration site instead of on every use site

* Capture host in a constant and avoid null assertions

* Remove few more unused assertions

* Update baselines

* Use parameter defaults

* Update baselines

* Fix lint

* Make Symbol#valueDeclaration and Symbol#declarations non-optional to reduce assertions

* Make Node#symbol and Type#symbol non-optional to reduce assertions

* Make `flags` non-nullable to reduce assertions

* Convert some asserts to type guards

* Make `isNonLocalAlias` a type guard

* Add overload for `getSymbolOfNode` for `Declaration`

* Some more `getSymbolOfNode` changes

* Push undefined suppression into `typeToTypeNodeHelper`

* `NodeBuilderContext.tracker` is never `undefined`

* use `Debug.assertDefined`

* Remove unnecessary tag

* Mark `LiteralType.freshType` and `LiteralTupe.regularType` as required
2018-05-22 14:46:57 -07:00
Andy 5622bc2dd6
moveToNewFile: Support selecting the name of a declaration (#24331) 2018-05-22 14:00:29 -07:00
Andy c09cc70ebe
Fix bug: VariableDeclaration initializer may be undefined (#24256) 2018-05-21 07:58:33 -07:00
Andy 76573c6520
getEffectiveTypeParameterDeclarations: Always return a defined result (#24251) 2018-05-18 10:17:35 -07:00
Mohamed Hegazy 8c2ed976a5
Merge pull request #24187 from Kingwl/disallow-in-function-like-initializer
disallow acesssor generate in function like initializer
2018-05-17 19:41:01 -07:00
王文璐 45c06cfd11 only allow refactor if selected span overlaps name declaration 2018-05-18 10:07:45 +08:00
Andy d579793d0a
moveToNewFile: Fix bug for missing importClause (#24224) 2018-05-17 14:32:12 -07:00
Andy 09b9ec43e3
moveToNewFile: Fix bug for VariableDeclaration missing initializer (#24214) 2018-05-17 12:38:20 -07:00
Andy 176e35b9c3
moveToNewFile: Don't move imports (#24177) 2018-05-17 09:54:47 -07:00
Nathan Shively-Sanders aa7e2b0f07
Add callback tag, with type parameters (#23947)
* Add initial tests

* Add types

* Half of parsing (builds but does not pass tests)

* Parsing done; types are uglier; doesn't crash but doesn't pass

* Bind callback tag

Builds but tests still don't pass

* Only bind param tags inside callback tags

* Fix binding switch to only handle param tags once

* Checking is 1/3 done or so.

Now I'm going to go rename some members to be more uniform. I hate
unnnecessary conditionals.

* Rename typeExpression to type (for some jsdoc)

(maybe I'll rename more later)

* Rename the rest of typeExpressions

Turns out there is a constraint in services such that they all need to
be named the same.

* Few more checker changes

* Revert "Rename the rest of typeExpressions"

This reverts commit f41a96b24d.

* Revert "Rename typeExpression to type (for some jsdoc)"

This reverts commit 7d2233a00e.

* Finish undoing typeExpression rename

* Rename and improve getTypeParametersForAliasSymbol

Plus some other small fixes

* Core checking works, but is flabbergastingly messy

I'm serious.

* Callback return types work now

* Fix crash in services

* Make github diff smaller

* Try to make github diff even smaller

* Fix rename for callback tag

* Fix nav bar for callback tag

Also clean up some now-redundant code there to find the name of typedefs.

* Handle ooorder callback tags

Also get rid of redundant typedef name code *in the binder*. It's
everywhere!

* Add ooorder callback tag test

* Parse comments for typedef/callback+display param comments

* Always export callbacks

This requires almost no new code since it is basically the same as
typedefs

* Update baselines

* Fix support for nested namespaced callbacks

And add test

* Callbacks support type parameters

1. Haven't run it with all tests
2. Haven't tested typedef tags yet
3. Still allows shared symbols when on function or class declarations.

* Template tags are now bound correctly

* Test oorder template tags

It works.

* Parser cleanup

* Cleanup types and utilities

As much as possible, and not as much as I would like.

* Handle callback more often in services

* Cleanup of binder and checker

* More checker cleanup

* Remove TODOs and one more cleanup

* Support parameter-less callback tags

* Remove extra bind call on template type parameters

* Bind template tag containers

Doesn't quite work with typedefs, but that's because it's now stricter,
without the typedef fixes. I'm going to merge with jsdoc/callback and
see how it goes.

* Fix fourslash failures

* Stop pre-binding js type aliases

Next up, stop pre-binding js type parameters

* Further cleanup of delayed js type alias binding

* Stop prebinding template tags too

This gets rid of prebinding entirely

* Remove TODO

* Fix lint

* Finish merge with use-jsdoc-aliases

* Update callback tag baselines

* Rename getTypeParametersForAliasSymbol

The real fix is *probably* to rename Type.aliasTypeArguments to
aliasTypeParameters, but I want to make sure and then put it in a
separate PR.
2018-05-17 09:28:11 -07:00
王文璐 755b443b6d disallow acesssor generate in function like initializer 2018-05-17 10:18:20 +08:00
Mohamed Hegazy 13ac88647f
Merge pull request #24162 from Kingwl/fix-generate-accessor-starting-underscore
fix generate accessor if starting with underscore
2018-05-16 12:06:15 -07:00
王文璐 b7f725d1b8 fix generate accessor if starting with underscore 2018-05-16 15:34:11 +08:00
王文璐 0fde07f1c5 fix trailing comma in accessor generator 2018-05-16 14:47:44 +08: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
kingwl 44d10dcf59 fix incorrect find reference pos 2018-05-11 01:49:40 +08:00
王文璐 340e8cd56a find reference at begin of constructor 2018-05-10 11:20:07 +08:00
王文璐 8414a962ba update all reference in constructor 2018-05-09 18:41:46 +08:00
王文璐 88bf9277ff add support for readonly modifier 2018-05-08 12:26:34 +08:00
Andy a05feed839
generateGetAccessorAndSetAccessor: Preserve a parameter property declaration (#23318) 2018-05-07 11:33:00 -07:00
Andy cae464058a
Delete "delete me" files (#23446) 2018-04-16 15:29:02 -07:00
Andy cc6bc763bc
Simplify getConvertibleFieldAtPosition (#23315) 2018-04-16 09:30:10 -07:00
Ryan Cavanaugh ff60520460 Merge branch 'master' into referencesDogfood_1 2018-04-12 12:26:10 -07:00
Andy 05c746b547
generateGetAccessorAndSetAccessor: Share modifier-creating code (#23311) 2018-04-12 11:13:25 -07:00
Ryan Cavanaugh df95de3231 Merge branch 'master' into referencesDogfood_1 2018-04-11 16:17:38 -07:00
Ryan Cavanaugh 9a5a5b10a3 Remove all reference comments from services 2018-04-11 15:39:12 -07:00
Andy fef28665f7
generateGetAccessorAndSetAccessor: Fix typos and use type predicate (#23310) 2018-04-11 13:21:47 -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 1e227c6d77
Add type predicate helper functions to Type (#23066) 2018-04-04 08:10:09 -07:00
Andy ea6740fa91
replaceNode: Always use non-adjusted end (#22519)
* replaceNode: Always use non-adjusted end

* Never adjust start position either

* Fix excess property checks, remove unnecessary arguments

* Make 'insertText' and 'newLineCharacter' private

* Use replaceNode in one more place now that it doesn't affect comments

* Update replaceNodeRange too

* Always ask for ChangeNodeOptions
2018-03-27 10:34:16 -07: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
Josh Goldberg 7826b38426 Apply 'no-unnecessary-initializer' lint rule (#22014)
* Apply 'no-unnecessary-initializer' lint rule

Forbids `let`/`const` statements to be initialized to `undefined`, since that's the initial value by default anyway.
The auto-fixer also happened to remove two unnecessary `as number` casts in `src/harness/parallel/worker.ts`.

For historical data: to run with `--fix`, I modified the line in `Jakefile.js` that declared the `cmd` for running TSLint.

* Moved worker.ts type assertions to parameters
2018-03-06 07:30:40 -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
Andy 16fc256823
Convert 'installTypesForPackge' refactor to a suggestion (#22267)
* Convert 'installTypesForPackge' refactor to a suggestion

* Have checker collect a list of suggestion diagnostics instead of redoing work in calculateSuggestionDiagnostics

* Add comment

* Add diagnostic even with `--allowJs`
2018-03-01 14:41:55 -08:00