Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Support for HHVM/Hack 3.28, more migrations, as-you-type linting, other improvements

Compare
Choose a tag to compare
@kmeht kmeht released this 29 Aug 15:45

This release supports (and requires) HHVM 3.28

New Features

  • add migration to convert PHP stdlib to the HSL
  • add add-you-type linting in supported editors
  • better diff previews for auto-fixing linters when linting from CLI
  • all lint autofixes are now available within supported editors; previously, all lint errors were exposed, but only AST-based lint errors could be fixed within editors

API Changes

  • EditableList is now EditableList<T as EditableNode>
  • methods that return A|B|Missing now return ?EditableNode; this is to increase consistency, as A|Missing returns ?A
  • getFile() now returns a File object, including both a path and content. Linters must operate on the content exposed here for as-you-type linting to work correctly
  • fixLintErrors() has been removed, replaced with getFixedFile(); getFixedFile() must not edit the file on disk, but should return a new File object with modification applied
  • getPrettyTextforNode() no longer takes a $context parameter; this is rarely used, and requires major usability compromises to the rest of the API. Implementations should store context themselves, or re-calculate it here.
  • FixableLintError has been removed: any LintError is fixable if the linter is an AutoFixingLinter
  • LSPAutoFixingLinter has been removed; all AutoFixingLinters are now fixable via LSP; this is built on top of getFixedFile() and getTitleForFix()
  • Merged BaseASTLintError and ASTLintError into ASTLintError: this distinction was to provide a simpler API for common cases, however the removal of FixableLintError and $context removed all differences.

Other Changes

  • removed --io-log-prefix option; the situations where it was useful are better served by in-editor logging, or using a wrapper along the lines of tee stdin.log | path/to/real/hhast-lint "$@" 2>stderr.log | tee stdout.log, as the IO logs only contain output that goes through certain abstractions, rather than all process output.
  • added HHAST_LSP_DEBUG environment variable, which prints various state changes to stderr