32得票1回答
如何配置eslint规则以全局忽略react-hooks/exhaustive-deps?

我有一个使用 useEffect hook 的 React 组件,代码如下: const LocationEditor: React.FC<SectionEditorProps> = (props) => { const [section, setSection] = us...

29得票6回答
无法加载配置文件"next/babel"以扩展eslintrc.json。

当我尝试构建Next.Js应用程序时,成功构建后会出现以下错误。在Vercel部署应用程序时会显示此错误。error - ESLint: Failed to load config "next/babel" to extend from. Referenced from: ...

27得票3回答
使用配置了jsconfig.json的路径映射时,解决导入时的eslint错误

这是我的项目结构:-src --assets --components --constants --helpers --pages --routes eslintrc.json jsconfig.json App.js index.js 我厌倦了: import SomeCompone...

26得票3回答
.eslintrc.js文件中未定义'module'

我在.eslintrc.js文件中的eslint遇到了“module未定义”的错误,这是什么意思?我该如何解决?请参考以下截图:

22得票4回答
eslint在JSX中出现“解析错误:意外的令牌{”

const title = 'My Minimal React Webpack Babel Setups'; const App = () => (<div><b>{title}</b><img src={img} /></div&...

22得票3回答
ESLint在终端中工作正常,但在编辑器UI(VSCode)中未显示错误。

我已按照此链接的步骤https://travishorn.com/setting-up-eslint-on-vs-code-with-airbnb-javascript-style-guide-6eb78a535ba6安装了ESlint。现在,我的ESlint可以在终端上运行,但错误/警告未在...

21得票8回答
解析错误:找不到模块'@babel/preset-react'。

我有一个React项目。在每个.js文件的第一行中,当我导入React时,我收到以下错误:Parsing error: Cannot find module '@babel/preset-react'。package.json{ "name": "admi...

21得票7回答
VSCode无法加载插件,找不到模块“eslint-plugin-prettier”。

我正在为我的项目安装eslint和Prettier,并尝试通过VSCode使自动代码格式化生效。当我打开一个React文件时,我看到ESLint处于错误状态,因此我打开了ESLint控制台,在那里我看到: “无法加载在'js/.eslintrc.js'中声明的prettier插件:找不到模块...

19得票1回答
如何在使用eslint-prettier/prettier时支持行内注释?

我想关闭Prettier中的一个规则,即在行内注释处换行。我的ESLint规则no-inline-comments已设置为关闭或警告状态,因此已得到处理并运作正常。结果发现,Prettier仍然希望在行内注释处换行:我在VSCode中设置了ESLint处理JS的prettier,而Pretti...

18得票4回答
如何在ESLint中将制表符大小定义为4?

我正在尝试在我的工作区中使用ESLint,并且我对缩进规则感到有些困惑。 以下是我的缩进设置规则:"rules": { "indent": [ "error", "tab" ] } 文档仅说明有两个选项: "tab" 和正数表示空格数。我的问题是,如何定义制表符大小为4而不仅仅...