eslint-plugin-function 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -119
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { AST_NODE_TYPES } from "@typescript-eslint/types";
9
9
 
10
10
  //#region package.json
11
11
  var name = "eslint-plugin-function";
12
- var version = "0.7.2";
12
+ var version = "0.8.0";
13
13
 
14
14
  //#endregion
15
15
  //#region src/utils/create-rule.ts
@@ -141,124 +141,6 @@ function create$1(context) {
141
141
  return {};
142
142
  }
143
143
 
144
- //#endregion
145
- //#region ../../.pkgs/eff/dist/index.js
146
- /**
147
- * Creates a function that can be used in a data-last (aka `pipe`able) or
148
- * data-first style.
149
- *
150
- * The first parameter to `dual` is either the arity of the uncurried function
151
- * or a predicate that determines if the function is being used in a data-first
152
- * or data-last style.
153
- *
154
- * Using the arity is the most common use case, but there are some cases where
155
- * you may want to use a predicate. For example, if you have a function that
156
- * takes an optional argument, you can use a predicate to determine if the
157
- * function is being used in a data-first or data-last style.
158
- *
159
- * You can pass either the arity of the uncurried function or a predicate
160
- * which determines if the function is being used in a data-first or
161
- * data-last style.
162
- *
163
- * **Example** (Using arity to determine data-first or data-last style)
164
- *
165
- * ```ts
166
- * import { dual, pipe } from "effect/Function"
167
- *
168
- * const sum = dual<
169
- * (that: number) => (self: number) => number,
170
- * (self: number, that: number) => number
171
- * >(2, (self, that) => self + that)
172
- *
173
- * console.log(sum(2, 3)) // 5
174
- * console.log(pipe(2, sum(3))) // 5
175
- * ```
176
- *
177
- * **Example** (Using call signatures to define the overloads)
178
- *
179
- * ```ts
180
- * import { dual, pipe } from "effect/Function"
181
- *
182
- * const sum: {
183
- * (that: number): (self: number) => number
184
- * (self: number, that: number): number
185
- * } = dual(2, (self: number, that: number): number => self + that)
186
- *
187
- * console.log(sum(2, 3)) // 5
188
- * console.log(pipe(2, sum(3))) // 5
189
- * ```
190
- *
191
- * **Example** (Using a predicate to determine data-first or data-last style)
192
- *
193
- * ```ts
194
- * import { dual, pipe } from "effect/Function"
195
- *
196
- * const sum = dual<
197
- * (that: number) => (self: number) => number,
198
- * (self: number, that: number) => number
199
- * >(
200
- * (args) => args.length === 2,
201
- * (self, that) => self + that
202
- * )
203
- *
204
- * console.log(sum(2, 3)) // 5
205
- * console.log(pipe(2, sum(3))) // 5
206
- * ```
207
- *
208
- * @param arity - 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.
209
- * @param body - The function to be curried.
210
- * @since 1.0.0
211
- */
212
- const dual = function(arity, body) {
213
- if (typeof arity === "function") return function() {
214
- return arity(arguments) ? body.apply(this, arguments) : ((self) => body(self, ...arguments));
215
- };
216
- switch (arity) {
217
- case 0:
218
- case 1: throw new RangeError(`Invalid arity ${arity}`);
219
- case 2: return function(a, b) {
220
- if (arguments.length >= 2) return body(a, b);
221
- return function(self) {
222
- return body(self, a);
223
- };
224
- };
225
- case 3: return function(a, b, c) {
226
- if (arguments.length >= 3) return body(a, b, c);
227
- return function(self) {
228
- return body(self, a, b);
229
- };
230
- };
231
- default: return function() {
232
- if (arguments.length >= arity) return body.apply(this, arguments);
233
- const args = arguments;
234
- return function(self) {
235
- return body(self, ...args);
236
- };
237
- };
238
- }
239
- };
240
- /**
241
- * Composes two functions, `ab` and `bc` into a single function that takes in an argument `a` of type `A` and returns a result of type `C`.
242
- * The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`.
243
- *
244
- * @param self - The first function to apply (or the composed function in data-last style).
245
- * @param bc - The second function to apply.
246
- * @returns A composed function that applies both functions in sequence.
247
- * @example
248
- * ```ts
249
- * import * as assert from "node:assert"
250
- * import { compose } from "effect/Function"
251
- *
252
- * const increment = (n: number) => n + 1;
253
- * const square = (n: number) => n * n;
254
- *
255
- * assert.strictEqual(compose(increment, square)(2), 9);
256
- * ```
257
- *
258
- * @since 1.0.0
259
- */
260
- const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
261
-
262
144
  //#endregion
263
145
  //#region src/rules/function-return-boolean.ts
264
146
  const RULE_NAME = "function-return-boolean";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-function",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "private": false,
5
5
  "description": "(WIP) An ESLint plugin for function-related rules.",
6
6
  "homepage": "https://github.com/Rel1cx/dx",
@@ -39,10 +39,10 @@
39
39
  "typescript-eslint": "^8.56.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/node": "^25.3.1",
42
+ "@types/node": "^25.3.2",
43
43
  "dedent": "^1.7.1",
44
44
  "eslint": "^10.0.2",
45
- "tsdown": "^0.20.3",
45
+ "tsdown": "^0.21.0-beta.2",
46
46
  "tsl": "^1.0.29",
47
47
  "@local/eff": "0.2.9"
48
48
  },