@colrealpro/react-luau-doctor 0.17.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ColRealPro
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,127 @@
1
+ # React-Luau Doctor
2
+
3
+ Find React-Luau mistakes before they reach your Roblox UI.
4
+
5
+ React-Luau Doctor checks `.lua` and `.luau` source files for hook mistakes, missing cleanup, render side effects, and avoidable rerenders. Findings include a category, severity, source location, and repair guidance. The `why` command explains individual findings and shows suggested changes where available.
6
+
7
+ This is a beta developer tool written in TypeScript and run with Bun. It analyzes React-Luau source on your computer or CI runner. It does not run inside Roblox Studio, analyze JavaScript/TypeScript React, or edit your code automatically.
8
+
9
+ ## Get started
10
+
11
+ Install [Bun](https://bun.com/) 1.3.14 or newer and Git, then build from source:
12
+
13
+ ```bash
14
+ git clone https://github.com/colrealpro/react-luau-doctor.git
15
+ cd react-luau-doctor
16
+ bun install --frozen-lockfile
17
+ bun run build
18
+ bun ./dist/cli.js ./examples --verbose
19
+ bun link
20
+ ```
21
+
22
+ From your Roblox project's directory:
23
+
24
+ ```bash
25
+ react-luau-doctor .
26
+ react-luau-doctor . --verbose
27
+ ```
28
+
29
+ The source checkout must remain available while you use the linked command. Run `bun unlink` in the tool's checkout to remove the link.
30
+
31
+ The package has not been published to npm yet. Source installation and generated CI work without an npm release. Once published, npm can distribute this CLI even though the source being analyzed is Luau; users will still need Bun.
32
+
33
+ ## Read a finding
34
+
35
+ For example, this component changes a prop during render:
36
+
37
+ ```luau
38
+ local React = require(script.Parent.React)
39
+
40
+ local function Label(props)
41
+ props.text = "Changed"
42
+ return React.createElement("TextLabel", { Text = props.text })
43
+ end
44
+
45
+ return Label
46
+ ```
47
+
48
+ Doctor reports `react-luau/no-prop-mutation`. Compute a local value instead of writing to `props`.
49
+
50
+ ```bash
51
+ react-luau-doctor why src/Label.luau:4
52
+ react-luau-doctor rules explain react-luau/no-prop-mutation
53
+ ```
54
+
55
+ Suggested changes are review guidance. Some are exact previews, others are example patterns that need adapting to your component.
56
+
57
+ ## What it checks
58
+
59
+ The rule catalog covers correctness, hooks, effects, performance, Roblox behavior, and architecture. Checks include conditional hooks, incomplete dependency tables, connections without cleanup, state updates during render, fresh props crossing memo boundaries, and externally updated state that may be better represented by a Binding.
60
+
61
+ ```bash
62
+ react-luau-doctor rules list
63
+ react-luau-doctor . --category Hooks
64
+ react-luau-doctor . --blocking error
65
+ ```
66
+
67
+ Errors are the highest severity. Warnings identify likely problems, while suggestions include lower-confidence findings that deserve review. You can override each rule's severity or disable it. A clean report is not proof of runtime correctness, and the score is a heuristic, not a performance measurement.
68
+
69
+ See the [rule catalog](docs/rules.md) and [analysis limits](docs/analysis.md).
70
+
71
+ ## Check a change
72
+
73
+ ```bash
74
+ react-luau-doctor . --scope changed --base main
75
+ react-luau-doctor . --scope lines --base main
76
+ react-luau-doctor . --staged
77
+ react-luau-doctor . --json-out doctor-report.json
78
+ ```
79
+
80
+ `changed` compares findings against a Git base. `lines` keeps findings that overlap changed lines. `--staged` reads index content, so later unstaged edits do not affect the checked file contents.
81
+
82
+ ## Add CI
83
+
84
+ From your Roblox repository:
85
+
86
+ ```bash
87
+ react-luau-doctor ci install --yes
88
+ ```
89
+
90
+ Commit the generated workflow and the entire `.github/actions/react-luau-doctor` directory. It contains the analyzer and its parser assets, so CI does not download an unpublished Doctor package. It installs the locked parser dependency and runs with Bun.
91
+
92
+ By default, pull requests receive advisory findings without failing the check. Enable a gate with:
93
+
94
+ ```bash
95
+ react-luau-doctor ci config --blocking error --yes
96
+ ```
97
+
98
+ [CI setup](docs/ci.md) explains permissions, fork PRs, updates, outputs, and GitLab support. Local tests exercise reporting against a simulated GitHub API. A real GitHub Actions run is still required to validate your repository's permissions and runner behavior.
99
+
100
+ ## Configure a project
101
+
102
+ Create `react-luau-doctor.config.json` in the directory where you run scans:
103
+
104
+ ```json
105
+ {
106
+ "include": ["src/**/*.luau"],
107
+ "ignore": ["src/generated/**"],
108
+ "rules": {
109
+ "react-luau/no-array-index-as-key": "off",
110
+ "react-luau/exhaustive-deps": "error"
111
+ }
112
+ }
113
+ ```
114
+
115
+ Use narrow inline suppressions when an individual finding is intentional:
116
+
117
+ ```luau
118
+ -- react-luau-doctor-disable-next-line no-array-index-as-key
119
+ ```
120
+
121
+ See the [CLI and configuration reference](docs/cli.md) for scanning, reporting, cache controls, and suppression syntax.
122
+
123
+ ## Contribute
124
+
125
+ Read [development and release checks](docs/development.md). For a false positive or missed issue, open an [issue](https://github.com/colrealpro/react-luau-doctor/issues) with the smallest Luau example you can share, the tool version, and the relevant configuration.
126
+
127
+ MIT licensed. Inspired by [React Doctor](https://github.com/millionco/react-doctor); not affiliated with its authors, Roblox, or the React-Luau maintainers. See [third-party notices](THIRD_PARTY_NOTICES.md) for parser attribution.
@@ -0,0 +1,18 @@
1
+ # Third-party notices
2
+
3
+ ## tree-sitter-luau
4
+
5
+ This project redistributes `tree-sitter-luau.wasm` from
6
+ `tree-sitter-grammars/tree-sitter-luau`, version 1.2.0.
7
+
8
+ The grammar is MIT licensed. Its license text is included at
9
+ `vendor/tree-sitter-luau.LICENSE`.
10
+
11
+ Project: https://github.com/tree-sitter-grammars/tree-sitter-luau
12
+
13
+ ## web-tree-sitter
14
+
15
+ The runtime parser is provided by `web-tree-sitter`, which is MIT licensed.
16
+ Its license is installed with the npm dependency.
17
+
18
+ Project: https://github.com/tree-sitter/tree-sitter
package/action.yml ADDED
@@ -0,0 +1,71 @@
1
+ name: React-Luau Doctor
2
+ description: "Review React-Luau pull requests and report introduced diagnostics."
3
+ inputs:
4
+ blocking:
5
+ description: "Severity that fails the workflow: error, warning, or none."
6
+ default: none
7
+ scope:
8
+ description: "Pull request scan scope: changed, files, lines, or full."
9
+ default: changed
10
+ comment:
11
+ description: "Create or update a sticky pull request summary comment."
12
+ default: "true"
13
+ review-comments:
14
+ description: "Post inline review comments on changed lines."
15
+ default: "true"
16
+ commit-status:
17
+ description: "Publish score and issue counts as a commit status."
18
+ default: "true"
19
+ project:
20
+ description: "Project directories to scan, comma-separated. Asterisk scans the whole directory."
21
+ default: "*"
22
+ directory:
23
+ description: "Project directory to scan."
24
+ default: "."
25
+ outputs:
26
+ score:
27
+ description: "Health score from 0 to 100."
28
+ value: ${{ steps.doctor.outputs.score }}
29
+ total-issues:
30
+ description: "Total diagnostics reported by this run."
31
+ value: ${{ steps.doctor.outputs.total-issues }}
32
+ fixed-issues:
33
+ description: "Number of diagnostics resolved by the pull request."
34
+ value: ${{ steps.doctor.outputs.fixed-issues }}
35
+ error-count:
36
+ description: "Error diagnostic count."
37
+ value: ${{ steps.doctor.outputs.error-count }}
38
+ warning-count:
39
+ description: "Warning diagnostic count."
40
+ value: ${{ steps.doctor.outputs.warning-count }}
41
+ affected-files:
42
+ description: "Number of files with diagnostics."
43
+ value: ${{ steps.doctor.outputs.affected-files }}
44
+ runs:
45
+ using: composite
46
+ steps:
47
+ - uses: oven-sh/setup-bun@v2
48
+ with:
49
+ bun-version: "1.3.14"
50
+ - name: Install parser runtime
51
+ shell: bash
52
+ run: |
53
+ cd "$GITHUB_ACTION_PATH"
54
+ bun install --production --frozen-lockfile
55
+ - id: doctor
56
+ shell: bash
57
+ env:
58
+ GITHUB_TOKEN: ${{ github.token }}
59
+ DOCTOR_DIRECTORY: ${{ inputs.directory }}
60
+ DOCTOR_PROJECT: ${{ inputs.project }}
61
+ DOCTOR_BLOCKING: ${{ inputs.blocking }}
62
+ DOCTOR_SCOPE: ${{ inputs.scope }}
63
+ run: >-
64
+ bun "$GITHUB_ACTION_PATH/dist/cli.js" ci run
65
+ --directory "$DOCTOR_DIRECTORY"
66
+ --project "$DOCTOR_PROJECT"
67
+ --blocking "$DOCTOR_BLOCKING"
68
+ --scope "$DOCTOR_SCOPE"
69
+ ${{ inputs.comment == 'true' && '--comment' || '--no-comment' }}
70
+ ${{ inputs.review-comments == 'true' && '--review-comments' || '--no-review-comments' }}
71
+ ${{ inputs.commit-status == 'true' && '--commit-status' || '--no-commit-status' }}