@pobammer-ts/eslint-cease-nonsense-rules 1.4.2 → 1.5.1
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.
- package/README.md +28 -0
- package/dist/build-metadata.json +3 -3
- package/dist/configure-utilities.d.ts +7 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +18753 -10937
- package/dist/index.js.map +187 -15
- package/dist/rules/no-useless-use-spring.d.ts +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ export default [
|
|
|
36
36
|
"cease-nonsense/require-named-effect-functions": "error",
|
|
37
37
|
"cease-nonsense/require-paired-calls": "error",
|
|
38
38
|
"cease-nonsense/require-react-component-keys": "error",
|
|
39
|
+
"cease-nonsense/no-useless-use-spring": "error",
|
|
39
40
|
"cease-nonsense/use-exhaustive-dependencies": "error",
|
|
40
41
|
"cease-nonsense/use-hook-at-top-level": "error",
|
|
41
42
|
},
|
|
@@ -257,6 +258,33 @@ function UserProfile({ userId }) {
|
|
|
257
258
|
}
|
|
258
259
|
```
|
|
259
260
|
|
|
261
|
+
#### `no-useless-use-spring`
|
|
262
|
+
|
|
263
|
+
Flags `useSpring`-style hooks that never change (static config plus non-updating deps). Defaults: `springHooks: ["useSpring"]`, `treatEmptyDepsAsViolation: true`.
|
|
264
|
+
|
|
265
|
+
**❌ Bad:**
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
const spring = useSpring({ opacity: 1 }, []);
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**✅ Good:**
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
const spring = useSpring({ opacity: isOpen ? 1 : 0 }, [isOpen]);
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Configuration:**
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
{
|
|
281
|
+
"cease-nonsense/no-useless-use-spring": ["error", {
|
|
282
|
+
"springHooks": ["useSpring", "useMotion"],
|
|
283
|
+
"treatEmptyDepsAsViolation": true
|
|
284
|
+
}]
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
260
288
|
**✅ Good:**
|
|
261
289
|
|
|
262
290
|
```typescript
|
package/dist/build-metadata.json
CHANGED
|
@@ -2,6 +2,7 @@ import type { BanInstancesOptions } from "./rules/ban-instances";
|
|
|
2
2
|
import type { ComplexityConfiguration } from "./rules/enforce-ianitor-check-type";
|
|
3
3
|
import type { NoInstanceMethodsOptions } from "./rules/no-instance-methods-without-this";
|
|
4
4
|
import type { NoShorthandOptions } from "./rules/no-shorthand-names";
|
|
5
|
+
import { type NoUselessUseSpringOptions } from "./rules/no-useless-use-spring";
|
|
5
6
|
import type { EffectFunctionOptions, HookConfiguration } from "./rules/require-named-effect-functions";
|
|
6
7
|
import type { PairConfiguration, RequirePairedCallsOptions } from "./rules/require-paired-calls";
|
|
7
8
|
import type { ReactKeysOptions } from "./rules/require-react-component-keys";
|
|
@@ -80,3 +81,9 @@ export declare function createUseExhaustiveDependenciesOptions(options?: Partial
|
|
|
80
81
|
* @returns The full options
|
|
81
82
|
*/
|
|
82
83
|
export declare function createUseHookAtTopLevelOptions(options?: Partial<UseHookAtTopLevelOptions>): UseHookAtTopLevelOptions;
|
|
84
|
+
/**
|
|
85
|
+
* Creates options for no-useless-use-spring rule
|
|
86
|
+
* @param options - Partial configuration options
|
|
87
|
+
* @returns The full options
|
|
88
|
+
*/
|
|
89
|
+
export declare function createNoUselessUseSpringOptions(options?: Partial<NoUselessUseSpringOptions>): NoUselessUseSpringOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { TSESLint } from "@typescript-eslint/utils";
|
|
2
2
|
import type { Rule } from "eslint";
|
|
3
3
|
type AnyRuleModule = Rule.RuleModule | TSESLint.AnyRuleModuleWithMetaDocs;
|
|
4
|
-
export { createBanInstancesOptions, createComplexityConfiguration, createEffectFunctionOptions, createHookConfiguration, createNoInstanceMethodsOptions, createNoShorthandOptions, createPairConfiguration, createReactKeysOptions, createRequirePairedCallsOptions, createUseExhaustiveDependenciesOptions, createUseHookAtTopLevelOptions, defaultRobloxProfilePair, } from "./configure-utilities";
|
|
4
|
+
export { createBanInstancesOptions, createComplexityConfiguration, createEffectFunctionOptions, createHookConfiguration, createNoInstanceMethodsOptions, createNoUselessUseSpringOptions, createNoShorthandOptions, createPairConfiguration, createReactKeysOptions, createRequirePairedCallsOptions, createUseExhaustiveDependenciesOptions, createUseHookAtTopLevelOptions, defaultRobloxProfilePair, } from "./configure-utilities";
|
|
5
5
|
export type { BanInstancesOptions } from "./rules/ban-instances";
|
|
6
6
|
export type { ComplexityConfiguration } from "./rules/enforce-ianitor-check-type";
|
|
7
7
|
export type { NoInstanceMethodsOptions } from "./rules/no-instance-methods-without-this";
|
|
8
8
|
export type { NoShorthandOptions } from "./rules/no-shorthand-names";
|
|
9
|
+
export type { NoUselessUseSpringOptions } from "./rules/no-useless-use-spring";
|
|
9
10
|
export type { EffectFunctionOptions, EnvironmentMode, HookConfiguration } from "./rules/require-named-effect-functions";
|
|
10
11
|
export type { PairConfiguration, RequirePairedCallsOptions } from "./rules/require-paired-calls";
|
|
11
12
|
export type { ReactKeysOptions } from "./rules/require-react-component-keys";
|