ESLint: a value for parserOptions.project

Published February 13, 2020 • 1 minute read

A few days ago, the eslint-config-airbnb-typescript project updated from 6.3.2 to 7.0.0. It is an important upgrade, as the project now supports the latest TypeScript version. Amongst other things, it means that we won't have to deal with this warning anymore.

However, if you followed my ESLint guide, this update will most likely break your configuration. The reason is that two breaking changes were introduced in this 7.0.0 realease.

First, @typescript-eslint/eslint-plugin must be upgraded to 2.19.0. For example:

npm install @typescript-eslint/eslint-plugin@^2.19.0 --save-dev

Then, you must set the parserOptions.project attribute in your ESLint configuration. The reason for that is that some new rules which require type information were introduced and they need to know where your tsconfig.json file is in order to work properly.

I'm quite suprised that this attribute does not have tsconfig.json or, more explicitely, ./tsconfig.json as a default but anyway, here is how to fix it in a YAML configuration:

  ecmaVersion: 6
  project: tsconfig.json

In case you don't already have a tsconfig.json file, here is how you can generate a default one, providing that typescript is already a local dependency of the project:

npx tsc --init

Related links:

← Back to the index