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.
In a project like dynamic-data-mapping-form-builder, we use metal-jsx. For reasons described here:
https://eslint.org/blog/2015/03/eslint-0.17.0-released#changes-to-jsxreact-handling
ESLint will spuriously warn that variables that are only used as components inside JSX are not used. We can't just turn on the "liferay/react" preset in these projects because that includes a bunch of rules that don't make sense in a metal-jsx context.
So, we create a metal-specific preset here that contains just one rule:
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
Switching to this preset makes all 23 currently-existing lint errors/warnings in the dynamic-data-mapping-form-builder project go away, as seen in these two before-and-after runs:
https://gist.github.com/wincent/16428f82e4ce74f8f5d6f73271ef1aef
The one remaining problem will be projects that use a mixture of metal-jsx and React (@andresfulla is currently dealing with one of those); we'll have to figure out what to do there along the way.
Test plan:
yarn add
the package to liferay-portal, create an.eslintrc.js
as described in the README, and runyarn checkFormat
.