Reactjs ESLint:';反应';在使用JSX pragma时已定义但从未使用。(没有未使用的变量)
当我使用jsx pragma时,如何停止eslint抛出错误 我正在使用airbnb配置,并尝试添加Reactjs ESLint:';反应';在使用JSX pragma时已定义但从未使用。(没有未使用的变量),reactjs,jsx,emotion,eslint-config-airbnb,airbnb,Reactjs,Jsx,Emotion,Eslint Config Airbnb,Airbnb,当我使用jsx pragma时,如何停止eslint抛出错误 我正在使用airbnb配置,并尝试添加“react/jsx使用react”:1,,作为一条规则,但这条规则不起作用 使用airbnb时,是否需要在扩展中包含插件:react/recommended .eslintrc.js extends: [ "airbnb", "airbnb/hooks", "plugin:react-redux/recommended", "plugin:prettier/
“react/jsx使用react”:1,
,作为一条规则,但这条规则不起作用
使用airbnb时,是否需要在扩展中包含插件:react/recommended
.eslintrc.js
extends: [
"airbnb",
"airbnb/hooks",
"plugin:react-redux/recommended",
"plugin:prettier/recommended",
"prettier/react",
],
settings: {
react: {
version: "detect",
},
},
plugins: ["emotion", "graphql", "prettier", "react-redux"],
rules: {
"emotion/jsx-import": "error",
"emotion/no-vanilla": "error",
"emotion/import-from-emotion": "error",
"emotion/styled-import": "error",
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }],
"graphql/template-strings": [
`error`,
{
env: `relay`,
tagName: `graphql`,
},
],
},
请检查:@Fryla CristianMarucci您是否建议我需要添加babel插件转换反应jsx?是的,我认为值得一试。
layout.js
/* ESLint: 'React' is defined but never used.(no-unused-vars) */
import React from "react"
import PropTypes from "prop-types"
import { useStaticQuery, graphql } from "gatsby"
/** @jsx jsx */
import { Global, css, jsx } from "@emotion/core"
import { ThemeProvider } from "emotion-theming"