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 doesn't work with eslint@8 #127

Closed
MuhammadSawalhy opened this issue Feb 23, 2022 · 10 comments
Closed

Coc-eslint doesn't work with eslint@8 #127

MuhammadSawalhy opened this issue Feb 23, 2022 · 10 comments

Comments

@MuhammadSawalhy
Copy link

MuhammadSawalhy commented Feb 23, 2022

It seems that coc-eslint doesn't work with eslint@8. I guessed that this is due to upgrading eslint from major version 7 to major version 8 with some breaking changes, because there was another issue due to these breaking changes that I solved alhadulilah. But now, coc-eslint doesn't work with eslint@8. I tried eslint extension of VSCode to detect from where this issue came. Eslint in VSCode works.

image

image

@MuhammadSawalhy
Copy link
Author

I downgraded to eslint@^7.32.0

@chemzqm
Copy link
Member

chemzqm commented Feb 23, 2022

Can't reproduce, try check the output https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel.
Or create a minimal repo that helps to reproduce this issue.

@MuhammadSawalhy
Copy link
Author

MuhammadSawalhy commented Feb 23, 2022

Can't reproduce, try check the output https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel. Or create a minimal repo that helps to reproduce this issue.

I think I have broken .eslintrc.js, but VSCode's eslint extension still working, and coc-eslint doesn't display any error message or any complaints

[Info  - 7:15:24 PM] ESLint server running in node v16.13.2
[Info  - 7:15:24 PM] ESLint server is running.
[Info  - 7:15:25 PM] ESLint library loaded from: /home/ms/myp/scicave/freelancing-task-management/frontend/node_modules/eslint/lib/api.js
[Info  - 7:15:25 PM] Invalid Options: - Unknown options: envs - 'envs' has been removed. Please use the 'overrideConfig.env' option instead.

@MuhammadSawalhy
Copy link
Author

verbose

[Trace - 7:25:14 PM] Sending request 'initialize - (0)'.
Params: {
    "processId": 659439,
    "rootPath": "/home/ms/myp/scicave/freelancing-task-management/frontend",
    "rootUri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "textOnlyTransactional",
                "normalizesLineEndings": true
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                }
            },
            "codeLens": {
                "refreshSupport": true
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "fileOperations": {
                "dynamicRegistration": true,
                "didCreate": true,
                "didRename": true,
                "didDelete": true,
                "willCreate": true,
                "willRename": true,
                "willDelete": true
            },
            "semanticTokens": {
                "refreshSupport": true
            },
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                },
                "codeDescriptionSupport": true,
                "dataSupport": true
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true,
                    "insertReplaceSupport": true,
                    "tagSupport": {
                        "valueSet": [
                            1
                        ]
                    },
                    "resolveSupport": {
                        "properties": [
                            "documentation",
                            "detail",
                            "additionalTextEdits"
                        ]
                    },
                    "insertTextModeSupport": {
                        "valueSet": [
                            1,
                            2
                        ]
                    }
                },
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                },
                "insertTextMode": 2
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "activeParameterSupport": true,
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                }
            },
            "references": {
                "dynamicRegistration": true
            },
            "definition": {
                "dynamicRegistration": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                },
                "labelSupport": true
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": true,
                "disabledSupport": true,
                "dataSupport": true,
                "honorsChangeAnnotations": false,
                "resolveSupport": {
                    "properties": [
                        "edit"
                    ]
                },
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true
            },
            "documentLink": {
                "dynamicRegistration": true,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true
            },
            "implementation": {
                "dynamicRegistration": true
            },
            "declaration": {
                "dynamicRegistration": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true
            },
            "selectionRange": {
                "dynamicRegistration": true
            },
            "callHierarchy": {
                "dynamicRegistration": true
            },
            "linkedEditingRange": {
                "dynamicRegistration": true
            },
            "semanticTokens": {
                "dynamicRegistration": true,
                "tokenTypes": [
                    "namespace",
                    "type",
                    "class",
                    "enum",
                    "interface",
                    "struct",
                    "typeParameter",
                    "parameter",
                    "variable",
                    "property",
                    "enumMember",
                    "event",
                    "function",
                    "method",
                    "macro",
                    "keyword",
                    "modifier",
                    "comment",
                    "string",
                    "number",
                    "regexp",
                    "operator"
                ],
                "tokenModifiers": [
                    "declaration",
                    "definition",
                    "readonly",
                    "static",
                    "deprecated",
                    "abstract",
                    "async",
                    "modification",
                    "documentation",
                    "defaultLibrary"
                ],
                "formats": [
                    "relative"
                ],
                "requests": {
                    "range": true,
                    "full": {
                        "delta": true
                    }
                },
                "multilineTokenSupport": false,
                "overlappingTokenSupport": false
            }
        },
        "window": {
            "showMessage": {
                "messageActionItem": {
                    "additionalPropertiesSupport": true
                }
            },
            "showDocument": {
                "support": true
            },
            "workDoneProgress": true
        },
        "general": {
            "regularExpressions": {
                "engine": "ECMAScript",
                "version": "ES2020"
            },
            "markdown": {
                "parser": "marked",
                "version": "4.0.10"
            }
        }
    },
    "initializationOptions": {},
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend",
            "name": "frontend"
        }
    ],
    "locale": "en_US",
    "clientInfo": {
        "name": "coc.nvim",
        "version": "0.0.80"
    },
    "workDoneToken": "21c05bcc-24f3-4ba5-92b1-8b0c210db084"
}


