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

207
Visualizações
Why do I get an "Unexpected character '@'" parsing error when I run ESLint?

I'm getting this parsing error (i.e., error Unexpected character '@' ParseError) returned when running eslint --cache --fix. I'm not sure why I'm seeing this error though, since I don't have an '@' anywhere near that line that's being flagged as problematic. The following is a snippet of my code where the issue is happening:

const getCustomerInformation = async (id, role) => {
    return await gql
        .query({
            query: GET_CUSTOMER_DATA,
            variables: {
                id
            }
        })
        .then((res) => {
            response[role] = res
        })
}

GET_CUSTOMER_DATA is being imported from another file and is as follows:

export const GET_CUSTOMER_DATA = gql`
    query getCustomerInformation($id: String!) {
        OSDTGetCustomerInformation(id: $id) {
            ... on CustomerSuccess {
                id
                fullName
            }
            ... on CustomerError {
                message
            }
        }
    }
`

The line that's being flagged as problematic is query: GET_CUSTOMER_DATA at character 42 in the 1st code block. As mentioned earlier though, I don't see an instance of '@' being used, so I'm not sure why there's a linting issue. I'd really appreciate it if someone could help me understand what could be the issue here.

FWIW, I'm using ESLint v7.31.0.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It turns out that the pre-commit linter was recognizing that I hadn't added any documentation for getCustomerInformation(). So, the linter attempted to solve this by adding a comment with getCustomerInformation()'s parameters (i.e., id & role) that included '@'. However, the linter wasn't adding them in the right place — which is what was throwing the parsing error. So, I had to manually add documentation. I added the following above where getCustomerInformation() is being defined:

/**
* @param {string} id
* @param {string} role
*/
about 4 years ago · Juan Pablo Isaza Relatório
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