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

Support ESLint "--cache" option #168

Open
rondale-sc opened this issue Apr 3, 2017 · 14 comments
Open

Support ESLint "--cache" option #168

rondale-sc opened this issue Apr 3, 2017 · 14 comments

Comments

@rondale-sc
Copy link

Inspired by a talk at Emberconf I though it might be a good idea to enable eslint caching. I expected this to be a pretty simple config option in eslintrc.js or likewise, but it seems that it is a bit more complicated

I think we can likely accomplish this by merging options in the lintTree func and passing those all the way down to eslint

https://github.com/ember-cli/ember-cli-eslint/blob/master/index.js#L34

https://github.com/ember-cli/broccoli-lint-eslint/blob/master/lib/index.js#L41

https://github.com/ember-cli/broccoli-lint-eslint/blob/master/lib/index.js#L72

https://github.com/eslint/eslint/blob/master/lib/cli-engine.js#L638

I'd like to work on this, but I really wanted to get some feedback before diving in any further. Is this a good idea? Are there potential problems or incompatibilities that would prevent us from doing this?

@dbashford
Copy link

I also came here to look into this because of the EmberConf talk. Big 👍 from me.

@Turbo87 Turbo87 changed the title Support eslint options Support ESLint "--cache" option Apr 5, 2017
@Turbo87
Copy link
Member

Turbo87 commented Apr 5, 2017

@rondale-sc tl;dr this will require deep changes in the implementation of broccoli-lint-eslint.

right now broccoli-lint-eslint works roughly like Array.map() in that it reads all *.js files and creates corresponding *.lint-test.js files by running each file through ESLint. to make use of --cache we should probably run ESLint only once but on all *.js files which will likely require a change in the base class used by broccoli-lint-eslint.

@stefanpenner @rwjblue @hjdivad please correct me if I'm wrong

@hjdivad
Copy link

hjdivad commented Apr 5, 2017

What's the advantage of using eslint's --cache over the async caching from broccoli-persistent-filter?

@Turbo87
Copy link
Member

Turbo87 commented Apr 5, 2017

What's the advantage of using eslint's --cache over the async caching from broccoli-persistent-filter?

  1. currently when using ember serve ESLint is run once on startup and shows you all the existing linting issues on the console. once you fix an issue that file will be passed through to ESLint again, but none of the others since they haven't changed. that means that the remaining issues are also not printed to the console again. with eslint --cache the cached issues would be printed again.

  2. it appears that even though we use broccoli-persistent-filter ESLint is run on all files whenever you startup ember serve. which in the current case might be useful, because otherwise you won't actually see any console output since no files had changed between runs.

@stefanpenner
Copy link
Contributor

currently when using ember serve ESLint is run once on startup and shows you all the existing linting issues on the console. once you fix an issue that file will be passed through to ESLint again, but none of the others since they haven't changed. that means that the remaining issues are also not printed to the console again. with eslint --cache the cached issues would be printed again.

I thought we fixed this.

it appears that even though we use broccoli-persistent-filter ESLint is run on all files whenever you startup ember serve. which in the current case might be useful, because otherwise you won't actually see any console output since no files had changed between runs.

I believe it is intentional, and may the fix i thought fixed 1.

@stefanpenner
Copy link
Contributor

Experimenting with eslints own caching may be a good idea. I'm curious as to the downsides.

@rondale-sc
Copy link
Author

@Turbo87 So you think the changes need to occur in broccoli-lint-eslint then? If so, should I begin work there?

Also, I'm not entirely certain how to start with this. I suspect it will involve getting a broccoli pipeline in place and create a little repo that would facilitate easy testing? Would benchmarking be helpful?

@Turbo87
Copy link
Member

Turbo87 commented Apr 5, 2017

So you think the changes need to occur in broccoli-lint-eslint then? If so, should I begin work there?

ember-cli-eslint should just be a very thin wrapper around broccoli-lint-eslint. essentially all it should do is provide it with the right options (e.g. choosing the correct test generator depending on whether ember-cli-mocha or ember-cli-qunit is used).

I suspect it will involve getting a broccoli pipeline in place and create a little repo that would facilitate easy testing?

ember-cli/broccoli-lint-eslint#90 should give you an idea on how to best test broccoli plugins

@rwjblue
Copy link
Member

rwjblue commented Apr 5, 2017

I thought we fixed this.

@stefanpenner - Yes, we cache the output of each file's linting and report it back to the console for a warm build.

it appears that even though we use broccoli-persistent-filter ESLint is run on all files whenever you startup ember serve.

This is what I am referring to above, we do not run eslint unless the cache has been busted. We do however print the same error/warning messages to the console as we emitted the last time the file was linted.


I think it is probably worth while to discuss what we want, and less about how to get there. For example, if what we want is that all warnings/errors print out (for all files even for those not changed) for every rebuild this should be pretty straight forward..

@Turbo87
Copy link
Member

Turbo87 commented Apr 5, 2017

@rwjblue @stefanpenner it's possible that I misunderstood the current implementation. I thought only the generated test files were persisted between builds.

@rwjblue
Copy link
Member

rwjblue commented Apr 5, 2017

I thought only the generated test files were persisted between builds.

Nope. Checkout:

@rondale-sc
Copy link
Author

