Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Simplify API #1720

Merged
merged 1 commit into from
Nov 15, 2016
Merged

Simplify API #1720

merged 1 commit into from
Nov 15, 2016

Conversation

nchen63
Copy link
Contributor

@nchen63 nchen63 commented Nov 14, 2016

  • Remove tslint.ts and interfaces associated with single file Linter
  • Rename tslintMulti.ts -> linter.ts
  • Rename lint.ts -> index.ts
  • Remove old ILinterOptions and rename IMultiLinterOptions ILinterOptions
  • Reference index.js/index.d.ts in package.json

Upgrade Instructions for 3rd party apps using the API

  • move the configuration property off of ILinterOptions and pass it into lint()
  • move filename and source from the constructor to lint()
  • you have to call Linter::getResult() to get the result instead of being returned from `lint()

fixes #1595

Rename tslintMulti.ts -> linter.ts
Rename lint.ts -> index.ts
Remove old ILinterOptions and rename IMultiLinterOptions ILinterOptions
Reference index.js/index.d.ts in package.json
@nchen63 nchen63 changed the title Remove tslint.ts and interfaces associated with Linter Simplify API Nov 14, 2016
@adidahiya
Copy link
Contributor

this looks good, but I forgot about @jkillian's comment here: #1595 (comment)

how much effort will be required for third-party tools to transition to using the new Linter class?

@nchen63
Copy link
Contributor Author

nchen63 commented Nov 15, 2016

It's pretty straightforward to migrate to the new Linter class. You can see the changes that I made to the test.ts class here: https://github.com/palantir/tslint/pull/1720/files#diff-c1e1ffc130aead13aa199b62448b178c

  • move the configuration property off of ILinterOptions and pass it into lint()
  • move filename and source from the constructor to lint()
  • you have to call Linter::getResult() to get the result instead of being returned from lint()

@nchen63
Copy link
Contributor Author

nchen63 commented Nov 15, 2016

I also made the new linter throw an error if configuration was included on the ILinterOptions object since not moving it would still work but use the default config

@nchen63 nchen63 added this to the TSLint v4.0 milestone Nov 15, 2016
@nchen63 nchen63 merged commit 63ce3bc into master Nov 15, 2016
@nchen63 nchen63 deleted the index-ts branch November 15, 2016 06:22
@panuhorsmalahti
Copy link
Contributor

I noticed that 'findConfiguration' API seems to have been changed a bit (or maybe the function which uses it's result). Anyway, I had to change my code to use the .results property of the return value of findConfiguration. Maybe this will help someone.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify typings for API consumers
3 participants