Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Now, the ESLint rules allowed to use object shorthand and arrow functions in an Object. It creates inconsistent in different files or even in the same object. Especially when we only patch one method inside an Object.
Suggested Changes (After patch):
Wrong:
const WRONG = {
total: (number) => {
return number * 2;
},
attach(context) {
jQuery(context);
},
};
Correct:
const CORRECT = {
total(number) {
return number * 2;
},
attach(context) {
jQuery(context);
},
};
Correct:
const CORRECT_ARROW = {
total: number => number * 2,
attach(context) {
jQuery(context);
},
};
Comment | File | Size | Author |
---|---|---|---|
eslint-object-shorthand.patch | 469 bytes | droplet | |
Comments