Created
March 24, 2017 15:42
-
-
Save osbornm/7c56bcb4f168a92057eb3ce5ef3dc148 to your computer and use it in GitHub Desktop.
eslint array.from
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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