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

259
Visualizações
.eslintrc.js for React 17 and JSX without import 'react'

in react 17 is not necessarily use

import React from 'react';

but if i don't have it, so eslint gave me error

'React' must be in scope when using JSX react/react-in-jsx-scope

any idea how modify .eslintrc.js

module.exports = {
  parser: "babel-eslint",
  env: {
    browser: true,
    node: true,
    es6: true,
    jest: true,
  },
  extends: [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:jsx-a11y/recommended"
    ],
  plugins: [
    "react",
    "react-hooks",
    "jsx-a11y",
  ],
  rules: {
    strict: 0,
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn"
  },
  settings: {
    react: {
      version: "detect"
    }
  }
}

for react 17?

Thank's a lot

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You need to add plugin:react/jsx-runtime to extends in the .eslintrc.js file.

like is:

module.exports = {
  extends: [
    'plugin:react/recommended',
    'airbnb',
    'plugin:react/jsx-runtime',
  ]
}

Refer here

over 4 years ago · Santiago Trujillo Relatório

0

You can read about it in React docs.

If you are using eslint-plugin-react, the react/jsx-uses-react and react/react-in-jsx-scope rules are no longer necessary and can be turned off or removed.

{
  // ...
  "rules": {
    // ...
    "react/jsx-uses-react": "off",
    "react/react-in-jsx-scope": "off"
  }
}
  • react-in-jsx-scope on github.

To make it work, you should add those rules to your eslint config, see Extending or replacing the default ESLint config for Create-React-App specifics, every framework should have related section in their docs.

over 4 years ago · Santiago Trujillo 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