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

Fix bug in getElementType logic #525

Merged
merged 9 commits into from
May 20, 2024
Merged

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented May 16, 2024

This PR fixes a few issues:

1. Fixing bug in getElementType logic

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

will be interpreted as div. Currently the linter will check the mapping if it is unable to interpret the polymorphic value. However, it should not do that because that is not a correct interpretation.

2. Fixing mjs tests that aren't running

I noticed the tests in utils aren't running even when calling npm run test.

This seems related to this change where the tests were converted to .mjs, but the .mjs tests aren't actually running. When I fixed the command, the tests are being targeted. The test will not run properly without the .js extension.

3. Drops node 14 support

Drops node 14 support per slack thread!

4. Adds node 16 support

const defaultComponent = settings.github.components[rawElement]

// check if the default component is also defined in the configuration
return defaultComponent ? defaultComponent : defaultComponent
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this intentional @kendallgassner?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely not

@khiga8 khiga8 force-pushed the kh-fix-bug-in-get-element-type-logic branch from 87a0e9f to 9deac20 Compare May 16, 2024 17:56
@@ -15,7 +15,7 @@
"lint:eslint-docs": "npm run update:eslint-docs -- --check",
"lint:js": "eslint .",
"pretest": "mkdir -p node_modules/ && ln -fs $(pwd) node_modules/",
"test": "npm run eslint-check && npm run lint && mocha tests/**/*.js tests/",
"test": "npm run eslint-check && npm run lint && mocha tests/**/*.js tests/**/*.mjs",
Copy link
Contributor Author

@khiga8 khiga8 May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mjs tests don't actually seem to be running, since this update. Updating this glob seems to fix it.

Comment on lines +2 to +3
import {getElementType} from '../../lib/utils/get-element-type.js'
import {mockJSXAttribute, mockJSXConditionalAttribute, mockJSXOpeningElement} from './mocks.js'
Copy link
Contributor Author

@khiga8 khiga8 May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently I need to add the .js extension, or I run into failure

Exception during run: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/runner/work/eslint-plugin-github/eslint-plugin-github/lib/utils/get-element-type' imported from /home/runner/work/eslint-plugin-github/eslint-plugin-github/tests/utils/get-element-type.mjs

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library seems to be using a mix of module JS and common JS now

I wonder if that's why? 🫤

@khiga8 khiga8 marked this pull request as ready for review May 16, 2024 19:11
@khiga8 khiga8 requested a review from a team as a code owner May 16, 2024 19:11
@khiga8 khiga8 requested a review from mattcosta7 May 16, 2024 19:11
@khiga8
Copy link
Contributor Author

khiga8 commented May 16, 2024

@github/web-systems-reviewers

Node 14 builds seem to be failing. Can we drop support?

--

The answer is yes! slack thread!

