I was attempting to use the core .eslintrc.json to lint the JS of a project I'm on and ran into what I believe is a bug or at least a conflict with the documented coding standards.

It seems the closure/wrapper required in the JS coding standards handbook page (and found in every core es6.js file I've seen) causes this eslint warning:

warning Unexpected unnamed function func-names

In a local project file I was able to do the following to get around it:


(function (Drupal, bar) {
}(Drupal, window.foo));


((Drupal, bar) => {
})(Drupal, window.foo);

I'm not certain that approach would work throughout core, but I wanted to at least present the idea as a potential way forward here.


chrisolof created an issue.

drpal’s picture


This is just a warning. The second code snipped you provided is the way we'd want to do things in the future, and there's an ongoing process to modernize all of our existing JavaScript.