-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Detects possibly redundant micro-utilities, preferring local/inline functionality instead | ||
|
||
This rule detects imports of "micro utilities" - very small packages which | ||
provide utilities you could replace with native functionality or your own | ||
code. | ||
|
||
## Rule Details | ||
|
||
This rule detects possibly redundant micro-utilities. | ||
|
||
The following patterns are considered warnings: | ||
|
||
```ts | ||
const isNaN = require('is-nan'); | ||
isNaN(v); | ||
``` | ||
|
||
The following patterns are not warnings: | ||
|
||
```ts | ||
Number.isNaN(v); | ||
``` | ||
|
||
## When Not To Use It | ||
|
||
If you prefer the cost of pulling in many utility dependencies over | ||
the cost of writing the equivalent snippet yourself, it may be worth disabling | ||
this rule. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Detects possibly redundant polyfills of natively available functionality | ||
|
||
This rule detects imports of dependencies which provide functionality now | ||
available natively. | ||
|
||
If your package has an `engines` constraint for `node`, it will be taken | ||
into account (i.e. polyfills of functionality your version doesn't yet have | ||
will be allowed). | ||
|
||
## Rule Details | ||
|
||
This rule detects possibly redundant polyfills. | ||
|
||
The following patterns are considered warnings: | ||
|
||
```ts | ||
// With no `engines` or `engines.node` is `>=7.0.0` | ||
const entries = require('object.entries'); | ||
entries({foo: 'bar'}); | ||
``` | ||
|
||
The following patterns are not warnings: | ||
|
||
```ts | ||
// With no `engines` or `engines.node` is `>=7.0.0` | ||
Object.entries({foo: 'bar'}); | ||
``` | ||
|
||
## When Not To Use It | ||
|
||
If you need to support much older JS runtimes (node, browsers, etc), this | ||
rule may not be of much use as the polyfills are probably still useful there. |