我最近使用CI服务器构建了我的React App(使用yarn build
使用Create React App搭建了脚手架),并显示了以下构建错误:
Error: VariableDeclarator ASTNodes are not handled by markPropTypesAsUsed
at Array.forEach (<anonymous>)
at Array.forEach (<anonymous>)
at Array.map (<anonymous>)
依赖项:
"dependencies": {
"core-js": "^3.0.1",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"prop-types": "^15.6.2",
"react-router-dom": "^4.2.2"
}
答案 0 :(得分:6)
您可以将“ eslint-plugin-react”降级到7.13.0版本,以等待7.14.0中的修复。它对我有用。
答案 1 :(得分:4)
这是 allLines = fileRead.readlines()
allLines = [x.strip() for x in allLines]
for i in range (0,len(allLines)):
currentWord = allLines[currentLine]
currentLine += 1
currentURL = URL+currentWord
uClient = uReq(currentURL)
pageHTML = uClient.read()
uClient.close()
pageSoup = soup(pageHTML,'html.parser')
pageHeader = str(pageSoup.h1)
if 'Sorry!' in pageHeader:
with open(fileA,'a') as fileAppend:
fileAppend.write(currentWord + '\n')
print(currentWord,'available')
else:
print(currentWord,'taken')
(版本allLines = fileRead.readlines()
allLines = [x.strip() for x in allLines]
def f(indexes, allLines):
for i in indexes:
currentWord = allLines[currentLine]
currentLine += 1
currentURL = URL+currentWord
uClient = uReq(currentURL)
pageHTML = uClient.read()
uClient.close()
pageSoup = soup(pageHTML,'html.parser')
pageHeader = str(pageSoup.h1)
if 'Sorry!' in pageHeader:
with open(fileA,'a') as fileAppend:
fileAppend.write(currentWord + '\n')
print(currentWord,'available')
else:
print(currentWord,'taken')
for i in range(threads):
indexes = range(i*len(allLines), i*len(allLines)+threads, 1)
Thread(target=f, args=(indexes, allLines)).start()
)的最新版本的问题。人们已经在进行修复,并且可能很快会在较新的版本中解决。该代码已被合并。有关更多信息,请检查:https://github.com/yannickcr/eslint-plugin-react/issues/2319
目前,作为一种变通办法,您可以将eslint-plugin-react降级为 eslint-plugin-react
,以便在解决此问题之前暂时解决问题。
最新更新:现在仅通过发布具有此修复程序的版本7.14.0
即可解决此问题。如果遇到此错误,只需更新到最新版本和问题,并确保您拥有7.13.0
或更高版本,即可解决此问题。