Eslint - Prefer matches to $.is jquery/no-is

Created on 27 April 2024, 7 months ago
Updated 15 May 2024, 6 months ago

Problem/Motivation

GitLab CI is reporting the following on the eslint task:

/builds/issue/project_browser-3441425/web/modules/custom/project_browser-3441425/js/project_browser.admin.js
  39:14  error  Prefer matches to $.is  jquery/no-is
āœ– 1 problem (1 error, 0 warnings)

This would seem to be caused by āœØ Support generating Code Quality JSON reports (for Gitlab) Needs review , which was intended to make validation in contrib more consistent with core.

Steps to reproduce

See pipeline output...

https://git.drupalcode.org/issue/project_browser-3441425/-/jobs/1377824

Proposed resolution

Ideally, the .is call should be replaced by .matches. However, that would require refactoring to use non-JQuery objects.

I think the simplest approach is to add a // eslint-disable-next-line comment to suppress the error.

I would like to refactor the JavaScript to remove JQuery completely, but I feel that should be left for a follow-on task.

šŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

šŸ‡®šŸ‡ŖIreland lostcarpark

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024