Skip to content

JavaScript and TypeScript integration

w0rp edited this page Aug 18, 2020 · 4 revisions

ALE integrates with almost all JavaScript tools very well, and most things should work without requiring any configuration.

Linter installation guides

ESLint

ESLint is the most popular linter for JavaScript code, and can be installed in your project like so.

# Install ESLInt with NPM
npm install eslint --save-dev
# Create an initial configuration file.
./node_modules/.bin/eslint --init

After ESLInt is installed in your project, ALE should discover it and run it automatically.

tsserver (TypeScript)

ALE integrates with TypeScript's built-in version of a server similar to language servers with Language Server Protocol. Make sure TypeScript is installed in your project.

npm install typescript

ALE will discover the location of tsserver in node_modules and run it automatically for checking your code.

Outstanding issues

Flow

Using check-contents and the flow language server have problems which make using either annoying to use. The check-contents command doesn't load types from other files correctly. The flow language server deletes all of the type errors for files when you edit a file. Here is what needs to be fixed.

  • ALE should eventually switch to using flow's language server only by default if a new enough version of flow is installed.
  • The flow maintainers need to fix this bug. This bug prevents you from being able to check for flow errors while you type.
  • Until the flow language server is fixed to work properly, this suggestion should be used to disable displaying any errors while you type. (This liveSyntaxErrors option isn't documented.)