Skip to content

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

Closed
ghost wants to merge 7 commits into
masterfrom
no-object-literal-type-assertion-2
Closed

Finish applying no-object-literal-type-assertion lint rule#18218
ghost wants to merge 7 commits into
masterfrom
no-object-literal-type-assertion-2

Conversation

@ghost

@ghost ghost commented Sep 1, 2017

Copy link
Copy Markdown

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

ghost commented Oct 30, 2017

Copy link
Copy Markdown
Author

@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
Copy Markdown
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?

@ghost ghost Nov 3, 2017

Copy link
Copy Markdown
Author

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.

Comment thread src/server/project.ts Outdated

// 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
Copy Markdown
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
Copy Markdown
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?

Comment thread src/server/editorServices.ts Outdated
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
Copy Markdown
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?

*/
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
Copy Markdown
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.

@ghost ghost Nov 3, 2017

Copy link
Copy Markdown
Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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
Copy Markdown
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
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
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.

6 participants