[Trace - 7:25:14 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "ESLint server running in node v16.13.2"
}


[Info  - 7:25:14 PM] ESLint server running in node v16.13.2
[Trace - 7:25:14 PM] Received notification '$/progress'.
Params: {
    "token": "21c05bcc-24f3-4ba5-92b1-8b0c210db084",
    "value": {
        "kind": "begin",
        "title": "Initializing ESLint Server"
    }
}


[Trace - 7:25:14 PM] Received notification '$/progress'.
Params: {
    "token": "21c05bcc-24f3-4ba5-92b1-8b0c210db084",
    "value": {
        "kind": "end"
    }
}


[Trace - 7:25:14 PM] Received response 'initialize - (0)' in 102ms.
Result: {
    "capabilities": {
        "textDocumentSync": {
            "openClose": true,
            "change": 2,
            "willSaveWaitUntil": false,
            "save": {
                "includeText": false
            }
        },
        "workspace": {
            "workspaceFolders": {
                "supported": true
            }
        },
        "codeActionProvider": {
            "codeActionKinds": [
                "quickfix",
                "source.fixAll.eslint"
            ]
        },
        "executeCommandProvider": {
            "commands": [
                "eslint.applySingleFix",
                "eslint.applySuggestion",
                "eslint.applySameFixes",
                "eslint.applyAllFixes",
                "eslint.applyDisableLine",
                "eslint.applyDisableFile",
                "eslint.openRuleDoc"
            ]
        }
    }
}


[Info  - 7:25:14 PM] ESLint server is running.
[Trace - 7:25:14 PM] Sending notification 'initialized'.
Params: {}


[Trace - 7:25:14 PM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/src/components/ChooseEntityDataGridFilter.js",
        "languageId": "javascript",
        "version": 1,
        "text": "import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport ChooseEntityInput from \"./ChooseEntityInput\";\n\nclass ChooseEntityDataGridFilter extends React.Component {\n  setValue(value) {\n    this.setState({ value });\n  }\n\n  render() {\n    return render(\n      <ChooseEntityInput\n        Component={Component}\n        onChange={({ id }) => this.setState({ value: id })}\n      />\n    );\n  }\n}\n\nChooseEntityDataGridFilter.propTypes = {\n  render: PropTypes.func,\n  Component: PropTypes.Node,\n\n};\n\nexport default ChooseEntityDataGridFilter;\n"
    }
}


