ecosse3 / nvim

A non-minimal Neovim config built to work most efficiently with Frontend Development
GNU General Public License v3.0
1.21k stars 109 forks source link

Eslint not working / using local config from .eslintrc #81

Closed nevenduranec closed 2 years ago

nevenduranec commented 2 years ago

If I do npx eslint {FILENAME}.vue I get no errors or warnings but in nvim I get CleanShot 2022-07-25 at 12 18 23

On refactor or on save if the auto format is enabled nothing is happening. How can I see what config file is used?

My eslint config:

{
    "plugins": ["vue", "prettier"],
    "root": true,
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "requireConfigFile": false,
        "parser": "@babel/eslint-parser",
        "ecmaVersion": 2018,
        "sourceType": "module",
        "allowImportExportEverywhere": true
    },
    "rules": {
        "vue/html-indent": ["error", 4, {
            "attribute": 1,
            "closeBracket": 0,
            "ignores": []
        }],
        "prettier/prettier": [
            "error",
            {
                "trailingComma": "es5",
                "tabWidth": 4,
                "singleQuote": true
            }
        ],
        "no-multiple-empty-lines": 0,
        "space-before-function-paren": 0,
        "vue/max-attributes-per-line": "off",
        "vue/attribute-hyphenation": "off",
        "vue/html-self-closing": [
            "error",
            {
                "html": {
                    "void": "any"
                }
            }
        ]
    },
    "extends": ["plugin:vue/strongly-recommended", "plugin:prettier/recommended"],
    "env": {
        "es6": true,
        "browser": true
    }
}

From the :LspLog

[WARN][2022-07-25 12:45:41] ...lsp/handlers.lua:113 "The language server eslint triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2022-07-25 12:45:42] ...lsp/handlers.lua:113 "The language server vuels triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2022-07-25 12:45:42] ...lsp/handlers.lua:113 "The language server eslint triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2022-07-25 12:45:42] ...lsp/handlers.lua:483    '(node:26579) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /{PROJECT}/node_modules/vuex/package.json.\nUpdate this package.json to use a subpath pattern like "./*".\n(Use `node --trace-deprecation ...` to show where the warning was created)'

From the :LspInfo


 Language client log: /Users/USER/.local/state/nvim/lsp.log
 Detected filetype:   vue

 3 client(s) attached to this buffer: 

 Client: eslint (id: 1, pid: 26578, bufnr: [3])
    filetypes:       javascript, javascriptreact, javascript.jsx, typescript, typescriptreact, typescript.tsx, vue
    autostart:       true
    root directory:  /Users/USER/Sites/folder
    cmd:             vscode-eslint-language-server --stdio

 Client: vuels (id: 2, pid: 26579, bufnr: [3])
    filetypes:       vue
    autostart:       true
    root directory:  /Users/USER/Sites/folder
    cmd:             vls

 Client: volar (id: 3, pid: 26580, bufnr: [3])
    filetypes:       vue
    autostart:       true
    root directory:  /Users/USER/Sites/folder
    cmd:             vue-language-server --stdio

 Configured servers list: sumneko_lua, eslint, jsonls, graphql, tsserver, cssls, volar, html, vuels, bashls
ecosse3 commented 2 years ago

@nevenduranec Ecovim 2.0.0 has been released with new lsp manager. Please uninstall all your LSPs and install by manager, then check if it fixes your problem.

lakardion commented 2 years ago

Hello! Thank you very much for this nvim setup!. I am trying to make the leap from vscode and this is super helpful.

I'm having a hard time trying to make prettier work, either on save or with command. If I try to run the command specified in the readme: I get this error

E5108: Error executing lua [string ":lua"]:1: attempt to call field 'format' (a nil value)
stack traceback:
        [string ":lua"]:1: in main chunk

I have a .prettierrc.json in the root of my project. And I have installed prettier as a dev dep. Is there any extra steps I need to do to make format work?

ecosse3 commented 2 years ago

@lakardion Make sure to use nvim 0.8 or switch keymappings to 0.7 API.

lakardion commented 2 years ago

Working now, thanks a lot! I was in 0.7

ecosse3 commented 2 years ago

Closing due to inactivity. @nevenduranec Please check if this happens with the newest version of Ecovim and Neovim. Install the newest LSPs by Mason. If still happens, open a new issue.