eslint-plugin-react-debug
Advanced tools
Comparing version 1.5.0 to 1.5.1-next.1
'use strict'; | ||
var core = require('@eslint-react/core'); | ||
var tools = require('@eslint-react/tools'); | ||
var shared = require('@eslint-react/shared'); | ||
var name = "eslint-plugin-react-debug"; | ||
var version = "1.5.0"; | ||
var version = "1.5.1-next.1"; | ||
/** | ||
* Tests if a value is a `function`. | ||
* | ||
* @param input - The value to test. | ||
* | ||
* @example | ||
* import { isFunction } from 'effect/Predicate' | ||
* | ||
* assert.deepStrictEqual(isFunction(isFunction), true) | ||
* assert.deepStrictEqual(isFunction("function"), false) | ||
* | ||
* @category guards | ||
* @since 2.0.0 | ||
*/ | ||
/** | ||
* Creates a function that can be used in a data-last (aka `pipe`able) or | ||
* data-first style. | ||
* | ||
* The first parameter to `dual` is either the arity of the uncurried function | ||
* or a predicate that determines if the function is being used in a data-first | ||
* or data-last style. | ||
* | ||
* Using the arity is the most common use case, but there are some cases where | ||
* you may want to use a predicate. For example, if you have a function that | ||
* takes an optional argument, you can use a predicate to determine if the | ||
* function is being used in a data-first or data-last style. | ||
* | ||
* @param arity - Either the arity of the uncurried function or a predicate | ||
* which determines if the function is being used in a data-first | ||
* or data-last style. | ||
* @param body - The definition of the uncurried function. | ||
* | ||
* @example | ||
* import { dual, pipe } from "effect/Function" | ||
* | ||
* // Exampe using arity to determine data-first or data-last style | ||
* const sum: { | ||
* (that: number): (self: number) => number | ||
* (self: number, that: number): number | ||
* } = dual(2, (self: number, that: number): number => self + that) | ||
* | ||
* assert.deepStrictEqual(sum(2, 3), 5) | ||
* assert.deepStrictEqual(pipe(2, sum(3)), 5) | ||
* | ||
* // Example using a predicate to determine data-first or data-last style | ||
* const sum2: { | ||
* (that: number): (self: number) => number | ||
* (self: number, that: number): number | ||
* } = dual((args) => args.length === 1, (self: number, that: number): number => self + that) | ||
* | ||
* assert.deepStrictEqual(sum(2, 3), 5) | ||
* assert.deepStrictEqual(pipe(2, sum(3)), 5) | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
const dual = function (arity, body) { | ||
if (typeof arity === "function") { | ||
return function () { | ||
if (arity(arguments)) { | ||
// @ts-expect-error | ||
return body.apply(this, arguments); | ||
} | ||
return self => body(self, ...arguments); | ||
}; | ||
} | ||
switch (arity) { | ||
case 0: | ||
case 1: | ||
throw new RangeError(`Invalid arity ${arity}`); | ||
case 2: | ||
return function (a, b) { | ||
if (arguments.length >= 2) { | ||
return body(a, b); | ||
} | ||
return function (self) { | ||
return body(self, a); | ||
}; | ||
}; | ||
case 3: | ||
return function (a, b, c) { | ||
if (arguments.length >= 3) { | ||
return body(a, b, c); | ||
} | ||
return function (self) { | ||
return body(self, a, b); | ||
}; | ||
}; | ||
case 4: | ||
return function (a, b, c, d) { | ||
if (arguments.length >= 4) { | ||
return body(a, b, c, d); | ||
} | ||
return function (self) { | ||
return body(self, a, b, c); | ||
}; | ||
}; | ||
case 5: | ||
return function (a, b, c, d, e) { | ||
if (arguments.length >= 5) { | ||
return body(a, b, c, d, e); | ||
} | ||
return function (self) { | ||
return body(self, a, b, c, d); | ||
}; | ||
}; | ||
default: | ||
return function () { | ||
if (arguments.length >= arity) { | ||
// @ts-expect-error | ||
return body.apply(this, arguments); | ||
} | ||
const args = arguments; | ||
return function (self) { | ||
return body(self, ...args); | ||
}; | ||
}; | ||
} | ||
}; | ||
/** | ||
* Creates a constant value that never changes. | ||
* | ||
* This is useful when you want to pass a value to a higher-order function (a function that takes another function as its argument) | ||
* and want that inner function to always use the same value, no matter how many times it is called. | ||
* | ||
* @param value - The constant value to be returned. | ||
* | ||
* @example | ||
* import { constant } from "effect/Function" | ||
* | ||
* const constNull = constant(null) | ||
* | ||
* assert.deepStrictEqual(constNull(), null) | ||
* assert.deepStrictEqual(constNull(), null) | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
const constant = value => () => value; | ||
const moduleVersion = "2.2.2"; | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
const globalStoreId = /*#__PURE__*/Symbol.for(`effect/GlobalValue/globalStoreId/${moduleVersion}`); | ||
if (!(globalStoreId in globalThis)) { | ||
globalThis[globalStoreId] = /*#__PURE__*/new Map(); | ||
} | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
/** @internal */ | ||
const isNone$1 = fa => fa._tag === "None"; | ||
/** | ||
* Determine if a `Option` is a `None`. | ||
* | ||
* @param self - The `Option` to check. | ||
* | ||
* @example | ||
* import { some, none, isNone } from 'effect/Option' | ||
* | ||
* assert.deepStrictEqual(isNone(some(1)), false) | ||
* assert.deepStrictEqual(isNone(none()), true) | ||
* | ||
* @category guards | ||
* @since 2.0.0 | ||
*/ | ||
const isNone = isNone$1; | ||
/** | ||
* Returns the value of the `Option` if it is `Some`, otherwise returns `onNone` | ||
* | ||
* @param self - The `Option` to get the value of. | ||
* @param onNone - Function that returns the default value to return if the `Option` is `None`. | ||
* | ||
* @example | ||
* import { some, none, getOrElse } from 'effect/Option' | ||
* import { pipe } from "effect/Function" | ||
* | ||
* assert.deepStrictEqual(pipe(some(1), getOrElse(() => 0)), 1) | ||
* assert.deepStrictEqual(pipe(none(), getOrElse(() => 0)), 0) | ||
* | ||
* @category getters | ||
* @since 2.0.0 | ||
*/ | ||
const getOrElse = /*#__PURE__*/dual(2, (self, onNone) => isNone(self) ? onNone() : self.value); | ||
/** | ||
* Bun currently has a bug where `setTimeout` doesn't behave correctly with a 0ms delay. | ||
* | ||
* @see https://github.com/oven-sh/bun/issues/3333 | ||
*/ | ||
/** @internal */ | ||
typeof process === "undefined" ? false : !!process?.isBun; | ||
const createRule = shared.createRuleForPlugin("debug"); | ||
@@ -36,3 +230,3 @@ | ||
data: { | ||
name: tools.O.getOrElse(tools.F.constant("anonymous"))(name) | ||
name: getOrElse(constant("anonymous"))(name) | ||
}, | ||
@@ -72,3 +266,3 @@ messageId: "CLASS_COMPONENT", | ||
data: { | ||
name: tools.O.getOrElse(name, tools.F.constant("anonymous")), | ||
name: getOrElse(name, constant("anonymous")), | ||
forwardRef: Boolean(flag & core.ERFunctionComponentFlag.ForwardRef), | ||
@@ -75,0 +269,0 @@ memo: Boolean(flag & core.ERFunctionComponentFlag.Memo), |
{ | ||
"name": "eslint-plugin-react-debug", | ||
"version": "1.5.0", | ||
"version": "1.5.1-next.1", | ||
"description": "ESLint React's ESLint plugin for debugging related rules.", | ||
@@ -44,8 +44,8 @@ "homepage": "https://github.com/rel1cx/eslint-react", | ||
"string-ts": "2.0.0", | ||
"@eslint-react/ast": "1.5.0", | ||
"@eslint-react/core": "1.5.0", | ||
"@eslint-react/jsx": "1.5.0", | ||
"@eslint-react/shared": "1.5.0", | ||
"@eslint-react/tools": "1.5.0", | ||
"@eslint-react/types": "1.5.0" | ||
"@eslint-react/ast": "1.5.1-next.1", | ||
"@eslint-react/core": "1.5.1-next.1", | ||
"@eslint-react/jsx": "1.5.1-next.1", | ||
"@eslint-react/shared": "1.5.1-next.1", | ||
"@eslint-react/tools": "1.5.1-next.1", | ||
"@eslint-react/types": "1.5.1-next.1" | ||
}, | ||
@@ -52,0 +52,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
33089
951
1
+ Added@eslint-react/ast@1.5.1-next.1(transitive)
+ Added@eslint-react/core@1.5.1-next.1(transitive)
+ Added@eslint-react/jsx@1.5.1-next.1(transitive)
+ Added@eslint-react/shared@1.5.1-next.1(transitive)
+ Added@eslint-react/tools@1.5.1-next.1(transitive)
+ Added@eslint-react/types@1.5.1-next.1(transitive)
+ Added@eslint-react/var@1.5.1-next.1(transitive)
- Removed@eslint-react/ast@1.5.0(transitive)
- Removed@eslint-react/core@1.5.0(transitive)
- Removed@eslint-react/jsx@1.5.0(transitive)
- Removed@eslint-react/shared@1.5.0(transitive)
- Removed@eslint-react/tools@1.5.0(transitive)
- Removed@eslint-react/types@1.5.0(transitive)
- Removed@eslint-react/var@1.5.0(transitive)
- Removedeffect@2.2.2(transitive)