Repository navigation
Refuse names that differ only in case in lint:structure - #28
Merged
Merged
Conversation
ActionFields.tsx sat beside actionFields.ts, and RuleNotes.tsx beside ruleNotes.ts. On macOS and Windows, whose file systems ignore case, `./ActionFields` found actionFields.ts first, which exports no component, so the Release workflow's build failed there while Linux (and CI) passed. actionFields.ts becomes ruleActionFields.ts, after RULE_ACTION_FIELDS, and ruleNotes.ts becomes ruleNotesFor.ts, its function ruleNotesFor.
macOS and Windows ignore case, so ActionFields.tsx beside actionFields.ts made `./ActionFields` load the helper there, and the 0.4.0 installers failed to build while Linux, and so CI, passed. lint:structure now walks src, scripts and test and refuses, in one folder, two names that differ only in case, or two modules (folders, or files with one of Vite's resolve extensions) an import without an extension reaches by names that do. A stylesheet beside its component (Markdown.tsx, markdown.css) is imported by its whole name and passes. CLAUDE.md, CONTRIBUTING, the SPEC and the code-structure skill say so.
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The 0.4.0 Release workflow failed to build the installers on macOS and Windows (run 14):
ActionFields.tsxsat besideactionFields.ts, andRuleNotes.tsxbesideruleNotes.ts. macOS and Windows ignore case, soimport './ActionFields'foundactionFields.tsfirst. CI builds only on Linux, so nothing caught it until the release. olehwebdev/console-editor#27 fixes those two pairs. This PR stops the mistake from coming back.npm run lint:structurenow also walkssrc,scriptsandtestand refuses, within one folder:Logo.svg,logo.svg). These can't even coexist in a checkout on macOS or Windows.resolve.extensions(.mjs .js .mts .ts .jsx .tsx .json). Examples:ActionFields.tsxbesideactionFields.ts, or a folderfoo/besideFoo.ts.It passes:
Markdown.tsxbesidemarkdown.css: a stylesheet is imported by its whole name, so the two never meet.Foo.tsbesideFoo.tsx): no case is involved, so every file system treats them the same.The check runs wherever
lint:structurealready does: CI, the pre-push hook, and the agents' stop hook. It needs no new wiring.Code:
scripts/structure/:caseClashes.ts: the pure check for one folder's entries;lookupNames.ts: the names a lookup reaches an entry by;findCaseClashes.ts: the walk;constants.ts: the checked roots and module extensions.check-structure.tsadds the walk's findings to its report.Docs: CLAUDE.md and CONTRIBUTING (the rule, and the
lint:structurecomment), the SPEC's test table, and the code-structure skill's naming step.The branch also carries #27's rename commit (
8acf75a, the same change). Without it,lint:structurewould fail onmain, which still has both pairs. Git merges the identical rename cleanly, whichever PR merges first.How it was tested
main's tree, before the rename,npm run lint:structurereports exactly the two pairs:Code structure: 2238 files OK.).test/unit/checkStructure.test.ts:.jsonbeside.js;srcandtestare named by folder,docs/is ignored, and the tree passes once they're removed.npm run typecheck,lint:fsd,lint:structure,lint,lint:unused,lint:duplicatesandlint:secretspass.npm testpasses (1,175).xvfb-run -a npm run test:e2epasses (109).inspect.e2e.test.ts› "opens the original read-only…": a poll with vitest's default 1-second timeout, waiting for the bundle to open.Checklist
feature/…,bugfix/…) intomain, and does one thingnpm run typecheck,npm run lint:fsd,npm run lint:structure,npm run lint,npm run lint:unused,npm run lint:duplicates,npm run lint:secrets,npm testandnpm run test:e2epassdocs/SPEC.mddescribes any behaviour this changes (its test table lists the new rule)[Unreleased]inCHANGELOG.md(none: tooling only)