@rwjblue So ostensibly this already happens and the only discussion is whether we make it more obvious that it is caching by showing only changed files lint output?

@Gaurav0
Copy link
Contributor

Gaurav0 commented Nov 17, 2017

I'd like to pass the --quiet option to eslint so as to not display warnings during CI builds. I hope a fix for this would be able to apply that as well.

@petermoore14
Copy link

Bumping this as it would be extremely nice to have. Unclear why the rest of broccoli-lint-eslint's options aren't supported either, should add those as well.

Turbo87 pushed a commit that referenced this issue Oct 16, 2018
Bumps [testdouble](https://github.com/testdouble/testdouble.js) from 3.2.2 to 3.8.2.
<details>
<summary>Changelog</summary>

*Sourced from [testdouble's changelog](https://github.com/testdouble/testdouble.js/blob/master/CHANGELOG.md).*

> # Change Log
> 
> ## [v3.8.1](https://github.com/testdouble/testdouble.js/tree/v3.8.1) (2018-05-05)
> [Full Changelog](testdouble/testdouble.js@v3.8.0...v3.8.1)
> 
> **Implemented enhancements:**
> 
> - Better verification messages [\#161](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/161)
> 
> **Closed issues:**
> 
> - Trouble replacing ES6 classes [\#365](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/365)
> - You have a global leak: `\_\_core-js\_shared\_\_` [\#364](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/364)
> - testdouble causes bluebird to emit Unhandled rejection [\#168](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/168)
> - Should style API of chai.js doesn't always work on test doubles since 1.6.2 [\#134](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/134)
> 
> ## [v3.8.0](https://github.com/testdouble/testdouble.js/tree/v3.8.0) (2018-04-29)
> [Full Changelog](testdouble/testdouble.js@v3.7.0...v3.8.0)
> 
> **Implemented enhancements:**
> 
> - Improve td.replace error message for incorrect module path [\#355](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/355)
> 
> **Closed issues:**
> 
> - td.verify\(object.function\(new Class\("param"\)\)\) not asserting "param" [\#362](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/362)
> - How to Stub a Chained Function [\#360](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/360)
> - Critical dependency: the request of a dependency is an expression? [\#354](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/354)
> 
> **Merged pull requests:**
> 
> - Better missing module message for td.replace\(\) [\#363](https://github-redirect.dependabot.com/testdouble/testdouble.js/pull/363) ([searls](https://github.com/searls))
> 
> ## [v3.7.0](https://github.com/testdouble/testdouble.js/tree/v3.7.0) (2018-03-31)
> [Full Changelog](testdouble/testdouble.js@v3.6.0...v3.7.0)
> 
> **Closed issues:**
> 
> - Compare dates when using td.matchers.contains [\#358](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/358)
> - verifiable thenThrow [\#288](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/288)
> - docs: simple page that lists the entire API [\#253](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/253)
> - Planning Discussion for a move to TypeScript  [\#252](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/252)
> - More support for ES Modules [\#246](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/246)
> - Consider using \_.isObjectLike rather than \_.isPlainObject within td.object [\#224](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/224)
> 
> **Merged pull requests:**
> 
> - Enhance contains for edge cases, make nesting behave consistently [\#359](https://github-redirect.dependabot.com/testdouble/testdouble.js/pull/359) ([searls](https://github.com/searls))
> 
> ## [v3.6.0](https://github.com/testdouble/testdouble.js/tree/v3.6.0) (2018-03-24)
></table> ... (truncated)
</details>
<details>
<summary>Commits</summary>

- [`a6e4103`](testdouble/testdouble.js@a6e4103) 3.8.2
- [`7b222ae`](testdouble/testdouble.js@7b222ae) Merge pull request [#386](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/386) from testdouble/upgrade-things
- [`1e77fb1`](testdouble/testdouble.js@1e77fb1) upgrade example deps
- [`25cf41e`](testdouble/testdouble.js@25cf41e) upgrade deps
- [`20785c7`](testdouble/testdouble.js@20785c7) clear stupid jasmine warnings
- [`5659f33`](testdouble/testdouble.js@5659f33) standard --fix
- [`3e03d23`](testdouble/testdouble.js@3e03d23) upgrade everything
- [`1bbf695`](testdouble/testdouble.js@1bbf695) Merge pull request [#369](https://github-redirect.dependabot.com/testdouble/testdouble.js/issues/369) from jackjennings/patch-1
- [`952d852`](testdouble/testdouble.js@952d852) Fix method name typo in README example
- [`a9216e3`](testdouble/testdouble.js@a9216e3) Adding an AKA td.js b/c our google rank for "td.js" is bad
- Additional commits viewable in [compare view](testdouble/testdouble.js@v3.2.2...v3.8.2)
</details>
<br />

[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=testdouble&package-manager=npm_and_yarn&previous-version=3.2.2&new-version=3.8.2)](https://dependabot.com/compatibility-score.html?dependency-name=testdouble&package-manager=npm_and_yarn&previous-version=3.2.2&new-version=3.8.2)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

Dependabot will **not** automatically merge this PR because it includes a minor update to a development dependency.

---

**Note:** This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit.

You can always request more updates by clicking `Bump now` in your [Dependabot dashboard](https://app.dependabot.com).

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

Finally, you can contact us by mentioning @dependabot.

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants