Skip to content

Commit

Permalink
fix: don't use optional chaining in ESLint rule (#38534)
Browse files Browse the repository at this point in the history
Fixes #38530

Should we consider adding a build-step to lint rules to be able to use TS/modern JS?

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
  • Loading branch information
balazsorban44 committed Jul 11, 2022
1 parent 3075c3f commit e7b6b19
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/eslint-plugin-next/lib/rules/no-img-element.js
Expand Up @@ -22,7 +22,13 @@ module.exports = {
return
}

if (node.parent?.parent?.openingElement?.name?.name === 'picture') {
if (
node.parent &&
node.parent.openingElement &&
node.parent.parent.openingElement &&
node.parent.parent.openingElement.name &&
node.parent.parent.openingElement.name.name === 'picture'
) {
return
}

Expand Down

0 comments on commit e7b6b19

Please sign in to comment.