Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

433
Visualizações
Using @typescript-eslint/parser in browser

Problem

I'm trying to use @typescript-eslint/parser + eslint for linting code in an online editor. Right now I've got the eslint import to work using the officially supported built product for browser. But there doesn't seem to be an official way to use @typescript-eslint/parser in the browser, while it's definitely possible and is used in their own demo site and astexplorer. Attempt to import it directly led to the following error:

Uncaught TypeError: Cannot read properties of undefined (reading 'dirname')
    at ../node_modules/.pnpm/glob-parent@5.1.2/node_modules/glob-parent/index.js (index.js:4:46)
    at __require2 (chunk-IEEDF65T.js?v=2b1fa2fc:35:50)
    at ../node_modules/.pnpm/fast-glob@3.2.11/node_modules/fast-glob/out/utils/pattern.js (pattern.js:5:20)
    at __require2 (chunk-IEEDF65T.js?v=2b1fa2fc:35:50)
    at ../node_modules/.pnpm/fast-glob@3.2.11/node_modules/fast-glob/out/utils/index.js (index.js:12:17)
    at __require2 (chunk-IEEDF65T.js?v=2b1fa2fc:35:50)
    at ../node_modules/.pnpm/fast-glob@3.2.11/node_modules/fast-glob/out/managers/tasks.js (tasks.js:4:15)
    at __require2 (chunk-IEEDF65T.js?v=2b1fa2fc:35:50)
    at ../node_modules/.pnpm/fast-glob@3.2.11/node_modules/fast-glob/out/index.js (index.js:2:21)
    at __require2 (chunk-IEEDF65T.js?v=2b1fa2fc:35:50)

My Usage

// doesn't work
import * as parser from '@typescript-eslint/parser'

const linter = new eslint.Linter()
linter.defineParser('@typescript-eslint/parser', parser)

linter.verify('someTSCode', someConfig)

Relavent Dependencies

"vite": "^2.9.1",
"vue": "^3.2.33",
"eslint": "^8.13.0",
"@typescript-eslint/parser": "^5.22.0",
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda