Repository navigation
UN-4270 [FEAT] v1 scaffold, strict TypeScript and import boundary - #2380
Draft
jaseemjaskp wants to merge 2 commits into
Draft
jaseemjaskp wants to merge 2 commits into
jaseemjaskp wants to merge 2 commits into
Conversation
…N-4270) Adds frontend/src/v1/ as an isolated tree for the v1 frontend (P0-T01): - Folder taxonomy from the spec, a public entry (src/v1/index.ts, imported by v0 as `@v1`) and a cloud overlay placeholder. - src/v1/tsconfig.json: strict, no JS, unused locals/params are errors, `@v1` alias only. v0's tsconfig/jsconfig exclude src/v1. - Biome overrides for the two-way import boundary and v1 bans (no `../`, `@/`, prop-types, antd, component CSS; noExplicitAny). - scripts/check-v1.mjs for what Biome cannot express: TypeScript-only files, the folder taxonomy and import contract, PropTypes, `ant-`. - typecheck:v1, lint:v1 and test:v1 scripts; v0 scripts are unchanged. - test-fixtures/v1-boundary/ proves each rule fails and passes as specified, run with node --test so the v0 vitest suite never sees it. - .gitignore re-includes src/v1/lib/ (the Python `lib/` rule matched it). v0 build output, test counts, typecheck and Biome results are unchanged.
| } | ||
| // biome.json enables VCS integration with `useIgnoreFile`, which needs a | ||
| // repository root holding an ignore file. | ||
| execFileSync("git", ["init", "-q"], { cwd: dir }); |
| let output = ""; | ||
| for (const step of run) { | ||
| const command = scripts[step] ?? step; | ||
| const result = spawnSync("sh", ["-c", command], { |
| .filter((d) => d.isFile()) | ||
| .map((d) => path.relative(FRONTEND, path.join(d.parentPath, d.name))), | ||
| ); | ||
| const result = spawnSync("git", ["check-ignore", "--no-index", "--stdin"], { |
…270) check-v1.mjs: - Scan comments with a string/template-aware tokenizer; a `/*` or `//` inside a string or line comment no longer hides the imports after it. - Read template-literal specifiers, import.meta.glob and `import(..., opts)`. - Flag specifiers that leave src/v1 (`/`, `..`, `@/`, `src/`) itself, not only via Biome, which skips template literals. - Check `@import`/`url()` and `ant-` in styles/ CSS; report symlinks; catch built `ant-` names; treat .test/.spec .mts/.cts as test files; ignore .DS_Store; drop the unused --root option. biome.json: also ban `..`, `./../**`, `/**`, `antd/**`, `prop-types/**`. tsconfig: skipLibCheck off so v1's own .d.ts files are checked. .gitignore: re-include lib/ at any depth under src/v1. Fixtures: a generated matrix over every folder-contract pair, every import form, every outside spelling, a symlink case, and cases for each new rule; tsc cases assert error codes; output matching excludes the command text and spawn errors fail loudly. Comment and README corrections.
Contributor
Author
Self-review (draft)Four review passes (code, tests, comments, silent failures) were run against Fixed
Not changed, by design or out of scope
v0 regression (re-run on
|
|
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
frontend/src/v1/, an isolated tree for the v1 frontend. It has the folder taxonomy from the spec, a public entry (src/v1/index.ts, which v0 imports as@v1) and a placeholder for the cloud overlay.src/v1/tsconfig.json).src/v1.@v1entry.prop-types, antd, component.css, explicitany.ant-class prefix, PropTypes assignments, component style files outsidestyles/.components/ui/may import onlylib/andstyles/, and pages may not import other pages.typecheck:v1,lint:v1andtest:v1scripts. v0 scripts are unchanged.Why
How
../,@/,src/), v0 ↛ v1 except@v1noRestrictedImportsin twooverridesinbiome.json. This already runs inbiome ci src/, pre-commit and editorsprop-types,antd,@ant-design/*, component.css, explicitanysrc/v1/**override@v1aliassrc/v1/tsconfig.json. It lives in the folder so editors pick it up; v0tsconfig.json/jsconfig.jsonexcludesrc/v1styles/, folder taxonomyscripts/check-v1.mjs --files, run first bytypecheck:v1ant-class prefixscripts/check-v1.mjs --code, run bylint:v1Why some rules live in a script rather than Biome:
v1-base-rules-still-applyfixture checks that the shared rules still apply under v1.allowJs: falsemakestscskip a.jsfile rather than fail on it. That is why the--filescheck runs beforetsc../,@v1/, or a package name.ant-check is temporary. Remove it once the shadcn migration completes.test-fixtures/v1-boundary/holds one case per rule. For each case, the runner builds a throwaway frontend tree, overlays the case's files and runs the realpackage.jsonscripts. It usesnode --test, andtest-fixtures/**is excluded from vitest, so the v0 suite never collects it.Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
src/v1, and nothing in v0 imports from there today.src/plugins/tree, which cloud CI lints with thisbiome.json. That is intended: cloud v0 plugins must not reach into v1 either.Database Migrations
Env Config
Relevant Docs
frontend/src/v1/README.md: the rules, the folder contract table and the scripts.Related Issues or PRs
:v1scripts into CI is P0-T10.Dependencies Versions
Notes on Testing
v0 no-regression, before (
main@ 6e14fa7) and after:vite build: sha256 of every non-sourcemap output file (239 files)76925c7e…bun run test --runbun run typecheckbiome ci src/v1:
bun run typecheck:v1andbun run lint:v1pass on the empty scaffold.bun run test:v1passes 22/22: 20 rule cases, a check that every case folder is listed, and a check that no v1 or fixture file is git-ignored.Two other fixes the fixtures turned up:
.gitignore: the root Pythonlib/rule matchedsrc/v1/lib/, so its files would never have been committed. The PR re-includes it, and a test guards against it happening again.check-jsonpre-commit hook: the exclude now coversfrontend/src/v1/tsconfig.json, which contains comments, matching what the hook already does forfrontend/tsconfig.json.Screenshots
N/A
Checklist
I have read and understood the Contribution Guidelines.