[Trace - 7:25:14 PM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/.eslintrc.js",
        "languageId": "javascript",
        "version": 1,
        "text": "const path = require(\"path\");\n\nmodule.exports = {\n  root: true,\n  env: {\n    node: true,\n    es2021: true\n  },\n  extends: [\"eslint:recommended\", \"plugin:import/recommended\"],\n  rules: {},\n  settings: {\n    \"import/resolver\": {\n      \"babel-module\": {}\n    }\n  },\n  overrides: [\n    {\n      files: [\"./src/**/*.js\"],\n      extends: [\n        \"plugin:react/recommended\",\n        \"plugin:react-hooks/recommended\",\n        \"plugin:jsx-a11y/recommended\"\n      ],\n      env: {\n        browser: true,\n        es2021: true,\n        node: true,\n        commonjs: true\n      },\n      parser: \"@babel/eslint-parser\",\n      parserOptions: {\n        babelOptions: {\n          configFile: path.resolve(__dirname, \"babel.config.js\")\n        }\n      },\n      rules: { \"jsx-a11y/anchor-is-valid\": 0 }\n    },\n    {\n      files: [\"./src/pages/**/*.js\"],\n      rules: { \"react/prop-types\": 0 }\n    },\n    {\n      files: [\"./**/*.test.js\", \"./jest.setup.js\"],\n      env: { \"jest/globals\": true },\n      plugins: [\"jest\"]\n    }\n  ]\n};\n"
    }
}


[Trace - 7:25:14 PM] Received request 'client/registerCapability - (0)'.
Params: {
    "registrations": [
        {
            "id": "343bb02b-9599-49e0-b8d7-ff70064ff269",
            "method": "workspace/didChangeConfiguration",
            "registerOptions": {}
        }
    ]
}


[Trace - 7:25:14 PM] Sending response 'client/registerCapability - (0)'. Processing request took 1ms
No result returned.


[Trace - 7:25:14 PM] Received request 'client/registerCapability - (1)'.
Params: {
    "registrations": [
        {
            "id": "2f7e3fa3-6511-4063-acbe-40e8b10a2e81",
            "method": "workspace/didChangeWorkspaceFolders",
            "registerOptions": {}
        }
    ]
}


[Trace - 7:25:14 PM] Sending response 'client/registerCapability - (1)'. Processing request took 1ms
No result returned.


[Trace - 7:25:14 PM] Received request 'workspace/configuration - (2)'.
Params: {
    "items": [
        {
            "scopeUri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/src/components/ChooseEntityDataGridFilter.js",
            "section": ""
        }
    ]
}


[Trace - 7:25:14 PM] Sending response 'workspace/configuration - (2)'. Processing request took 3ms
Result: [
    {
        "validate": "probe",
        "packageManager": "npm",
        "useESLintClass": false,
        "codeActionOnSave": {
            "enable": false,
            "mode": "all"
        },
        "format": false,
        "quiet": false,
        "onIgnoredFiles": "off",
        "options": {
            "envs": [
                "node",
                "browser",
                "es2021"
            ]
        },
        "rulesCustomizations": [],
        "run": "onType",
        "nodePath": null,
        "workspaceFolder": {
            "name": "frontend",
            "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend"
        },
        "codeAction": {
            "disableRuleComment": {
                "enable": true,
                "location": "separateLine"
            },
            "showDocumentation": {
                "enable": true
            }
        }
    }
]


[Trace - 7:25:14 PM] Received request 'workspace/configuration - (3)'.
Params: {
    "items": [
        {
            "scopeUri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/.eslintrc.js",
            "section": ""
        }
    ]
}


[Trace - 7:25:14 PM] Sending response 'workspace/configuration - (3)'. Processing request took 2ms
Result: [
    {
        "validate": "probe",
        "packageManager": "npm",
        "useESLintClass": false,
        "codeActionOnSave": {
            "enable": false,
            "mode": "all"
        },
        "format": false,
        "quiet": false,
        "onIgnoredFiles": "off",
        "options": {
            "envs": [
                "node",
                "browser",
                "es2021"
            ]
        },
        "rulesCustomizations": [],
        "run": "onType",
        "nodePath": null,
        "workspaceFolder": {
            "name": "frontend",
            "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend"
        },
        "codeAction": {
            "disableRuleComment": {
                "enable": true,
                "location": "separateLine"
            },
            "showDocumentation": {
                "enable": true
            }
        }
    }
]


[Trace - 7:25:15 PM] 'npm config get prefix' value is: /home/ms/.volta/tools/image/node/16.13.2
[Trace - 7:25:15 PM] NODE_PATH value is: /home/ms/.volta/tools/image/node/16.13.2/lib/node_modules
[Trace - 7:25:15 PM] NODE_PATH value is: /home/ms/.volta/tools/image/node/16.13.2/lib/node_modules
[Trace - 7:25:15 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "ESLint library loaded from: /home/ms/myp/scicave/freelancing-task-management/frontend/node_modules/eslint/lib/api.js"
}


