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

Eslint rule 'react/forbid-dom-props' doesn't work well with 'fbt:param' or 'fbt:plural' #2005

Closed
mrtnzlml opened this issue Mar 17, 2021 · 1 comment · Fixed by #2184
Closed
Labels
bug Something isn't working

Comments

@mrtnzlml
Copy link
Member

mrtnzlml commented Mar 17, 2021

An example error ofter running yarn eslint src/ya-comiste-backoffice/src/pos/ProductsSelected.js which used fbt:param:

yarn run v1.22.10
$ /Users/martinzlamal/Work/adeira/universe/node_modules/.bin/eslint src/ya-comiste-backoffice/src/pos/ProductsSelected.js

Oops! Something went wrong! :(

ESLint: 7.22.0

TypeError: Cannot read property 'toUpperCase' of undefined
Occurred while linting /Users/martinzlamal/Work/adeira/universe/src/ya-comiste-backoffice/src/pos/ProductsSelected.js:50
    at JSXAttribute (/Users/martinzlamal/Work/adeira/universe/node_modules/eslint-plugin-react/lib/rules/forbid-dom-props.js:74:40)
    at /Users/martinzlamal/Work/adeira/universe/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/martinzlamal/Work/adeira/universe/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/martinzlamal/Work/adeira/universe/node_modules/eslint/lib/linter/node-event-generator.js:256:26)
    at NodeEventGenerator.applySelectors (/Users/martinzlamal/Work/adeira/universe/node_modules/eslint/lib/linter/node-event-generator.js:285:22)
    at NodeEventGenerator.enterNode (/Users/martinzlamal/Work/adeira/universe/node_modules/eslint/lib/linter/node-event-generator.js:299:14)
    at CodePathAnalyzer.enterNode (/Users/martinzlamal/Work/adeira/universe/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
    at /Users/martinzlamal/Work/adeira/universe/node_modules/eslint/lib/linter/linter.js:954:32
    at Array.forEach (<anonymous>)
error Command failed with exit code 2.

Example code used in the aforementioned file:

<div className={styles('stats')}>
  <fbt desc="summary of selected items in POS">
    <fbt:param name="totalSelectedItems">{stats.totalSelectedItems}</fbt:param> items for{' '}
    <fbt:param name="totalPrice">
      <Money priceUnitAmount={stats.totalPrice} priceUnitAmountCurrency="MXN" />
    </fbt:param>
  </fbt>
</div>

Eslint rule setup:

'react/forbid-dom-props': [
  ERROR,
  {
    forbid: [
      'class', // https://reactjs.org/docs/dom-elements.html#classname
      'for', // https://reactjs.org/docs/dom-elements.html#htmlfor
    ],
  },
],
@mrtnzlml mrtnzlml added the bug Something isn't working label Mar 17, 2021
mrtnzlml added a commit that referenced this issue Mar 17, 2021
It should no longer be needed, see: facebook/fbt@ecc647d

There is another issue though in Eslint which needs to be fixed, see: #2005
kodiakhq bot pushed a commit that referenced this issue Mar 18, 2021
It should no longer be needed, see: facebook/fbt@ecc647d

There is another issue though in Eslint which needs to be fixed, see: #2005
adeira-github-bot pushed a commit to adeira/eslint-config-adeira that referenced this issue Mar 18, 2021
It should no longer be needed, see: facebook/fbt@ecc647d

There is another issue though in Eslint which needs to be fixed, see: adeira/universe#2005

adeira-source-id: 04788595362d400edf1d5f9e8f947d764ce361ef
adeira-github-bot pushed a commit to adeira/sx-design that referenced this issue Mar 18, 2021
It should no longer be needed, see: facebook/fbt@ecc647d

There is another issue though in Eslint which needs to be fixed, see: adeira/universe#2005

adeira-source-id: 04788595362d400edf1d5f9e8f947d764ce361ef
@mrtnzlml
Copy link
Member Author

mrtnzlml commented Apr 6, 2021

Fix pending: jsx-eslint/eslint-plugin-react#2961

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant