Skip to content

Releases: runem/lit-analyzer

v1.2.0

15 Jul 19:37
Compare
Choose a tag to compare

Added

  • Added new rule no-property-visibility-mismatch. This rule will ensure public properties use @property and non-public properties use @internalProperty (#100)
  • Added new rule no-missing-element-type-definition This rule will ensure that custom elements are registered on the
    HTMLElementTagNameMap Typescript interface (#73)
  • It's now possible to configure how many modules deep dependencies are followed to determine whether a custom element is available in the current file. When -1 is used, dependencies will be followed infinitely deep. This can be configured for both external dependencies and project dependencies with maxNodeModuleImportDepth & maxProjectImportDepth (#116)
  • In addition to extending HTMLElementTagNameMap it's now also possible extend the HTMLElementEventMap interface and the HTMLElement interface (#53)

Example:

declare global {
  interface HTMLElementTagNameMap {
    "my-element": HTMLElement;
  }
  interface HTMLElementEventMap {
    "my-event": Event;
  }
}

/**
 * @attr my-attr
 */
interface HTMLElement {
  myProperty: string;
}
  • The role and controlslist attributes are now correctly type checked (#89)
  • Added autocompletion for CSS shadow parts and CSS custom properties in CSS. It's possible to document those using JSDoc (dd1ffc78)

Example:

/**
 * @cssprop {Color} --border-color - Sets the color of the border
 * @csspart content - The content of my element
 */
class MyElement extends HTMLElement {
}

Fixed and changed

  • Quick fix for missing imports now generates correct path on Windows (#110)
  • Type checking is now up to 15 times faster
  • is-assignable-in-boolean-binding now also accepts "null" and "undefined" types in boolean bindings. Example: <input ?required="${undefined}" />
  • "Fix message" is now included in the output for the CLI -no-unknown-property-converter has been removed and no-incompatible-property-type can be used instead.
  • Improved JSDoc support
  • Improved mixin support
  • Private and protected members are now also analyzed
  • All diagnostics in vscode are now reported as lit-plugin([RULE_ID]) and have unique diagnostic codes (#108)
  • When resolving imports for a given module, facade modules are always followed and do not increase depth (#114)
  • Improve codefix for 'no-missing-import' rule (#117)

Project

  • Refactoring of rule modules
  • Added more tests
  • lit-analyzer now uses data from vscode-web-custom-data
  • cancellationToken is now supported to prevent long running operations

v1.0.0

03 Apr 15:11
Compare
Choose a tag to compare

Added

  • Added support for observedAttributes, properties and jsdoc comments as well as web component libraries built with stencil. For more information see the library: web-component-analyzer.
  • Autocompletion and type checking for properties. Properties on built in elements are supported.
  • Autocompletion and name checking for slots. Add slots to your component using @slot myslot jsdoc.
  • Autocompletion and name checking for events. new CustomEvent("myevent") in the component is found automatically or you can choose to add events to your component using @event myevent jsdoc.
  • Added check for using the property modifier without an expression, as this is not support by lit-html, to catch errors like .myProp="hello".
  • Added support for vscode custom html data format.
  • Added support for declaring attributes and properties using @attr myattr and @prop myprop jsdoc.
  • CSS autocompletion now includes all custom element tag names available.

Fixed

  • The web component analyzer is now much more stable and won't crash on strange inputs.

Removed

  • Temporarily disabled code formatting until issues with nested templates are solved.