Repository navigation
M3 G7: Astro rules in eslint-plugin-webtops (W-28, W-30, W-31) - #69
Merged
Merged
Conversation
… <script> blocks (G7) Three rules on the Astro parser, read by node shape like the others: - astro-client-load-ack (W-28): a client:load directive needs a comment right before the element, <!-- webtops-ack W-28: reason -->. The comment is the only acknowledgement read here (ack.ts is the one place to widen when the ledger form lands). - astro-assets-image (W-30): no <img>; an Image or Picture imported from astro:assets needs width and height, inferSize, or a spread. - astro-frontmatter-size (W-31): more than 10 statements in the frontmatter, nested ones counted, imports, type declarations and the template not. The preset enables W-28 for web-app and astro-site, W-30 and W-31 for astro-site, all on .astro files, and public-env-only also on the <script> blocks of a page (the files eslint-plugin-astro names page.astro/0.ts). Linting an .astro file through the preset did not work: the Astro parser does not take projectService, and the script blocks have no project. The astro variant now gives .astro files `project`, and script blocks no types. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…same lazy data The G7 rules take their module data as functions and their metadata as getters, the plugin and the preset decide the Astro rules by class (W-28 for astro-site and web-app, W-30 and W-31 for astro-site), and the astro variant keeps the parser options that make .astro files and their script blocks lint. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…el (G7) The Astro rules read their constants, regex and metadata where they are used, as the first three rules do, and tests now pin what the first G7 gate left alive: a spread beside other attributes, a named Image from another module, a member element, an empty comment between an acknowledgement and its element, and an acknowledgement written as plain text. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the files its rules match (G7) A class that maps an .astro-scoped rule now gets the Astro parser config when the project depends on astro, whatever its variant. Before, web-app (react variant) had W-28 enabled on **/*.astro with no parser, so a page failed to parse. init lists eslint-plugin-astro among web-app's conditional tools (a new optional astro_tools list in the profile), installed and locked only where the project depends on astro. Tests: a live web-app run with an .astro file, the preset's parser choice, the init tool list, and class-rules.test.ts lints a module, a React module and a page for every class and fails on any parse error. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The helper cleans up through onTestFinished instead of a module-level list, so there is no state to leave unobserved, and its prefix, cleanup and tsconfig text are pinned by tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
M3 G7 adds three Astro rules to
eslint-plugin-webtops, running on the Astro parser.G7a and G7b: the rules
Each rule has valid and invalid cases.
astro-client-load-ackclient:loaddirective without an ack. Until the ack ledger lands, the ack is an<!-- webtops-ack W-28: reason -->comment directly before the elementastro-assets-imageastro:assets(<Image>,<Picture>) with dimensionsastro-frontmatter-sizesrc/rules/ack.ts. ItsackReasonis the one place the ack ledger (G8) will widen.src/index.tsregisters the three rules, andindex.test.tscovers that.src/presets/eslint.jsenables the rules for the Astro class and sets up the Astro file parser. The parser setup is also what makes theastrovariant lint.astrofiles at all, and it applies W-37 to client<script>blocks.src/presets/presets.test.tschecks the rules per class, and runs a live test on a scratch Astro project..astrooutside the Astro class: when a class maps an.astro-scoped rule and the project depends onastro, the preset adds the Astro parser config, whatever its variant. A web-app project's.astrofiles therefore parse.initlistseslint-plugin-astroamong web-app's conditional tools, and a test checks that each class's preset can parse every file kind its rules match.fixtures/init/astro-site/eslint.preset.json.goldenis updated, because theastro-sitepreset output changed.G7c, reading W-28's ack from the ledger, completes when G8 lands. The comment ack is the named stub until then.
Gate on this head
layers: 5 in range, 5 ran, 0 failed, 0 not-evaluated. The gate took 6m51s on a 10-CPU machine.🤖 Generated with Claude Code