Socket
Socket
Sign inDemoInstall

eslint-plugin-unicorn

Package Overview
Dependencies
Maintainers
3
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-unicorn - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"name": "eslint-plugin-unicorn",
"version": "2.0.0",
"version": "2.0.1",
"description": "Various awesome ESLint rules",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -69,4 +69,4 @@ # eslint-plugin-unicorn [![Build Status](https://travis-ci.org/sindresorhus/eslint-plugin-unicorn.svg?branch=master)](https://travis-ci.org/sindresorhus/eslint-plugin-unicorn) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/eslint-plugin-unicorn/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/eslint-plugin-unicorn?branch=master)

- [no-hex-escape](docs/rules/no-hex-escape.md) - Enforce the use of unicode escapes instead of hexadecimal escapes. *(fixable)*
- [custom-error-definition](docs/rules/custom-error-definition.md) - Enforces the only valid way of `Error` subclassing. *(fixable)*
- [prefer-starts-ends-with](docs/rules/prefer-starts-ends-with.md) - Prefer `String#startsWidth` & `String#endsWidth` over more complex alternatives.
- [custom-error-definition](docs/rules/custom-error-definition.md) - Enforce correct `Error` subclassing. *(fixable)*
- [prefer-starts-ends-with](docs/rules/prefer-starts-ends-with.md) - Prefer `String#startsWith` & `String#endsWith` over more complex alternatives.
- [prefer-type-error](docs/rules/prefer-type-error.md) - Enforce throwing `TypeError` in type checking conditions. *(fixable)*

@@ -73,0 +73,0 @@

@@ -13,8 +13,14 @@ 'use strict';

const callee = node.callee;
const prop = callee.property;
if (!(prop && callee.type === 'MemberExpression')) {
return;
}
const args = node.arguments;
let regex;
if (callee.property.name === 'test' && callee.object.regex) {
if (prop.name === 'test' && callee.object.regex) {
regex = callee.object.regex;
} else if (callee.property.name === 'match' && args && args[0] && args[0].regex) {
} else if (prop.name === 'match' && args && args[0] && args[0].regex) {
regex = args[0].regex;

@@ -21,0 +27,0 @@ } else {

@@ -61,6 +61,3 @@ 'use strict';

const isLone = node =>
node.parent !== null &&
node.parent.body !== null &&
node.parent.body.length === 1;
const isLone = node => node.parent && node.parent.body && node.parent.body.length === 1;

@@ -110,3 +107,3 @@ const isTypecheckingMemberExpression = (node, callExpression) => {

isLone(node) &&
node.parent.parent !== null &&
node.parent.parent &&
isTypechecking(node.parent.parent)) {

@@ -113,0 +110,0 @@ context.report({

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc