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

Coc-eslint not working with yarn Plug'n'Play #142

Open
yarobash opened this issue May 15, 2023 · 2 comments
Open

Coc-eslint not working with yarn Plug'n'Play #142

yarobash opened this issue May 15, 2023 · 2 comments

Comments

@yarobash
Copy link

I'm trying to make coc.eslint work with Yarn Plug'n'Play but it fails.

I follow instruction https://yarnpkg.com/getting-started/editor-sdks

In project folder I've .vim folder with coc-settings.json file and here is its content:

{
  "workspace.workspaceFolderCheckCwd": false,
  "tsserver.tsdk": ".yarn/sdks/typescript/lib",
  "tsserver.useLocalTsdk": true,
  "eslint.nodePath": ".yarn/sdks",
  "eslint.packageManager": "yarn"
}

package.json:

{
  "name": "back-server",
  "packageManager": "yarn@3.5.1",
  "type": "module",
  "scripts": {
    "build": "tsc",
    "dev": "nodemon ./src/server.ts",
    "lint": "yarn eslint \"src/**/*.ts\" --fix"
  },
  "dependencies": {
    "@yarnpkg/pnpify": "^4.0.0-rc.43",
    "express": "^4.18.2",
    "mongoose": "^7.1.1"
  },
  "devDependencies": {
    "@eslint/js": "8.38.0",
    "@types/express": "4.17.17",
    "@types/node": "20.1.4",
    "@typescript-eslint/eslint-plugin": "5.43.0",
    "@typescript-eslint/parser": "5.59.1",
    "eslint": "8.0.1",
    "nodemon": "2.0.22",
    "ts-node": "10.9.1",
    "typescript": "5.0.4"
  }
}

I'm trying to set up new eslint config technique with eslint.config.js, and its content is:

import js from '@eslint/js';
import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';

export default [
  {
    languageOptions: {
      ecmaVersion: 2022,
      sourceType: 'module',
      parser: tsParser,
    },
    plugins: {
      tsPlugin,
    },
    ignores: ['dist'],
    files: ['src/**/*.ts'],
    ...js.configs.recommended,
    rules: {
      'semi': 'error',
      'no-unused-vars': 'off',
      'no-console': 'error',
      'tsPlugin/no-unused-vars': ['error']
    }
  }
]

I set in global coc-settings.json property "eslint.trace.server": "verbose" and output of CocCommand eslint.showOutputChannel besides other messages has the following messages resembling errors:

[Trace - 15:28:29.887] Sending response 'workspace/configuration - (2)'. Processing request took 2ms
Result: [
    {
        "validate": "probe",
        "packageManager": "yarn",
        "useESLintClass": false,
        "experimental": {
            "useFlatConfig": true
        },
        "codeActionOnSave": {
            "enable": false,
            "mode": "all"
        },
        "format": true,
        "quiet": false,
        "onIgnoredFiles": "off",
        "options": {},
        "rulesCustomizations": [],
        "run": "onType",
        "nodePath": "${workspace}/.yarn/sdks/eslint/lib",
        "workspaceFolder": {
            "name": "back",
            "uri": "file:///home/yaroslav/Projects/personal/garagecam/site/back"
        },
        "codeAction": {
            "disableRuleComment": {
                "enable": true,
                "location": "separateLine"
            },
            "showDocumentation": {
                "enable": true
            }
        }
    }
]


Uncaught exception received.
Error: spawn /home/yaroslav/.fnm/node-versions/v18.15.0/installation/bin/node ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[Trace - 15:28:36.625] Sending notification 'textDocument/didSave'.
Params: {
    "textDocument": {
        "uri": "file:///home/yaroslav/Projects/personal/garagecam/site/back/src/app.ts",
        "version": 1
    }
}

Is there any chance to make it work?

@diegoflorez
Copy link

I successfully made it operational by following the steps outlined at this link: https://yarnpkg.com/getting-started/editor-sdks.

@yarobash
Copy link
Author

I successfully made it operational by following the steps outlined at this link: https://yarnpkg.com/getting-started/editor-sdks.

Did you use any other commands as it needs to be with COC typescript plugin?
I've done everything that mentioned in that link to yarn manual, but my coc-eslint outputs nothing. ((

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

No branches or pull requests

2 participants