[Info  - 7:25:15 PM] ESLint library loaded from: /home/ms/myp/scicave/freelancing-task-management/frontend/node_modules/eslint/lib/api.js
[Trace - 7:25:15 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/src/components/ChooseEntityDataGridFilter.js",
    "diagnostics": []
}


[Trace - 7:25:15 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Invalid Options: - Unknown options: envs - 'envs' has been removed. Please use the 'overrideConfig.env' option instead."
}


[Info  - 7:25:15 PM] Invalid Options: - Unknown options: envs - 'envs' has been removed. Please use the 'overrideConfig.env' option instead.
[Trace - 7:25:15 PM] Received notification 'eslint/status'.
Params: {
    "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/src/components/ChooseEntityDataGridFilter.js",
    "state": 1
}


[Trace - 7:25:15 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/.eslintrc.js",
    "diagnostics": []
}


[Trace - 7:25:15 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "Invalid Options: - Unknown options: envs - 'envs' has been removed. Please use the 'overrideConfig.env' option instead."
}


[Info  - 7:25:15 PM] Invalid Options: - Unknown options: envs - 'envs' has been removed. Please use the 'overrideConfig.env' option instead.
[Trace - 7:25:15 PM] Received notification 'eslint/status'.
Params: {
    "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/.eslintrc.js",
    "state": 1
}

@MuhammadSawalhy
Copy link
Author

OK it is from coc-settings.json:

  "eslint.options": { "envs": ["node", "browser", "es2021"] }

According to the README.md, I followed the link to make sure that overrideConfig.env is ok with eslint@8... So I changed coc-settings.json to

  "eslint.options": {
    "overrideConfig": {
      "env": ["node", "browser", "es2021"]
    }
  },

But here is what I got

[Trace - 7:33:11 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "ESLint configuration in CLIOptions is invalid: \t- Property \"env\" is the wrong type (expected object but got `[\"node\",\"browser\",\"es2021\"]`). "
}


[Info  - 7:33:11 PM] ESLint configuration in CLIOptions is invalid: 	- Property "env" is the wrong type (expected object but got `["node","browser","es2021"]`). 
[Trace - 7:33:11 PM] Received notification 'eslint/status'.
Params: {
    "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/.eslintrc.js",
    "state": 1
}


[Trace - 7:33:11 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/src/components/ChooseEntityDataGridFilter.js",
    "diagnostics": []
}


[Trace - 7:33:11 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "ESLint configuration in CLIOptions is invalid: \t- Property \"env\" is the wrong type (expected object but got `[\"node\",\"browser\",\"es2021\"]`). "
}


[Info  - 7:33:11 PM] ESLint configuration in CLIOptions is invalid: 	- Property "env" is the wrong type (expected object but got `["node","browser","es2021"]`). 
[Trace - 7:33:11 PM] Received notification 'eslint/status'.
Params: {
    "uri": "file:///home/ms/myp/scicave/freelancing-task-management/frontend/src/components/ChooseEntityDataGridFilter.js",
    "state": 1
}

@chemzqm
Copy link
Member

chemzqm commented Feb 23, 2022

You have to use something like:

 "env": {
            "browser": true,
            "node": true
        }

according to https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments

@MuhammadSawalhy
Copy link
Author

Not it is working, thank you! You should display some error message without pushing us to open the verbose logs.

@chemzqm
Copy link
Member

chemzqm commented Feb 23, 2022

[Trace - 7:33:11 PM] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "ESLint configuration in CLIOptions is invalid: \t- Property \"env\" is the wrong type (expected object but got `[\"node\",\"browser\",\"es2021\"]`). "
}


[Info  - 7:33:11 PM] ESLint configuration in CLIOptions is invalid: 	- Property "env" is the wrong type (expected object but got `["node","browser","es2021"]`). 

It's logged to info, no need for verbose message.

@chemzqm chemzqm closed this as completed Feb 23, 2022
@gabrielgrover
Copy link

Giving this thread a +1 as a fix for getting coc-eslint working with eslint@8

@chemzqm
Copy link
Member

chemzqm commented May 23, 2022

It works with eslint@8, check the output channel of eslint.

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

3 participants