eslint-plugin-sweepit 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jenna Smith (@jjenzz)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # eslint-plugin-sweepit
2
+
3
+ Opinionated architectural lint rules.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install --save-dev eslint-plugin-sweepit eslint
9
+ ```
10
+
11
+ ## Usage (Flat config)
12
+
13
+ ```js
14
+ import sweepit from 'eslint-plugin-sweepit';
15
+
16
+ export default [...sweepit.configs.react];
17
+ ```
18
+
19
+ ## Type Information (Accuracy Boost)
20
+
21
+ Most rules are AST-first and work without TypeScript project services.
22
+
23
+ Some rules become more accurate when ESLint has type information available (for example, they can detect typed identifiers/calls beyond inline literals):
24
+
25
+ - `sweepit/no-array-props`
26
+ - `sweepit/no-object-props`
27
+ - `sweepit/no-optional-props-without-defaults`
28
+
29
+ To enable type-aware linting in your app config:
30
+
31
+ ```js
32
+ languageOptions: {
33
+ parserOptions: {
34
+ projectService: true,
35
+ tsconfigRootDir: process.cwd(),
36
+ },
37
+ }
38
+ ```
39
+
40
+ ## What `configs.react` includes
41
+
42
+ The exported React config is opinionated. It enables:
43
+
44
+ - Third-party React/TS plugins:
45
+ - `eslint-plugin-react`
46
+ - `eslint-plugin-react-hooks`
47
+ - `eslint-plugin-react-you-might-not-need-an-effect`
48
+ - `@typescript-eslint/eslint-plugin` (with `@typescript-eslint/parser`)
49
+ - Third-party rules (all as `error`):
50
+ - `react/jsx-handler-names`
51
+ - `react/jsx-no-constructed-context-values`
52
+ - `react/jsx-no-useless-fragment`
53
+ - `react/jsx-pascal-case`
54
+ - `react/no-unstable-nested-components`
55
+ - `react-hooks/rules-of-hooks`
56
+ - `react-hooks/exhaustive-deps`
57
+ - `react-you-might-not-need-an-effect/no-effect`
58
+ - Sweepit rules listed below (all as `error` in the default config)
59
+
60
+ ## Customize rule defaults
61
+
62
+ Override any default rule from `sweepit.configs.react`.
63
+
64
+ ```js
65
+ import sweepit from 'eslint-plugin-sweepit';
66
+
67
+ export default [
68
+ ...sweepit.configs.react,
69
+ {
70
+ rules: {
71
+ // disable a default rule
72
+ 'react-hooks/exhaustive-deps': 'off',
73
+ // tune sweepit rules
74
+ 'sweepit/no-array-props': 'warn',
75
+ 'sweepit/no-prefixed-prop-bundles': ['error', { threshold: 4 }],
76
+ },
77
+ },
78
+ ];
79
+ ```
80
+
81
+ ## Included rules
82
+
83
+ | Rule | Description |
84
+ | --- | --- |
85
+ | [`sweepit/no-title-case-props`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-title-case-props.md) | Disallows TitleCase JSX props and enforces camelCase prop names. |
86
+ | [`sweepit/no-custom-kebab-case-props`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-custom-kebab-case-props.md) | Disallows custom kebab-case JSX props (except allowed prefixes like `aria-*` and `data-*`). |
87
+ | [`sweepit/no-set-prefix-utils`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-set-prefix-utils.md) | Reserves `set*` naming for `useState` setters, not utility/helper functions. |
88
+ | [`sweepit/no-useless-hook`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-useless-hook.md) | Disallows `use*` functions that do not call a real React hook. |
89
+ | [`sweepit/no-hook-jsx`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-hook-jsx.md) | Disallows hooks returning JSX; `use*` should return behavior/data, not markup. |
90
+ | [`sweepit/no-exported-context-hooks`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-exported-context-hooks.md) | Disallows exporting `use*Context` hooks to keep context internals private. |
91
+ | [`sweepit/no-handler-return-type`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-handler-return-type.md) | Enforces `void` return types for `on*` handler prop contracts. |
92
+ | [`sweepit/jsx-server-action-prop-suffix`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/jsx-server-action-prop-suffix.md) | Requires async callback props to be named `action` or end with `Action`. |
93
+ | [`sweepit/jsx-on-handler-verb-suffix`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/jsx-on-handler-verb-suffix.md) | Ensures `on*` handler prop names end with a verb (for example `onValueChange`). |
94
+ | [`sweepit/no-render-helper-functions`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-render-helper-functions.md) | Disallows JSX-returning functions unless they use PascalCase component naming. |
95
+ | [`sweepit/no-element-props`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-element-props.md) | Restricts `ReactNode`/`ReactElement` prop usage to explicit composition conventions (`children`/`render`). |
96
+ | [`sweepit/no-componenttype-props`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-componenttype-props.md) | Disallows `ComponentType`/`FC`/`FunctionComponent` props in component contracts. |
97
+ | [`sweepit/no-object-props`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-object-props.md) | Disallows object-valued JSX props; with type info enabled it also catches typed identifiers/calls. |
98
+ | [`sweepit/no-array-props`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-array-props.md) | Disallows array-valued JSX props; with type info enabled it also catches typed identifiers/calls. |
99
+ | [`sweepit/no-prefixed-prop-bundles`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-prefixed-prop-bundles.md) | Treats grouped prefixed prop declarations (for example `userName/userEmail/userRole`) as a composition-pressure signal once they hit a configured threshold (default `3`). |
100
+ | [`sweepit/no-optional-props-without-defaults`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-optional-props-without-defaults.md) | Disallows optional component props unless defaulted at the component boundary; type info improves optional-prop detection accuracy. |
101
+ | [`sweepit/no-boolean-capability-props`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-boolean-capability-props.md) | Disallows boolean props without associated control handlers (for example `open` without `onOpenChange`) in component contracts. |
102
+ | [`sweepit/max-custom-props`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/max-custom-props.md) | Limits custom prop count in `*Props` contracts (default max `8`) to surface composition pressure early. |
103
+ | [`sweepit/jsx-bem-compound-naming`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/jsx-bem-compound-naming.md) | Enforces block-prefixed naming for exported compound component parts. |
104
+ | [`sweepit/jsx-compound-part-export-naming`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/jsx-compound-part-export-naming.md) | Enforces `Root`/part alias export naming for compound component modules. |
105
+ | [`sweepit/no-pass-through-props`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/no-pass-through-props.md) | Disallows props that are only forwarded unchanged to children. |
106
+ | [`sweepit/jsx-flat-owner-tree`](https://github.com/jjenzz/sweepit/tree/main/packages/eslint-plugin-sweepit/docs/rules/jsx-flat-owner-tree.md) | Encourages flatter parent component ownership trees by limiting deep handoff chains. |