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

Enable no-invalid-this ESLint rule and pre-apply fixes #10279

Merged
merged 10 commits into from
Jul 14, 2022

Conversation

tylerbutler
Copy link
Member

From the documentation on the rule:

Under the strict mode, this keywords outside of classes or class-like objects might be undefined and raise a TypeError.

Disabled for tests and PropertyDDS projects.

@github-actions github-actions bot added the area: tests Tests to add, test infrastructure improvements, etc label May 13, 2022
@github-actions github-actions bot added the base: main PRs targeted against main branch label May 13, 2022
@Josmithr
Copy link
Contributor

For the packages in which we're disabling the new rule, should we leave comments about why / future work to re-enable?

@tylerbutler
Copy link
Member Author

For the packages in which we're disabling the new rule, should we leave comments about why / future work to re-enable?

Addressed in a separate PR: #10272 (comment)

@tylerbutler tylerbutler changed the title Enable no-invalid-this and pre-apply fixes Enable no-invalid-this ESLint rule and pre-apply fixes May 17, 2022
@tylerbutler tylerbutler marked this pull request as ready for review May 18, 2022 00:40
@tylerbutler tylerbutler requested review from a team as code owners May 18, 2022 00:40
Comment on lines 43 to 47
// eslint-disable-next-line @typescript-eslint/no-invalid-this
Object.defineProperty(this, "__fluidTestProvider", { get: () => provider });
});
// eslint-disable-next-line @typescript-eslint/no-invalid-this
tests.bind(this)((reset: boolean = true) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

@microsoft/fluid-cr-test Do you know whether these are bugs?

Copy link
Member

Choose a reason for hiding this comment

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

I have not fully understood how this works in all cases yet. But I know Mocha sets this to some context object in some cases/ways, and it appears in the parameter list (but I don't think callers pass it - this is the part I don't totally get). so I think someone could explain why this is correct. If this were not correct none (ish) of our tests would pass.

@tylerbutler tylerbutler merged commit 0760a20 into microsoft:main Jul 14, 2022
@tylerbutler tylerbutler deleted the lint/no-invalid-this branch July 14, 2022 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants