Our GitLab CI pipelines currently produce warnings regarding ESLint:

*****************************************************************************************************************************
Now running ESLINT using the --fix option. Any errors shown below are not fixable automatically. 
*****************************************************************************************************************************
$ $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/eslint --no-error-on-unmatched-pattern --ignore-pattern="*.es6.js" --resolve-plugins-relative-to=$CI_PROJECT_DIR/$_WEB_ROOT/core --ext=.js,.yml $_ESLINT_EXTRA --fix . || EXIT_CODE_FIX=$?
/builds/project/search_api/web/modules/custom/search_api/js/search_api.processors.js
  26:15  error  Prefer matches to $.is  jquery/no-is
  42:20  error  Prefer matches to $.is  jquery/no-is
✖ 2 problems (2 errors, 0 warnings)

Issue fork search_api-3442296

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

drunken monkey created an issue. See original summary.

jonathan1055’s picture

I also have error Prefer matches to $.is jquery/no-is for source lines that are using .is(':checked') when writing summary text in tabs using .drupalSetSummary()

I'm interested to see what you change to fix this.

drunken monkey’s picture

Status: Active » Needs review

Created this MR which should fix this.

However, not trivial to find out what Prefer matches to $.is is supposed to mean, for a JS non-expert.

@jonathan1055: Glad I’m not the only one! That repository could really use some better documentation.

jonathan1055’s picture

Yes JS is one of the mysteries I understand the least about :-)
If found https://github.com/wikimedia/eslint-plugin-no-jquery/blob/master/docs/ru... which I think is explaining the rule.

I presume you have javascript test coverage for the behaviours function you are changing? Would it be worth making an incorrect change, eg swapping over the 'enabled' and 'disabled' text, to prove it?

drunken monkey’s picture

Status: Needs review » Fixed

No, I don’t think these are covered by our FunctionalJavascript tests. I just tried it out manually and it works fine.
Thanks for finding the docs! However, the “correct code” examples they give do not work for me, and also aren’t consistent with the error message that says matches() should be used instead. So, they don’t seem very helpful.

Anyways, I think we can just merge this, should be fine.

  • drunken monkey committed e05d2936 on 8.x-1.x
    Issue #3442296 by drunken monkey, jonathan1055: Fixed Javascript code...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.