neoclide / coc-eslint

Eslint extension for coc.nvim
MIT License
396 stars 24 forks source link

The rule no-undef doesn't work? #125

Closed Napoleon-Jm closed 2 years ago

Napoleon-Jm commented 2 years ago

The "no-undef" rule is not work in cos-eslint, but it's worked on my vscode(same js code). And other lint error tips' ok, did I miss something to config?

There is nothing special on my coc config, almost is default.

Add below code to my js file, and saved,

abc=bac

Both of them(abc, bcd) should be lint a "no-undef", while vscode does, but coc not.

chemzqm commented 2 years ago

Checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel

Napoleon-Jm commented 2 years ago

Checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel

The output:

` [Info - 8:16:16 ├F10: PM┤] Local tsserver not found, using bundled tsserver with coc-tsserver. [Info - 8:16:16 ├F10: PM┤] using npm from /Users/jimin/.nvm/versions/node/v12.22.0/bin/npm [Info - 8:16:16 ├F10: PM┤] Forking TSServer PATH: /Users/jimin/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js [Info - 8:16:16 ├F10: PM┤] Starting TSServer { "path": "/Users/jimin/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib", "_pathLabel": "", "_api": { "versionString": "4.5.5", "version": "4.5.5" } } [Trace - 8:16:16 ├F10: PM┤] Sending request: configure (0). Response expected: no. Current queue length: 0 Arguments: { "hostInfo": "coc-nvim", "preferences": { "providePrefixAndSuffixTextForRename": true, "allowRenameOfImportPath": true, "includePackageJsonAutoImports": "auto" } } [Trace - 8:16:16 ├F10: PM┤] Sending request: compilerOptionsForInferredProjects (1). Response expected: no. Current queue length: 0 Arguments: { "options": { "module": "commonjs", "target": "es2016", "jsx": "preserve", "allowJs": true, "allowSyntheticDefaultImports": true, "allowNonTsExtensions": true } } [Trace - 8:16:16 ├F10: PM┤] Event received: typingsInstallerPid (0). Data: { "pid": 6355 } [Trace - 8:16:16 ├F10: PM┤] Sending request: updateOpen (2). Response expected: yes. Current queue length: 0 Arguments: { "changedFiles": [], "closedFiles": [], "openFiles": [ { "file": "/Users/jimin/MyWorkSpace/js2uml/src/js2seq/index.js", "fileContent": "\nclass Js2Seq {\n\n constructor(a) {\n this.a = a;\n }\n\n abc = b;\n static convert() {\n return null;\n }\n}\n\nexport {\n Js2Seq,\n};\n", "projectRootPath": "/Users/jimin/MyWorkSpace/js2uml", "scriptKindName": "JS" } ] } [Trace - 8:16:17 ├F10: PM┤] Response received: updateOpen (2). Request took 1493 ms. Success: true Result: true [Trace - 8:16:17 ├F10: PM┤] Sending request: geterr (3). Response expected: yes. Current queue length: 0 Arguments: { "delay": 0, "files": [ "/Users/jimin/MyWorkSpace/js2uml/src/js2seq/index.js" ] }

`

.eslintrc

` { "env": { "browser": true, "es2021": true, "node": true }, "extends": [ "eslint:recommended" ], "parserOptions": { "ecmaFeatures": { "jsx": true }, "ecmaVersion": "latest", "sourceType": "module" }, "rules": { } }

`

@chemzqm The fileContent as the code upon, has a abc = b, that will caused a undef lint tip in vscode, but coc doesn't.

chemzqm commented 2 years ago

The output is from tsserver, not eslint.

chemzqm commented 2 years ago

Maybe you have "typescript.showUnused": false config

Napoleon-Jm commented 2 years ago

The eslintrc has upload on my first replay,

:CocCommand workspace.showOutput

just give me two options.... watchman or tsserver

chemzqm commented 2 years ago

Seems you don't have eslint server running.