Skip to content

fix: disable no-restricted-syntax rules

Mark Florian requested to merge no-no-restricted-syntax into main

fix: disable no-restricted-syntax rules

We inherit four no-restricted-syntax rules from airbnb which disallow certain AST nodes. See https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v15.0.0/packages/eslint-config-airbnb-base/rules/style.js#L257-L275.

ForInStatement is protected against by the guard-for-in ESLint rule anyway, so this is not needed.

ForOfStatement is something we want to allow, since our target browsers support the syntax.

LabeledStatement is very rarely seen, though there are legitimate use cases for it that could be argued for in code review, so we should allow it.

WithStatement is disallowed by the 'use strict' pragma, so cannot occur in practice.

Any downstream project which defines its own no-restricted-syntax rules implicitly overwrites these anyway, so there is no good reason to keep them here. See gitlab-org/gitlab#397717 (closed).

Edited by Mark Florian

Merge request reports