From b3569a4978a0f6f0566df2184ddc77fca5ae3d27 Mon Sep 17 00:00:00 2001 From: Mark Florian <mflorian@gitlab.com> Date: Fri, 10 Jun 2022 15:01:43 +0100 Subject: [PATCH] Don't lint ee_component import paths In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/85948#note_956238056 it was discovered that we don't actually successfully lint these paths anyway. The reason is that it's not a simple resolve alias, which the `import/no-unresolved` ESLint rule relies upon to look up paths. We instead use `NormalModuleReplacementPlugin` to rewrite the path when in FOSS, which that rule does not take into account. This means that, with `FOSS_ONLY=1`, the resolved path of `app/assets/javascripts/vue_shared/components/empty_component.js` is not actually checked. Since webpack will throw at build time if the path doesn't resolve, we're protected from typos, so this edge case isn't that important. Another interesting finding that doesn't quite make sense: `eslint-module-utils`, which `import/no-unresolved` relies on, only added support for `import()` calls in v2.6.1 (see https://github.com/import-js/eslint-plugin-import/pull/2026 and https://github.com/import-js/eslint-plugin-import/blob/main/utils/CHANGELOG.md#v261---2021-05-13). See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/85948 for more discussion about this. --- .eslintrc.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.eslintrc.yml b/.eslintrc.yml index 9f587bd204a38..7505d864e6fcd 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -26,6 +26,12 @@ rules: - _links import/no-unresolved: - error + - ignore: + # In FOSS, these import paths are rewritten using + # NormalModuleReplacementPlugin, which import/no-unresolved doesn't + # consider. See + # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/89831. + - '^(ee|jh)_component/' # Disabled for now, to make the airbnb-base 12.1.0 -> 13.1.0 update smoother no-else-return: - error -- GitLab