@@ -10,6 +10,7 @@ module.exports = {
extends: [require.resolve('./lib/configs/recommended'), 'plugin:eslint-plugin/all'],
plugins: ['eslint-plugin'],
rules: {
'import/extensions': 'off',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for the JS files to be loaded into .mjs, we need an extension.

This library seems to be using a mix of module JS and common JS now, so we'll want to turn this rule off.

@khiga8 khiga8 requested review from a team and accessibility-bot May 16, 2024 20:39
@accessibility-bot
Copy link

👋 Hello and thanks for pinging us! You've entered our first responder queue. An accessibility first responder will review this soon.

  • 💻 On PRs for our review: please provide a review environment with steps to validate, screenshots (with alt text), or videos demonstrating functionality we should be checking. This will help speed up our review and feedback cycle.
  • ⚠️ If this is urgent, please visit us in #accessibility on Slack and tag the first responder(s) listed in the channel topic.

@@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [14, 16, 18]
node-version: [18]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add 20? I've been seeing more Actions migrate to it, and it's now a year old; if nothing breaks might be nice to start testing against it.

(disclaimer: I'm not the expert on node versions.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh okay! let's see what it tells us!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WOO! Added, and passed!

Copy link
Contributor

@dgreif dgreif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for web-systems-reviewers

@khiga8 khiga8 merged commit ce529f9 into main May 20, 2024
4 checks passed
@khiga8 khiga8 deleted the kh-fix-bug-in-get-element-type-logic branch May 20, 2024 17:25
WtfJoke referenced this pull request in WtfJoke/setup-groovy Aug 1, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[eslint-plugin-github](https://togithub.com/github/eslint-plugin-github)
| [`4.10.2` ->
`5.0.1`](https://renovatebot.com/diffs/npm/eslint-plugin-github/4.10.2/5.0.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/eslint-plugin-github/5.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/eslint-plugin-github/5.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/eslint-plugin-github/4.10.2/5.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/eslint-plugin-github/4.10.2/5.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>github/eslint-plugin-github (eslint-plugin-github)</summary>

###
[`v5.0.1`](https://togithub.com/github/eslint-plugin-github/releases/tag/v5.0.1)

[Compare
Source](https://togithub.com/github/eslint-plugin-github/compare/v5.0.0...v5.0.1)

#### What's Changed

- chore(deps): bump the all-dependencies group with 5 updates by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/530](https://togithub.com/github/eslint-plugin-github/pull/530)
- Provide `no-redundant-roles` exception for `rowgroup` by
[@&#8203;khiga8](https://togithub.com/khiga8) in
[https://github.com/github/eslint-plugin-github/pull/531](https://togithub.com/github/eslint-plugin-github/pull/531)

**Full Changelog**:
github/eslint-plugin-github@v5.0.0...v5.0.1

###
[`v5.0.0`](https://togithub.com/github/eslint-plugin-github/releases/tag/v5.0.0)

[Compare
Source](https://togithub.com/github/eslint-plugin-github/compare/v4.10.2...v5.0.0)

Formally releasing v5.0.0!

This release includes everything in pre-release
[v5.0.0-2](https://togithub.com/github/eslint-plugin-github/releases/tag/v5.0.0-2)!

We notably dropped support for node 14 and node 16 in favor of node 18.

#### What's Changed

- Drop node 14/16 support and fix bug in `getElementType` logic by
[@&#8203;khiga8](https://togithub.com/khiga8) in
[https://github.com/github/eslint-plugin-github/pull/525](https://togithub.com/github/eslint-plugin-github/pull/525)
- Bump node 14 to node 18 by
[@&#8203;khiga8](https://togithub.com/khiga8) in
[https://github.com/github/eslint-plugin-github/pull/529](https://togithub.com/github/eslint-plugin-github/pull/529)
- chore(deps): bump the all-dependencies group with 4 updates by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/510](https://togithub.com/github/eslint-plugin-github/pull/510)
- chore(deps): bump the all-dependencies group with 2 updates by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/511](https://togithub.com/github/eslint-plugin-github/pull/511)
- chore(deps): bump the all-dependencies group with 2 updates by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/512](https://togithub.com/github/eslint-plugin-github/pull/512)
- chore(deps): bump the all-dependencies group with 3 updates by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/514](https://togithub.com/github/eslint-plugin-github/pull/514)
- chore(deps): bump the all-dependencies group across 1 directory with 4
updates by [@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/522](https://togithub.com/github/eslint-plugin-github/pull/522)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" in timezone
Europe/Berlin, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job
log](https://developer.mend.io/github/WtfJoke/setup-groovy).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjEuMCIsInVwZGF0ZWRJblZlciI6IjM3LjQzOC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
WtfJoke referenced this pull request in WtfJoke/setup-tectonic Sep 13, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[eslint-plugin-github](https://redirect.github.com/github/eslint-plugin-github)
| [`4.10.2` ->
`5.0.2`](https://renovatebot.com/diffs/npm/eslint-plugin-github/4.10.2/5.0.2)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/eslint-plugin-github/5.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/eslint-plugin-github/5.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/eslint-plugin-github/4.10.2/5.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/eslint-plugin-github/4.10.2/5.0.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>github/eslint-plugin-github (eslint-plugin-github)</summary>

###
[`v5.0.2`](https://redirect.github.com/github/eslint-plugin-github/releases/tag/v5.0.2)

[Compare
Source](https://redirect.github.com/github/eslint-plugin-github/compare/v5.0.1...v5.0.2)

#### What's Changed

- chore(deps): bump the all-dependencies group across 1 directory with 3
updates by [@&#8203;dependabot](https://redirect.github.com/dependabot)
in
[https://github.com/github/eslint-plugin-github/pull/533](https://redirect.github.com/github/eslint-plugin-github/pull/533)
- chore(deps): bump braces from 3.0.2 to 3.0.3 by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/534](https://redirect.github.com/github/eslint-plugin-github/pull/534)
- chore(deps): bump the all-dependencies group with 3 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/535](https://redirect.github.com/github/eslint-plugin-github/pull/535)
- chore(deps): bump the all-dependencies group with 3 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/536](https://redirect.github.com/github/eslint-plugin-github/pull/536)
- chore(deps): bump the all-dependencies group with 4 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/537](https://redirect.github.com/github/eslint-plugin-github/pull/537)
- chore(deps): bump the all-dependencies group with 3 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/538](https://redirect.github.com/github/eslint-plugin-github/pull/538)
- chore(deps): bump the all-dependencies group with 3 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/540](https://redirect.github.com/github/eslint-plugin-github/pull/540)
- chore(deps): bump the all-dependencies group with 4 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/541](https://redirect.github.com/github/eslint-plugin-github/pull/541)
- chore(deps): bump the all-dependencies group across 1 directory with 3
updates by [@&#8203;dependabot](https://redirect.github.com/dependabot)
in
[https://github.com/github/eslint-plugin-github/pull/543](https://redirect.github.com/github/eslint-plugin-github/pull/543)
- chore(deps): bump the all-dependencies group with 3 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/544](https://redirect.github.com/github/eslint-plugin-github/pull/544)
- chore(deps): bump the all-dependencies group with 3 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/545](https://redirect.github.com/github/eslint-plugin-github/pull/545)
- chore(deps): bump the all-dependencies group across 1 directory with 4
updates by [@&#8203;dependabot](https://redirect.github.com/dependabot)
in
[https://github.com/github/eslint-plugin-github/pull/551](https://redirect.github.com/github/eslint-plugin-github/pull/551)

**Full Changelog**:
github/eslint-plugin-github@v5.0.1...v5.0.2

###
[`v5.0.1`](https://redirect.github.com/github/eslint-plugin-github/releases/tag/v5.0.1)

[Compare
Source](https://redirect.github.com/github/eslint-plugin-github/compare/v5.0.0...v5.0.1)

#### What's Changed

- chore(deps): bump the all-dependencies group with 5 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/530](https://redirect.github.com/github/eslint-plugin-github/pull/530)
- Provide `no-redundant-roles` exception for `rowgroup` by
[@&#8203;khiga8](https://redirect.github.com/khiga8) in
[https://github.com/github/eslint-plugin-github/pull/531](https://redirect.github.com/github/eslint-plugin-github/pull/531)

**Full Changelog**:
github/eslint-plugin-github@v5.0.0...v5.0.1

###
[`v5.0.0`](https://redirect.github.com/github/eslint-plugin-github/releases/tag/v5.0.0)

[Compare
Source](https://redirect.github.com/github/eslint-plugin-github/compare/v4.10.2...v5.0.0)

Formally releasing v5.0.0!

This release includes everything in pre-release
[v5.0.0-2](https://redirect.github.com/github/eslint-plugin-github/releases/tag/v5.0.0-2)!

We notably dropped support for node 14 and node 16 in favor of node 18.

#### What's Changed

- Drop node 14/16 support and fix bug in `getElementType` logic by
[@&#8203;khiga8](https://redirect.github.com/khiga8) in
[https://github.com/github/eslint-plugin-github/pull/525](https://redirect.github.com/github/eslint-plugin-github/pull/525)
- Bump node 14 to node 18 by
[@&#8203;khiga8](https://redirect.github.com/khiga8) in
[https://github.com/github/eslint-plugin-github/pull/529](https://redirect.github.com/github/eslint-plugin-github/pull/529)
- chore(deps): bump the all-dependencies group with 4 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/510](https://redirect.github.com/github/eslint-plugin-github/pull/510)
- chore(deps): bump the all-dependencies group with 2 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/511](https://redirect.github.com/github/eslint-plugin-github/pull/511)
- chore(deps): bump the all-dependencies group with 2 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/512](https://redirect.github.com/github/eslint-plugin-github/pull/512)
- chore(deps): bump the all-dependencies group with 3 updates by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/github/eslint-plugin-github/pull/514](https://redirect.github.com/github/eslint-plugin-github/pull/514)
- chore(deps): bump the all-dependencies group across 1 directory with 4
updates by [@&#8203;dependabot](https://redirect.github.com/dependabot)
in
[https://github.com/github/eslint-plugin-github/pull/522](https://redirect.github.com/github/eslint-plugin-github/pull/522)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" in timezone
Europe/Berlin, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/WtfJoke/setup-tectonic).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43NC4xIiwidXBkYXRlZEluVmVyIjoiMzguNzQuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants