gpt4 book ai didi

reactjs - 如何在创建 React 应用程序中运行 eslint

转载 作者:行者123 更新时间:2023-12-03 14:09:11 24 4
gpt4 key购买 nike

帮助在创建 React 应用程序中运行 eslint。

我使用 tutorial 创建了 React 应用程序

然后我安装了

babel-eslint

standard

snazzy

然后我将下一行添加到 package.json 中的脚本

"lint": "standart --verbose | snazzy"

现在我尝试使用命令运行 eslint:npm run lint

但我有一个错误解析错误:意外的 token = null

我的完整 package.json 如下

{
"name": "square_app_react",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-scripts": "1.0.10"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint": "standart --verbose | snazzy"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"standard": "^10.0.2"
}
}

请帮助了解如何修复它或如何在我的情况下正确运行 eslint。

提前谢谢您。

最佳答案

我将以下脚本添加到 package.json 中的脚本中:

"lint": "eslint src --ext .js,.jsx,.ts,.tsx",

关于reactjs - 如何在创建 React 应用程序中运行 eslint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45089410/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com