This repository has been archived by the owner on Sep 30, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements enforcement of:
https://github.com/liferay/liferay-frontend-guidelines/blob/master/guidelines/general/testing.md
As noted in the comments, ESLint surprisingly doesn't make it easy for you to bundle rules with a config, requiring you to publish a separate package. That is, if you have "eslint-config-foo", you have to stick your rules in "eslint-plugin-foo". The inverse doesn't appear to be true: if you have "eslint-plugin-foo", you can bundle configs with it without having to create "eslint-config-foo".
We however, have "eslint-config-liferay", and I don't want to create yet another package, so we use a horrifying but well-contained hack that is hidden away in
utils/local.js
to enable us to bundle local rules with our config. No need to look in there, really.So, we now have a "plugins" subdirectory where we keep our local rules, starting with this "liferay/no-it-should" rule, which we should be able to use in all of our projects, and which you can see in "plugins/eslint-plugin-liferay". The actual structure of this is determined by the "generator-eslint" Yeoman generator, which is why it doesn't exactly follow our own conventions (eg. it has a "tests" directory in instead of a "test" directory). Likewise, things like having a "docs" folder are just expected for all ESLint rules. I included a link from the top-level README for visibility.