Skip to content

Instantly share code, notes, and snippets.

@osbornm
Created March 24, 2017 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osbornm/7c56bcb4f168a92057eb3ce5ef3dc148 to your computer and use it in GitHub Desktop.
Save osbornm/7c56bcb4f168a92057eb3ce5ef3dc148 to your computer and use it in GitHub Desktop.
eslint array.from
/**
* @fileoverview Disallow the use of Array.From()
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
docs: {
description: "disallow the use of `Array.from()`",
category: "JavaScript",
recommended: false
},
schema: []
},
create(context) {
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
"CallExpression > MemberExpression.callee[object.name = 'Array'][property.name = 'from']"(node) {
context.report({ node: node, message: "Array.from is not supported in IE 11." });
}
};
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment