eslint-plugin-no-use-extend-native
Advanced tools
Comparing version 0.3.7 to 0.3.8
{ | ||
"name": "eslint-plugin-no-use-extend-native", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "ESLint plugin to prevent use of extended native objects", | ||
@@ -31,3 +31,3 @@ "scripts": { | ||
"devDependencies": { | ||
"ava": "^0.14.0", | ||
"ava": "^0.16.0", | ||
"babel-cli": "^6.7.7", | ||
@@ -37,8 +37,8 @@ "babel-eslint": "^6.0.0-beta.6", | ||
"coveralls": "^2.11.2", | ||
"eslint": "^2.4.0", | ||
"eslint": "^3.2.2", | ||
"eslint-config-dustinspecker": "^0.5.0", | ||
"eslint-path-formatter": "^0.1.1", | ||
"eslint-plugin-new-with-error": "^1.1.0", | ||
"nyc": "^6.0.0" | ||
"nyc": "^7.1.0" | ||
} | ||
} |
# eslint-plugin-no-use-extend-native | ||
[![NPM version](https://badge.fury.io/js/eslint-plugin-no-use-extend-native.svg)](https://badge.fury.io/js/eslint-plugin-no-use-extend-native) [![Build Status](https://travis-ci.org/dustinspecker/eslint-plugin-no-use-extend-native.svg?branch=master)](https://travis-ci.org/dustinspecker/eslint-plugin-no-use-extend-native) [![Coverage Status](https://img.shields.io/coveralls/dustinspecker/eslint-plugin-no-use-extend-native.svg)](https://coveralls.io/r/dustinspecker/eslint-plugin-no-use-extend-native?branch=master) | ||
[![NPM version](https://badge.fury.io/js/eslint-plugin-no-use-extend-native.svg)](https://badge.fury.io/js/eslint-plugin-no-use-extend-native) | ||
[![Build Status](https://travis-ci.org/dustinspecker/eslint-plugin-no-use-extend-native.svg?branch=master)](https://travis-ci.org/dustinspecker/eslint-plugin-no-use-extend-native) | ||
[![Coverage Status](https://img.shields.io/coveralls/dustinspecker/eslint-plugin-no-use-extend-native.svg)](https://coveralls.io/r/dustinspecker/eslint-plugin-no-use-extend-native?branch=master) | ||
[![Code Climate](https://codeclimate.com/github/dustinspecker/eslint-plugin-no-use-extend-native/badges/gpa.svg)](https://codeclimate.com/github/dustinspecker/eslint-plugin-no-use-extend-native) [![Dependencies](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native.svg)](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native/#info=dependencies&view=table) [![DevDependencies](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native/dev-status.svg)](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native/#info=devDependencies&view=table) | ||
[![Code Climate](https://codeclimate.com/github/dustinspecker/eslint-plugin-no-use-extend-native/badges/gpa.svg)](https://codeclimate.com/github/dustinspecker/eslint-plugin-no-use-extend-native) | ||
[![Dependencies](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native.svg)](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native/#info=dependencies&view=table) | ||
[![DevDependencies](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native/dev-status.svg)](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native/#info=devDependencies&view=table) | ||
@@ -59,3 +63,21 @@ > ESLint plugin to prevent use of extended native objects | ||
## Usage with no-extend-native | ||
ESLint's [`no-extend-native`][no-extend-native] rule verifies code is not **modifying** a native prototype. e.g., with the `no-extend-native` rule enabled, the following lines are each considered incorrect: | ||
```javascript | ||
String.prototype.shortHash = function() { return this.substring(0, 7); }; | ||
Object.defineProperty(Array.prototype, "times", { value: 999 }); | ||
``` | ||
`no-use-extend-native` verifies code is not **using** a non-native prototype. e.g., with the `no-use-extend-native` plugin enabled, the following line is considered incorrect: | ||
```javascript | ||
"50bda47b09923e045759db8e8dd01a0bacd97370".shortHash() === "50bda47"; | ||
``` | ||
The `no-use-extend-native` plugin is designed to work with ESLint's `no-extend-native` rule. `no-extend-native` ensures that native prototypes aren't extended, and should a third party library extend them, `no-use-extend-native` ensures those changes aren't depended upon. | ||
[no-extend-native]: http://eslint.org/docs/rules/no-extend-native | ||
## LICENSE | ||
MIT © [Dustin Specker](https://github.com/dustinspecker) | ||
MIT © [Dustin Specker](https://github.com/dustinspecker) |
@@ -1,4 +0,1 @@ | ||
/* eslint func-style: 0 */ | ||
/* eslint no-var: 0 */ | ||
/* eslint object-shorthand: 0 */ | ||
'use strict'; | ||
@@ -60,3 +57,3 @@ | ||
MemberExpression: function MemberExpression(node) { | ||
/* eslint complexity: [2, 14] */ | ||
/* eslint complexity: [2, 15] */ | ||
var methodName = void 0, | ||
@@ -79,3 +76,4 @@ proto = void 0; | ||
methodName = methodName || node.property.name || node.property.value; | ||
var type = node.parent.type; | ||
var isArgToParent = node.parent.arguments && node.parent.arguments.indexOf(node) > -1; | ||
var type = isArgToParent ? node.type : node.parent.type; | ||
@@ -82,0 +80,0 @@ if (typeof methodName !== 'string' || typeof proto !== 'string' || !(0, _isJsType2.default)(proto)) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9423
83
82