Open
Conversation
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.
@lightningjs/eslint-plugin-blitsis an ESLint plugin specifically created for Blits framework. This initial version lints Blits templates inside JS/TS files via template literals.PR updates
package.jsonand loads the right schema. Use settings:{ blits: { version: 2 } }to pin it explicitly.border,rounded,shadow,shaderadded as v2-only attributes.effectsandwordwrapremoved.roundedalso accepts array form in v2 ([tl, tr, br, bl]).Layoutcan have most of the attributes thatElementcan have.$shallowno longer triggers a false positive invalid-template-syntax.scaleandmountnow accept any numeric value,letterspacingaccepts negative values.only-valid-attributes-for-tagsnow reports unknown attributes on built-in tags (Element, Text, Layout, RouterView). Previously they were silently skipped.slotattribute added to attribute level checks.valid-attribute-valuenow validates object keys for attributes with a closed key set (color, scale, fit, etc.).Rules
valid-template-syntax— parser errors (mismatched tags, unclosed attributes, etc.)require-single-root-element— templates must have a single root elementonly-valid-attributes-for-tags— unknown or tag-incompatible attributes on built-in elementsvalid-attribute-value— validates attribute values against the Blits schema (enums, ranges, numeric constraints, object-form values, regex patterns)Structure
configs.recommendedpreset; ESLint 8 is supported (rules work, no preset)data/template-attributes.jsonis the full attribute schema used by the validation rulesdocs/attributes/has per-attribute documentation (47 files)Test setup
To try this locally in a Blits project before it's on npm, install from the local path:
ESLint 9 (flat config)
ESLint 8 (legacy config)
Notes
Element,Text,Layout,RouterView). User-defined components are not checked.:attr) skip scalar validation where static values don't apply.alpha="$opacity") are treated as variable references and skipped.