Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[eslint] Require trailing commas where useful #355

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eslint/.eslintrc-magento
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"node": true
},
"rules": {
"comma-dangle": [2, "never"],
"comma-dangle": [2, "always-multiline"],
"comma-style": [2, "last"],
"curly": [2, "all"],
"eol-last": 2,
Expand Down
12 changes: 6 additions & 6 deletions eslint/rules/jquery-no-andSelf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module.exports = {
description: 'Disallow the use of the deprecated `andSelf` method',
category: 'jQuery deprecated functions',
recommended: true,
url: 'https://api.jquery.com/andself/'
url: 'https://api.jquery.com/andself/',
},
schema: [],
messages: {
andSelf: 'jQuery.andSelf() removed, use jQuery.addBack()'
}
andSelf: 'jQuery.andSelf() removed, use jQuery.addBack()',
},
},

/**
Expand Down Expand Up @@ -38,10 +38,10 @@ module.exports = {
if (utils.isjQuery(node)) {
context.report({
node: node,
messageId: 'andSelf'
messageId: 'andSelf',
});
}
}
},
};
}
},
};
12 changes: 6 additions & 6 deletions eslint/rules/jquery-no-bind-unbind.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module.exports = {
description: 'Disallow the use of the deprecated $.bind and $.unbind',
category: 'jQuery deprecated functions',
recommended: true,
url: 'https://api.jquery.com/bind/'
url: 'https://api.jquery.com/bind/',
},
schema: [],
messages: {
bind: 'jQuery $.bind and $.unbind are deprecated, use $.on and $.off instead'
}
bind: 'jQuery $.bind and $.unbind are deprecated, use $.on and $.off instead',
},
},

/**
Expand Down Expand Up @@ -38,10 +38,10 @@ module.exports = {
if (utils.isjQuery(node)) {
context.report({
node: node,
messageId: 'bind'
messageId: 'bind',
});
}
}
},
};
}
},
};
12 changes: 6 additions & 6 deletions eslint/rules/jquery-no-delegate-undelegate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module.exports = {
description: 'Disallow the use of the deprecated $.delegate and $.undelegate',
category: 'jQuery deprecated functions',
recommended: true,
url: 'https://api.jquery.com/delegate/'
url: 'https://api.jquery.com/delegate/',
},
schema: [],
messages: {
delegate: 'jQuery $.delegate and $.undelegate are deprecated, use $.on and $.off instead'
}
delegate: 'jQuery $.delegate and $.undelegate are deprecated, use $.on and $.off instead',
},
},

/**
Expand Down Expand Up @@ -38,10 +38,10 @@ module.exports = {
if (utils.isjQuery(node)) {
context.report({
node: node,
messageId: 'delegate'
messageId: 'delegate',
});
}
}
},
};
}
},
};
12 changes: 6 additions & 6 deletions eslint/rules/jquery-no-deprecated-expr.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = {
description: 'Disallow the use of deprecated way to add to custom selectors',
category: 'jQuery deprecated functions',
recommended: true,
url: 'https://api.jquery.com/load/'
url: 'https://api.jquery.com/load/',
},
schema: []
schema: [],
},

/**
Expand All @@ -31,7 +31,7 @@ module.exports = {
if (utils.isjQuery(node)) {
context.report({
node: node,
message: 'jQuery.expr[":"] is deprecated; Use jQuery.expr.pseudos instead'
message: 'jQuery.expr[":"] is deprecated; Use jQuery.expr.pseudos instead',
});
}
},
Expand All @@ -45,10 +45,10 @@ module.exports = {
if (utils.isjQuery(node)) {
context.report({
node: node,
message: 'jQuery.expr.filters is deprecated; Use jQuery.expr.pseudos instead'
message: 'jQuery.expr.filters is deprecated; Use jQuery.expr.pseudos instead',
});
}
}
},
};
}
},
};
12 changes: 6 additions & 6 deletions eslint/rules/jquery-no-event-shorthand.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = {
description: 'Disallow the use of shorthand event methods',
category: 'jQuery deprecated functions',
recommended: true,
url: 'https://api.jquery.com/load/'
url: 'https://api.jquery.com/load/',
},
schema: []
schema: [],
},

/**
Expand All @@ -30,7 +30,7 @@ module.exports = {
CallExpression: function (node) {
var namesToMsg = {
'unload': 'jQuery.unload() was removed, use .on("unload", fn) instead.',
'ready': 'jQuery.ready(handler) is deprecated and should be replaced with jQuery(handler)'
'ready': 'jQuery.ready(handler) is deprecated and should be replaced with jQuery(handler)',
},
name,
message;
Expand All @@ -44,10 +44,10 @@ module.exports = {
if (utils.isjQuery(node)) {
context.report({
node: node,
message: message
message: message,
});
}
}
},
};
}
},
};
10 changes: 5 additions & 5 deletions eslint/rules/jquery-no-input-event-shorthand.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = {
description: 'Disallow the use of shortcuts to input events via keyboard/mouse trigger events',
category: 'jQuery deprecated functions',
recommended: true,
url: 'https://api.jquery.com/bind/'
url: 'https://api.jquery.com/bind/',
},
schema: []
schema: [],
},

/**
Expand Down Expand Up @@ -43,10 +43,10 @@ module.exports = {
context.report({
node: node,
message: 'Instead of .' + name + '(fn) use .on("' + name + '", fn). Instead of .' + name +
'() use .trigger("' + name + '")'
'() use .trigger("' + name + '")',
});
}
}
},
};
}
},
};
12 changes: 6 additions & 6 deletions eslint/rules/jquery-no-misc-deprecated-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = {
description: 'Disallow the use of various deprecated methods methods',
category: 'jQuery deprecated functions',
recommended: true,
url: 'https://api.jquery.com/load/'
url: 'https://api.jquery.com/load/',
},
schema: []
schema: [],
},

/**
Expand Down Expand Up @@ -36,7 +36,7 @@ module.exports = {
'isArray': 'jQuery.isArray() is deprecated. ' +
'Use the native Array.isArray method instead',
'parseJSON' : 'jQuery.parseJSON() is deprecated. ' +
'To parse JSON strings, use the native JSON.parse method instead'
'To parse JSON strings, use the native JSON.parse method instead',
},
name,
message;
Expand All @@ -50,10 +50,10 @@ module.exports = {
if (utils.isjQuery(node)) {
context.report({
node: node,
message: message
message: message,
});
}
}
},
};
}
},
};
12 changes: 6 additions & 6 deletions eslint/rules/jquery-no-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module.exports = {
description: 'Disallow the use of the deprecated `size` method',
category: 'jQuery deprecated functions',
recommended: true,
url: 'https://api.jquery.com/size/'
url: 'https://api.jquery.com/size/',
},
schema: [],
messages: {
size: 'jQuery.size() removed, use jQuery.length'
}
size: 'jQuery.size() removed, use jQuery.length',
},
},

/**
Expand Down Expand Up @@ -38,10 +38,10 @@ module.exports = {
if (utils.isjQuery(node)) {
context.report({
node: node,
messageId: 'size'
messageId: 'size',
});
}
}
},
};
}
},
};
12 changes: 6 additions & 6 deletions eslint/rules/jquery-no-trim.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module.exports = {
description: 'Disallow the use of the deprecated `trim` function',
category: 'jQuery deprecated functions',
recommended: true,
url: 'https://api.jquery.com/jQuery.trim/'
url: 'https://api.jquery.com/jQuery.trim/',
},
schema: [],
messages: {
trim: 'jQuery.trim is deprecated; use String.prototype.trim'
}
trim: 'jQuery.trim is deprecated; use String.prototype.trim',
},
},

/**
Expand Down Expand Up @@ -38,10 +38,10 @@ module.exports = {
if (utils.isjQuery(node)) {
context.report({
node: node,
messageId: 'trim'
messageId: 'trim',
});
}
}
},
};
}
},
};
4 changes: 2 additions & 2 deletions eslint/rules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function define(node) {
return {
func: defineStmt.expression,
modulePaths: args[0].elements,
moduleNames: args.length > 1 && args[1].params || []
moduleNames: args.length > 1 && args[1].params || [],
};
}

Expand Down Expand Up @@ -118,5 +118,5 @@ function isjQuery(node) {

module.exports = {
traverse: getExpressionId,
isjQuery: isjQuery
isjQuery: isjQuery,
};