github / eslint-plugin-github

An opinionated collection of ESLint rules used by GitHub.
MIT License
286 stars 51 forks source link

[Bug] Bug in `getElementType` logic #526

Closed khiga8 closed 1 month ago

khiga8 commented 1 month ago

There appears to be a bug in the getElementType logic.

When the polymorphic prop is set but cannot be interpreted by the linter, the linter falls back to using the value defined in the component map if it is available. This will result in false mappings of components to a value.

The linter should not use the component value at all!

const mapping = {
  'Box': 'div'
}
<Box as={something} />

In this case, Box should not fall back to div, and should be skipped by the linter.

khiga8 commented 1 month ago

This has been resolved by: https://github.com/github/eslint-plugin-github/pull/525