Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish applying no-object-literal-type-assertion lint rule #18218

Closed
wants to merge 7 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 1, 2017

Continuation of #17278.
Applies the rule wherever possible and adds comments referencing #18217 at all fishy code.

@ghost ghost force-pushed the no-object-literal-type-assertion-2 branch from 7553b3b to 8745182 Compare September 2, 2017 00:03
@ghost ghost requested a review from sheetalkamat September 29, 2017 20:40
@ghost
Copy link
Author

ghost commented Oct 30, 2017

@sheetalkamat

@ghost ghost force-pushed the no-object-literal-type-assertion-2 branch from d2b5e35 to 6ccb5e7 Compare November 1, 2017 15:54
projectName: req.projectName
});
projectName: req.projectName,
// TODO: GH#18217 (property was not present)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this a problem?

Copy link
Author

@ghost ghost Nov 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just wondering if maybe it should be present. We never declared this property to be optional.

@@ -1215,6 +1215,7 @@ namespace ts.server {

// Provide global: true so plugins can detect why they can't find their config
this.projectService.logger.info(`Loading global plugin ${globalPluginName}`);
// tslint:disable-next-line no-object-literal-type-assertion (TODO: GH#18217)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we should change the interface definition here instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the fact that the interface doesn't declare it would imply that we're not using the property?

@@ -1328,6 +1328,7 @@ namespace ts.server {

const result = parseJsonText(configFilename, configFileContent);
if (!result.endOfFileToken) {
// tslint:disable-next-line no-object-literal-type-assertion (TODO: GH#18217)
result.endOfFileToken = <EndOfFileToken>{ kind: SyntaxKind.EndOfFileToken };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we do this in the first place.. @sheetalkamat any ideas?

@@ -914,6 +914,7 @@ namespace ts {
*/
export function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): JsonSourceFile {
const textOrDiagnostic = tryReadFile(fileName, readFile);
// tslint:disable-next-line no-object-literal-type-assertion (TODO:GH#18217)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should change the return type for this function instead.

Copy link
Author

@ghost ghost Nov 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To { parseDiagnostics: Diagnostic[] }? That exposes errors in its uses because we seem to assume we get the full source file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with optional members for fileName and extendedSourceFiles.. not sure if we need other things as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that might end up touching many places though..

@typescript-bot
Copy link
Collaborator

Thanks for your contribution. This PR has not been updated in a while and cannot be automatically merged at the time being. For housekeeping purposes we are closing stale PRs. If you'd still like to continue working on this PR, please leave a message and one of the maintainers can reopen it.

@ghost ghost reopened this Nov 13, 2018
@ghost ghost force-pushed the no-object-literal-type-assertion-2 branch from 6da37ac to 5d86382 Compare November 13, 2018 18:37
@ghost ghost force-pushed the no-object-literal-type-assertion-2 branch from 5d86382 to 6de3bde Compare November 13, 2018 18:37
@ghost ghost assigned sheetalkamat Nov 16, 2018
@RyanCavanaugh
Copy link
Member

Some of these are OK but I feel like overall this is adding too many disables to look like a good fit

@RyanCavanaugh RyanCavanaugh deleted the no-object-literal-type-assertion-2 branch October 25, 2022 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants