muescha / vfile-location

utility to convert between positional (line and column-based) and offset (range-based) locations
https://unifiedjs.com
MIT License
0 stars 0 forks source link

Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated #1

Open muescha opened 4 years ago

muescha commented 4 years ago
Error: Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
Occurred while linting /Users/muescha/Work/github/muescha/vfile-location/types/vfile-location-tests.ts

i get this error while using:

full log:

Full Logfile ```shell [17:21:48] muescha:~/Work/github/muescha/vfile-location $ nvm use 13.7.0 Now using node v13.7.0 (npm v6.13.6) [17:22:10] muescha:~/Work/github/muescha/vfile-location $ node --version v13.7.0 [17:22:13] muescha:~/Work/github/muescha/vfile-location $ yarn yarn install v1.22.4 info No lockfile found. [1/4] πŸ” Resolving packages... warning dtslint > @definitelytyped/utils > npm-registry-client > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 warning xo > globby > fast-glob > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated warning xo > globby > fast-glob > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated [2/4] 🚚 Fetching packages... [3/4] πŸ”— Linking dependencies... [4/4] πŸ”¨ Building fresh packages... success Saved lockfile. ✨ Done in 57.64s. [17:23:15] muescha:~/Work/github/muescha/vfile-location $ yarn test yarn run v1.22.4 $ npm run format && npm run build && npm run test-coverage && npm run test-types npm WARN lifecycle The node binary used for scripts is /var/folders/0j/6_kmjc_51bv7nn26xx2dvrdm0000gn/T/yarn--1589988229732-0.8324450352172217/node but npm is using /Users/muescha/.nvm/versions/node/v13.7.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. > vfile-location@3.0.1 format /Users/muescha/Work/github/muescha/vfile-location > remark . -qfo && prettier --write "**/*.{js,ts}" && xo --fix index.js 101ms test.js 45ms types/index.d.ts 276ms types/vfile-location-tests.ts 26ms Error: Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser. Occurred while linting /Users/muescha/Work/github/muescha/vfile-location/types/vfile-location-tests.ts at Object.getParserServices (/Users/muescha/Work/github/muescha/vfile-location/node_modules/@typescript-eslint/experimental-utils/dist/eslint-utils/getParserServices.js:15:15) at create (/Users/muescha/Work/github/muescha/vfile-location/node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js:30:37) at Object.create (/Users/muescha/Work/github/muescha/vfile-location/node_modules/@typescript-eslint/experimental-utils/dist/eslint-utils/RuleCreator.js:12:24) at createRuleListeners (/Users/muescha/Work/github/muescha/vfile-location/node_modules/eslint/lib/linter/linter.js:746:21) at /Users/muescha/Work/github/muescha/vfile-location/node_modules/eslint/lib/linter/linter.js:916:31 at Array.forEach () at runRules (/Users/muescha/Work/github/muescha/vfile-location/node_modules/eslint/lib/linter/linter.js:861:34) at Linter._verifyWithoutProcessors (/Users/muescha/Work/github/muescha/vfile-location/node_modules/eslint/lib/linter/linter.js:1157:31) at Linter._verifyWithoutProcessors (/Users/muescha/Work/github/muescha/vfile-location/node_modules/eslint-plugin-eslint-comments/lib/utils/patch.js:165:42) at Linter._verifyWithConfigArray (/Users/muescha/Work/github/muescha/vfile-location/node_modules/eslint/lib/linter/linter.js:1255:21) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! vfile-location@3.0.1 format: `remark . -qfo && prettier --write "**/*.{js,ts}" && xo --fix` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the vfile-location@3.0.1 format script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/muescha/.npm/_logs/2020-05-20T15_23_57_932Z-debug.log error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ```
muescha commented 4 years ago

@wooorm you have any idea why this error is there?

wooorm commented 4 years ago

I don’t know TS so, /cc @ChristianMurphy!

muescha commented 4 years ago

note: it is just a plain checkout of the fork with no changes.

muescha commented 4 years ago

it looks like there is a breaking change:

https://github.com/iamturns/eslint-config-airbnb-typescript/pull/63

just now i have no clue how a tsconfig.json should need to look

wooorm commented 4 years ago

We don’t use eslint-config-airbnb πŸ€”

ChristianMurphy commented 4 years ago

The error is coming from xo, if it is locked to version 0.27.0 it works, version 0.27.2 errors, upgrading to ^0.30.0 also resolves the issue, but introduces some new rules which may request changes.

muescha commented 4 years ago

is the best if i stick to 0.27.0 now?

ChristianMurphy commented 4 years ago

That works for me

muescha commented 4 years ago

with 0.27.0 all works except test-types:

error TS2688: Cannot find type definition file for 'babel__core'.
error TS2688: Cannot find type definition file for 'babel__template'.
/Users/muescha/.nvm/versions/node/v12.13.1/bin/node /Users/muescha/.nvm/versions/node/v12.13.1/lib/node_modules/npm/bin/npm-cli.js run test-types --scripts-prepend-node-path=auto

> vfile-location@3.0.1 test-types /Users/muescha/Work/github/muescha/vfile-location
> dtslint types

Error: Errors in typescript@4.0 for external dependencies:
error TS2688: Cannot find type definition file for 'babel__core'.
error TS2688: Cannot find type definition file for 'babel__template'.

    at /Users/muescha/Work/github/muescha/vfile-location/node_modules/dtslint/bin/index.js:198:19
    at Generator.next (<anonymous>)
    at fulfilled (/Users/muescha/Work/github/muescha/vfile-location/node_modules/dtslint/bin/index.js:6:58)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vfile-location@3.0.1 test-types: `dtslint types`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vfile-location@3.0.1 test-types script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/muescha/.npm/_logs/2020-05-20T16_11_59_063Z-debug.log

Process finished with exit code 1
ChristianMurphy commented 4 years ago

@muescha could you try clearing node_modules and running npm install again? The typings don't use any of babel's types, and with a clean install I don't see that error.

muescha commented 4 years ago

i deleted the dir and checked out again.

then i changed:

-"xo": "^0.27.0"
+"xo": "0.27.0" 

but get the same error.

i tested also with npm instead of yarn, and also with node 12.14.0

i have no idea what is different :(

Full Log ```shell cd vfile-location/ [19:26:35] muescha:~/Work/github/muescha/vfile-location $ nano package.json [19:27:10] muescha:~/Work/github/muescha/vfile-location $ yarn install yarn install v1.22.4 info No lockfile found. [1/4] πŸ” Resolving packages... warning dtslint > @definitelytyped/utils > npm-registry-client > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 warning xo > globby > fast-glob > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated warning xo > globby > fast-glob > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated [2/4] 🚚 Fetching packages... [3/4] πŸ”— Linking dependencies... warning "xo > eslint-config-xo-typescript@0.26.0" has unmet peer dependency "typescript@>=3.5.3". warning "xo > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta". [4/4] πŸ”¨ Building fresh packages... success Saved lockfile. ✨ Done in 55.73s. [19:28:12] muescha:~/Work/github/muescha/vfile-location $ yarn test-types yarn run v1.22.4 $ dtslint types Error: Errors in typescript@4.0 for external dependencies: error TS2688: Cannot find type definition file for 'babel__core'. error TS2688: Cannot find type definition file for 'babel__template'. at /Users/muescha/Work/github/muescha/vfile-location/node_modules/dtslint/bin/index.js:198:19 at Generator.next () at fulfilled (/Users/muescha/Work/github/muescha/vfile-location/node_modules/dtslint/bin/index.js:6:58) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [19:29:29] muescha:~/Work/github/muescha/vfile-location $ yarn build yarn run v1.22.4 $ npm run build-bundle && npm run build-mangle npm WARN lifecycle The node binary used for scripts is /var/folders/0j/6_kmjc_51bv7nn26xx2dvrdm0000gn/T/yarn--1589995776846-0.2731964989413658/node but npm is using /Users/muescha/.nvm/versions/node/v12.14.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. > vfile-location@3.0.1 build-bundle /Users/muescha/Work/github/muescha/vfile-location > browserify . -s vfileLocation > vfile-location.js npm WARN lifecycle The node binary used for scripts is /var/folders/0j/6_kmjc_51bv7nn26xx2dvrdm0000gn/T/yarn--1589995776846-0.2731964989413658/node but npm is using /Users/muescha/.nvm/versions/node/v12.14.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. > vfile-location@3.0.1 build-mangle /Users/muescha/Work/github/muescha/vfile-location > browserify . -s vfileLocation -p tinyify > vfile-location.min.js ✨ Done in 7.29s. [19:29:43] muescha:~/Work/github/muescha/vfile-location $ yarn test-types yarn run v1.22.4 $ dtslint types Error: Errors in typescript@4.0 for external dependencies: error TS2688: Cannot find type definition file for 'babel__core'. error TS2688: Cannot find type definition file for 'babel__template'. at /Users/muescha/Work/github/muescha/vfile-location/node_modules/dtslint/bin/index.js:198:19 at Generator.next () at fulfilled (/Users/muescha/Work/github/muescha/vfile-location/node_modules/dtslint/bin/index.js:6:58) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [19:30:01] muescha:~/Work/github/muescha/vfile-location $ node --version v12.14.0 ```
ChristianMurphy commented 4 years ago

:thinking: the error specifically happens in TypeScript 4, with is the unreleased next major version. If you clear dtslint's cached typescript installs, usually in ~/.dts/typescript-installs. And run npm run test-types does that resolve the issue?

muescha commented 4 years ago

if i delete the 4.0 then it reinstalls it?


$rm -rf ~/.dts/typescript-installs/4.0/

$yarn test-types
yarn run v1.22.4
$ dtslint types
Installing to /Users/muescha/.dts/typescript-installs/4.0...
Installed!

Error: Errors in typescript@4.0 for external dependencies:
error TS2688: Cannot find type definition file for 'babel__core'.
error TS2688: Cannot find type definition file for 'babel__template'.

    at /Users/muescha/Work/github/muescha/vfile-location/node_modules/dtslint/bin/index.js:198:19
    at Generator.next (<anonymous>)
    at fulfilled (/Users/muescha/Work/github/muescha/vfile-location/node_modules/dtslint/bin/index.js:6:58)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
muescha commented 4 years ago

did you need my yarn.lock?

muescha commented 4 years ago

it looks like dtslint depends on the next:

yarn why typescript
yarn why v1.22.4
[1/4] πŸ€”  Why do we have the module "typescript"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] πŸ”  Finding dependency...
[4/4] 🚑  Calculating file sizes...
=> Found "typescript@4.0.0-dev.20200520"
info Reasons this module exists
   - "dtslint" depends on it
   - Hoisted from "dtslint#typescript"
info Disk size without dependencies: "52.65MB"
info Disk size with unique dependencies: "52.65MB"
info Disk size with transitive dependencies: "52.65MB"
info Number of shared dependencies: 0
=> Found "dts-critic#typescript@3.9.3"
info This module exists because "dtslint#dts-critic" depends on it.
info Disk size without dependencies: "52.31MB"
info Disk size with unique dependencies: "52.31MB"
info Disk size with transitive dependencies: "52.31MB"
info Number of shared dependencies: 0
✨  Done in 0.89s.

from yarn.lock:

dtslint@^3.0.0:
  version "3.6.3"
  resolved "https://registry.yarnpkg.com/dtslint/-/dtslint-3.6.3.tgz#be93c74fe00f99be6a89bab3b943d733c8c27893"
  integrity sha512-7zm45PbN6TQ6N/5gFPKveHt6zybgO+Xq50cviemLLyfbAhkh7I5ZZAE5adn5WjryjN36amkL0vtf1r0+7gWE2w==
  dependencies:
    "@definitelytyped/header-parser" "0.0.34"
    "@definitelytyped/typescript-versions" "0.0.34"
    "@definitelytyped/utils" "0.0.34"
    dts-critic "^3.2.2"
    fs-extra "^6.0.1"
    json-stable-stringify "^1.0.1"
    strip-json-comments "^2.0.1"
    tslint "5.14.0"
    typescript next
    yargs "^15.1.0"
ChristianMurphy commented 4 years ago

if i delete the 4.0 then it reinstalls it?

Exactly, it's a cache, dtslint automatically regenerates it when it's cleared


Error: Errors in typescript@4.0 for external dependencies:
error TS2688: Cannot find type definition file for 'babel__core'.
error TS2688: Cannot find type definition file for 'babel__template'.

One more thing to try, add "skipLibCheck: true, in tsconfig.json under compilerOptions. If the issue still persists, it's most likely bug in dtslint or TypeScript, we don't use the babel typings, they shouldn't be checked.

ChristianMurphy commented 4 years ago

I've mostly been testing with npm, I checked with yarn and didn't see any difference. Attached is the yarn file locked to dependency versions that work on my machine.

I'm running

$ node --version
v14.3.0
$ npm --version
6.14.5
$ yarn --version
1.22.4

yarn.lock

muescha commented 4 years ago

this is my setup:

$node --version
v12.14.0
$npm --version
6.13.4
$yarn --version
1.22.4

i will upgrade node via nvm and then npm too

and i check if your lockfile works better

PS: i will continue it tomorrow :)