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

LSP support, additional linters, `expect()` migration

Compare
Choose a tag to compare
@fredemmott fredemmott released this 20 Jul 01:58

LSP Support

hhast-lint's LSP mode is now supported, providing IDE integration for lint errors and auto fixes.

LSP support requires HHVM 3.27.1 or later for stability.

Atom IDE

Install the atom-ide-ui and ide-hhast packages.

Nuclide

Install the ide-hhast package.

screen shot 2018-07-19 at 1 51 46 pm

Visual Studio Code

Install vscode-hack v1.0 or above:

screen shot 2018-07-19 at 1 00 20 pm

Implementing in other editors

Execute hhast-lint --mode lsp --from your-editor-name-here.

initializationOptions.lintMode can be set to 'whole-project' or 'open-files'; whole-project is the default.

HHAST does not replace hh_client lsp; editors/plugins should be configured to use both.

New Linters

  • Add auto-fixing license header linter: if a .LICENSE_HEADER.hh.txt is present, it must be present as a comment in all files in the directory or recursive subdirectories
  • Add auto-fixing linter banning use statements with a leading backslash (the backslash does not affect the meaning)
  • Add auto-fixing linter banning unused parameters, unless they start with an underscore (e.g. $_)
  • Add auto-fixing linter banning unused use clauses

Linter Changes

  • CamelCasedMethodsUnderscoredFunctionsLinter now requires that methods are lowerCamelCase
  • UseStatementWithAsLinter no longer suggests removing the 'as' as a fix; this almost always introduces many errors.

New Migration

Added bin/hhast-migrate --assert-to-expect to migrate to fbexpect.