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

Chore: Extract lint result cache logic (refs #9948) #10562

Merged
merged 8 commits into from
Jul 11, 2018

Conversation

platinumazure
Copy link
Member

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain: Extract lint result cache logic to its own utility module.

Motivation: This is preparation for a possible implementation of #9948, which might require that the object we cache for linted files will no longer have a 1-to-1 correspondence with the lint result object.

What changes did you make? (Give an overview)

Extracted cache logic for linting results (only) into its own file. The behavior should be unchanged.

Is there anything you'd like reviewers to focus on?

I'm not happy with the way I've set up mocks etc. in the tests. It's not immediately obvious to future contributors why some setups are in an inner beforeEach vs an outer or middle before and why more of the setups couldn't be closer together, but I couldn't figure out a great way to improve upon what I currently have. Any tips for making those more organized/easier to read (possibly with a different library)?

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jul 4, 2018
@platinumazure platinumazure added cli Relates to ESLint's command-line interface evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion chore This change is not user-facing accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jul 4, 2018
Copy link
Member

@not-an-aardvark not-an-aardvark left a comment

Choose a reason for hiding this comment

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

This generally looks good, I left a few questions.

globInputPaths: false
});

// fakeSuccessResults = cliEngine.executeOnFiles([path.join(fixturePath, "test-no-errors.js")]).results[0];
Copy link
Member

Choose a reason for hiding this comment

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

Should this comment be removed?

fakeConfigHelper,
fakeErrorResults;

// let fakeSuccessResults;
Copy link
Member

Choose a reason for hiding this comment

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

Should this comment be removed?

return null;
}

// TODO (platinumazure): Hydrate any missing elements from results
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand the implications of this comment -- is there a correctness issue for missing elements?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, there's no correctness issue for now. This is a reference to where I would need to add code to implement the feature requested in #9984. I will remove this comment.

@platinumazure
Copy link
Member Author

I'll rebase and then push a commit to remove the comments called out in review. Thanks!

@platinumazure
Copy link
Member Author

@not-an-aardvark Friendly ping: Have I addressed your concerns?

@@ -0,0 +1 @@
console.log("Hello, world!");
Copy link
Member Author

Choose a reason for hiding this comment

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

I should remove this file.

@not-an-aardvark
Copy link
Member

Sorry about the delay -- I haven't had time to look at this again, but my concerns were relatively minor, so feel free to merge if you think you've addressed them.

@@ -434,6 +419,17 @@ class CLIEngine {
}

this.config = new Config(this.options, this.linter);

if (options.cache) {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Should this maybe be this.options.cache for consistency?

@platinumazure platinumazure added the do not merge This pull request should not be merged yet label Jul 11, 2018
@platinumazure
Copy link
Member Author

Adding "do not merge" to avoid early merge while I rebase, delete an unnecessary file, and implement suggestions provided in feedback.

@platinumazure platinumazure removed the request for review from not-an-aardvark July 11, 2018 22:28
@platinumazure platinumazure removed the do not merge This pull request should not be merged yet label Jul 11, 2018
@platinumazure
Copy link
Member Author

I've addressed all feedback and the Travis/Appveyor builds passed, so I'm going to merge. Thanks to everyone who reviewed for your feedback!

@platinumazure platinumazure merged commit 9aaf195 into master Jul 11, 2018
@platinumazure platinumazure deleted the lint-result-cache branch July 11, 2018 23:56
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jan 8, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jan 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing cli Relates to ESLint's command-line interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants