Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not report any errors #49

Closed
stellarhoof opened this issue Aug 16, 2020 · 4 comments · Fixed by #141
Closed

Does not report any errors #49

stellarhoof opened this issue Aug 16, 2020 · 4 comments · Fixed by #141

Comments

@stellarhoof
Copy link

stellarhoof commented Aug 16, 2020

I can't seem to get this to work. Is there any way of enabling some sort of debugging?

My jsconfig.json:

 "options": {
    "allowJs": true,
    "maxNodeModuleJsDepth": 2,
    "allowSyntheticDefaultImports": true,
    "skipLibCheck": true,
    "noEmit": true,
    "plugins": [
      {
        "name": "typescript-eslint-language-service"
      }
    ]
 }

Relevant part of my tsserver log:

Info 8    [15:20:10.250] Enabling plugin typescript-eslint-language-service from candidate paths: /Users/berserk/Code/smartprocure/futil/node_modules/typescript/lib/tsserver.js/../../..
Info 9    [15:20:10.251] Loading typescript-eslint-language-service from /Users/berserk/Code/smartprocure/futil/node_modules/typescript/lib/tsserver.js/../../.. (resolved to /Users/berserk/Code/smartprocure/futil/node_modules/node_modules)
Info 10   [15:20:10.630] [typescript-eslint-language-service] config: {"name":"typescript-eslint-language-service"}
Info 11   [15:20:10.640] Plugin validation succeded
Info 12   [15:20:10.658] Starting updateGraphWorker: Project: /Users/berserk/Code/smartprocure/futil/jsconfig.json
Info 13   [15:20:12.965] Finishing updateGraphWorker: Project: /Users/berserk/Code/smartprocure/futil/jsconfig.json Version: 1 structureChanged: true Elapsed: 2307ms
Info 14   [15:20:12.965] Project '/Users/berserk/Code/smartprocure/futil/jsconfig.json' (Configured)
Info 15   [15:20:12.965] 	Files (417)

Info 16   [15:20:12.965] -----------------------------------------------
Info 17   [15:20:13.6] Project '/Users/berserk/Code/smartprocure/futil/jsconfig.json' (Configured)
Info 17   [15:20:13.6] 	Files (417)

Info 17   [15:20:13.6] -----------------------------------------------
Info 17   [15:20:13.6] Open files: 
Info 17   [15:20:13.6] 	FileName: /Users/berserk/Code/smartprocure/futil/src/function.js ProjectRootPath: /Users/berserk/Code/smartprocure/futil
Info 17   [15:20:13.6] 		Projects: /Users/berserk/Code/smartprocure/futil/jsconfig.json
Info 17   [15:20:13.404] [typescript-eslint-language-service] use '@typescript-eslint/parser'

My .eslintrc.js:

module.exports = {
  extends: 'smartprocure',
  parser: 'babel-eslint',
  parserOptions: {
    sourceType: 'module'
  }
}

And my devDependencies:

{
  "devDependencies": {
    "eslint": "^7.7.0",
    "@typescript-eslint/parser": "^3.9.0",
    "@typescript-eslint/typescript-estree": "^3.9.0",
    "typescript": "^3.9.7",
    "typescript-eslint-language-service": "^3.1.0",
    "typescript-language-server": "^0.4.0",
  }
} 
@mickaelistria
Copy link

Same issue here. Eclipse Wild Web Developer is using this plugin; but trying to upgrade to newer version shows similar symptoms, also with typescript-language-server.

@lorenzodallavecchia
Copy link

I'm having the same issue. I traced down the cause in my case.

In tsserver.log I see.

Info 600  [10:49:45.340] [typescript-eslint-language-service] The "path" argument must be of type string. Received undefined

The culprit is a call to path.extname inside @eslint/eslintrc/lib/config-array-factory.js (line 305).

function loadConfigFile(filePath) {
    switch (path.extname(filePath)) {
        // ...
    }
}

filePath is undefined.

Tracing back, the missing file path is the real path of eslint:recommended and it should have been passed to the CascadingConfigArrayFactory constructor as second-last parameter.

The language service plugin is not passing any parameter (which seems to be allowed by CascadingConfigArrayFactory), so the default undefined is being used.

In the end, this looks like a ESLint bug, since they have an optional argument with no default. The bug was introduced by the PR eslint/eslintrc#11.

A workaround is to stop using the eslint:recommended alias in .eslintrc.js.

module.exports = {
    // ...
    extends: [
        require.resolve("eslint/conf/eslint-recommended.js"),  // should be "eslint:recommended"
        "plugin:@typescript-eslint/recommended",
    ],
    // ...
};

@mickaelistria
Copy link

FWIW, Wild Web Developer migrated to use the language server that's behind the vscode-eslint extension and doesn't use this tsserver plugin any more.

@Quramy
Copy link
Owner

Quramy commented Dec 30, 2020

@lorenzodallavecchia Thanks for your comment. It helped me so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants