canonical
Version:
Canonical code style linter and formatter for JavaScript, SCSS, CSS and JSON.
60 lines (46 loc) • 2.44 kB
Markdown
# eslint-plugin-no-use-extend-native
[](https://badge.fury.io/js/eslint-plugin-no-use-extend-native) [](https://travis-ci.org/dustinspecker/eslint-plugin-no-use-extend-native) [](https://coveralls.io/r/dustinspecker/eslint-plugin-no-use-extend-native?branch=master)
[](https://codeclimate.com/github/dustinspecker/eslint-plugin-no-use-extend-native) [](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native/#info=dependencies&view=table) [](https://david-dm.org/dustinspecker/eslint-plugin-no-use-extend-native/#info=devDependencies&view=table)
> ESLint plugin to prevent use of extended native objects
*Uses [Sindre Sorhus](https://github.com/sindresorhus)'s [proto-props](https://github.com/sindresorhus/proto-props)*
## Install
First, install ESLint via
```
npm install --save-dev eslint
```
Then install eslint-plugin-no-use-extend-native
```
npm install --save-dev eslint-plugin-no-use-extend-native
```
## Usage
In your `.eslintrc` file add the plugin as such:
```javascript
{
plugins: [
'no-use-extend-native'
]
}
```
To modify the single rule, `no-use-extend-native`, add the rule to your `.eslintrc` as such:
```javascript
{
plugins: [
'no-use-extend-native'
],
rules: {
'no-use-extend-native/no-use-extend-native': 0
}
}
```
The default value is `2`.
With this plugin enabled, ESLint will find issues with using extended native objects:
```javascript
var colors = require('colors');
console.log('unicorn'.green);
// => ESLint will give an error stating 'Avoid using extended native objects'
[].customFunction();
// => ESLint will give an error stating 'Avoid using extended native objects'
```
More examples can be seen in the [tests](https://github.com/dustinspecker/eslint-plugin-no-use-extend-native/blob/master/test/test.js).
## LICENSE
MIT © [Dustin Specker](https://github.com/dustinspecker)