@pobammer-ts/eslint-cease-nonsense-rules 1.5.2 → 1.6.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.
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-god-components": "error",
39
40
  "cease-nonsense/no-useless-use-spring": "error",
40
41
  "cease-nonsense/use-exhaustive-dependencies": "error",
41
42
  "cease-nonsense/use-hook-at-top-level": "error",
@@ -114,6 +115,35 @@ Bans React.FC and similar component type annotations. Use explicit function decl
114
115
 
115
116
  React.FC (Function Component) and related types break debug information in React DevTools, making profiling exponentially harder. They also encourage poor patterns and add unnecessary complexity.
116
117
 
118
+ #### `no-god-components`
119
+
120
+ Flags React components that are too large or doing too much, pushing you toward extracting hooks/components/utilities.
121
+
122
+ Checks (defaults):
123
+
124
+ - Component body line count: target `120`, hard max `200`
125
+ - TSX nesting depth ≤ `3`
126
+ - Stateful hooks ≤ `5` (counts `useState`, `useReducer`, `useBinding` by default)
127
+ - Destructured props in parameters ≤ `5`
128
+ - Runtime `null` literals are always banned
129
+
130
+ **Configuration:**
131
+
132
+ ```typescript
133
+ {
134
+ "cease-nonsense/no-god-components": ["error", {
135
+ targetLines: 120,
136
+ maxLines: 200,
137
+ maxTsxNesting: 3,
138
+ maxStateHooks: 5,
139
+ stateHooks: ["useState", "useReducer", "useBinding"],
140
+ maxDestructuredProps: 5,
141
+ enforceTargetLines: true,
142
+ ignoreComponents: ["LegacyComponent"]
143
+ }]
144
+ }
145
+ ```
146
+
117
147
  **❌ Bad:**
118
148
 
119
149
  ```typescript
@@ -1,5 +1,5 @@
1
1
  {
2
- "commit": "12c06ad5566d08fbf3f48f5203aff7fdc61a801f",
3
- "time": "2025-12-11T22:26:23.456Z",
4
- "version": "1.5.2"
2
+ "commit": "cee43b8397ea4513dfaa07a29159dc9559cbca45",
3
+ "time": "2025-12-19T08:25:21.635Z",
4
+ "version": "1.6.0"
5
5
  }
@@ -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 { NoGodComponentsOptions } from "./rules/no-god-components";
5
6
  import { type NoUselessUseSpringOptions } from "./rules/no-useless-use-spring";
6
7
  import type { EffectFunctionOptions, HookConfiguration } from "./rules/require-named-effect-functions";
7
8
  import type { PairConfiguration, RequirePairedCallsOptions } from "./rules/require-paired-calls";
@@ -69,6 +70,12 @@ export declare function createRequirePairedCallsOptions(options?: Partial<Requir
69
70
  * @returns The full options
70
71
  */
71
72
  export declare function createReactKeysOptions(options?: Partial<ReactKeysOptions>): ReactKeysOptions;
73
+ /**
74
+ * Creates options for no-god-components rule
75
+ * @param options - Partial configuration options
76
+ * @returns The full options
77
+ */
78
+ export declare function createNoGodComponentsOptions(options?: Partial<NoGodComponentsOptions>): NoGodComponentsOptions;
72
79
  /**
73
80
  * Creates a use-exhaustive-dependencies options for use-exhaustive-dependencies rule
74
81
  * @param options - Partial configuration options
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, createNoUselessUseSpringOptions, createNoShorthandOptions, createPairConfiguration, createReactKeysOptions, createRequirePairedCallsOptions, createUseExhaustiveDependenciesOptions, createUseHookAtTopLevelOptions, defaultRobloxProfilePair, } from "./configure-utilities";
4
+ export { createBanInstancesOptions, createComplexityConfiguration, createEffectFunctionOptions, createHookConfiguration, createNoGodComponentsOptions, 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 { NoGodComponentsOptions } from "./rules/no-god-components";
9
10
  export type { NoUselessUseSpringOptions } from "./rules/no-useless-use-spring";
10
11
  export type { EffectFunctionOptions, EnvironmentMode, HookConfiguration } from "./rules/require-named-effect-functions";
11
12
  export type { PairConfiguration, RequirePairedCallsOptions } from "./rules/require-paired-calls";
@@ -39,6 +40,7 @@ declare const recommended: {
39
40
  readonly "cease-nonsense/no-async-constructor": "error";
40
41
  readonly "cease-nonsense/no-color3-constructor": "error";
41
42
  readonly "cease-nonsense/no-instance-methods-without-this": "error";
43
+ readonly "cease-nonsense/no-god-components": "error";
42
44
  readonly "cease-nonsense/no-print": "error";
43
45
  readonly "cease-nonsense/no-shorthand-names": "error";
44
46
  readonly "cease-nonsense/no-warn": "error";