0

I have a React TypeScript project, here is .eslintrc.json:

    "env": {
        "browser": true,
        "es2021": true
      },
      "extends": ["eslint:recommended", "plugin:react/recommended"],
      "overrides": [],
      "parserOptions": {
        "ecmaVersion": "latest",
        "sourceType": "module"
      },
      "plugins": ["react"],
      "settings": {
        "react": {
          "version": "detect"
        }
      }
    }

And the following is installed in package.json:

    "eslint": "^8.43.0",
    "eslint-plugin-react": "^7.32.2",
    "typescript": "^5.3.3",

I'm using neovim with mason

    'neovim/nvim-lspconfig',
    dependencies = {
      { 'williamboman/mason.nvim', opts = {} },
      'williamboman/mason-lspconfig.nvim',
      'WhoIsSethDaniel/mason-tool-installer.nvim',
    },

    local servers = {
        ts_ls = {},
        lua_ls = {},
     }

    local ensure_installed = vim.tbl_keys(servers or {})
    vim.list_extend(ensure_installed, {
        'stylua',
        'prettierd',
        'prettier',
        'eslint_d',
      })

    require('mason-tool-installer').setup { ensure_installed = ensure_installed }
    require('mason-lspconfig').setup {
        ensure_installed = {},
        automatic_installation = true,
        handlers = {
          function(server_name)
            local server = servers[server_name] or {}
            server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
            require('lspconfig')[server_name].setup(server)
          end,
        },
      }

Complete list of installed Mason:

  • eslint-lsp
  • eslint_d
  • lua-language-server
  • prettier
  • prettierd
  • stylua
  • typescript-language-server

and treesitter

'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
main = 'nvim-treesitter.configs',
opts = {
  ensure_installed = {
    'javascript',
    'typescript',
    'tsx',
    'html',
    'json',
  },
  auto_install = true,

But something is not working correctly as I get errors like:

Parsing error: Unexpected token :

at line

 export default (props: SomeProps) => Component(<SubComponent {...props} />);

and like:

Parsing error: Unexpected token interface
export interface SomeInterface {}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.