使用 STYLELINT 找不到与模式匹配的文件
我刚刚安装了stylelint
,并且正在关注文档,但是我遇到了以下问题:
$ npx stylelint --config ./stylelintrc './**/*.tsx'
Error: No files matching the pattern "'./src/**/*.tsx'" were found.
at standalone (C:\Users\thiag\OneDrive\Documentos\PROJETOS\sugar\node_modules\stylelint\lib\standalone.js:273:43)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
这是我的层次结构:
这是我的代码.stylelIlintrc
:
{
"processors": ["stylelint-processor-styled-components"],
"extends": ["stylelint-config-recommended", "stylelint-config-styled-components"],
"customSyntax": "postcss-scss",
"rules": { // BAR }
}
软件包代码:
{
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"stylelint:check": "stylelint-config-prettier-check",
"stylelint:css": "npx stylelint './**/*.{tsx, ts}'",
"prepare": "husky install"
},
"dependencies": {
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-web": "0.17.1",
"styled-components": "^5.3.5"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@stylelint/postcss-css-in-js": "^0.37.2",
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"@types/styled-components": "^5.1.25",
"@types/styled-components-react-native": "^5.1.3",
"@typescript-eslint/eslint-plugin": "^5.19.0",
"@typescript-eslint/parser": "^5.19.0",
"eslint": "8.2.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "7.28.0",
"eslint-plugin-react-hooks": "4.3.0",
"husky": "^7.0.4",
"lint-staged": "^12.3.7",
"postcss-scss": "^4.0.3",
"postcss-syntax": "^0.36.2",
"prettier": "^2.6.2",
"stylelint": "^14.6.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^7.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"typescript": "~4.3.5"
}
}
这里发生了什么?我尝试了这些路径的一切,但没有任何作用。我在带有Expo +样式组件的项目中使用它。
I just installed STYLELINT
and I'm following the documentation, but I encountered the following problem:
$ npx stylelint --config ./stylelintrc './**/*.tsx'
Error: No files matching the pattern "'./src/**/*.tsx'" were found.
at standalone (C:\Users\thiag\OneDrive\Documentos\PROJETOS\sugar\node_modules\stylelint\lib\standalone.js:273:43)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
error Command failed with exit code 1.
Here's my hierarchy:
Here's my code .stylelintrc
:
{
"processors": ["stylelint-processor-styled-components"],
"extends": ["stylelint-config-recommended", "stylelint-config-styled-components"],
"customSyntax": "postcss-scss",
"rules": { // BAR }
}
Package code:
{
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"stylelint:check": "stylelint-config-prettier-check",
"stylelint:css": "npx stylelint './**/*.{tsx, ts}'",
"prepare": "husky install"
},
"dependencies": {
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-web": "0.17.1",
"styled-components": "^5.3.5"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@stylelint/postcss-css-in-js": "^0.37.2",
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"@types/styled-components": "^5.1.25",
"@types/styled-components-react-native": "^5.1.3",
"@typescript-eslint/eslint-plugin": "^5.19.0",
"@typescript-eslint/parser": "^5.19.0",
"eslint": "8.2.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "7.28.0",
"eslint-plugin-react-hooks": "4.3.0",
"husky": "^7.0.4",
"lint-staged": "^12.3.7",
"postcss-scss": "^4.0.3",
"postcss-syntax": "^0.36.2",
"prettier": "^2.6.2",
"stylelint": "^14.6.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^7.0.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0",
"typescript": "~4.3.5"
}
}
What is happening here? I've tried everything with these paths and nothing works. I'm using it in a project with EXPO + STYLED-COMPONENTS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
StyleLint正在抛出以下错误,因为您的层次结构中没有
src
文件夹,因此否.tsx
文件:在您在
src
文件夹中创建.tsx
文件后,该错误将消失。另外,您可以使用- wally-empty-input
flag,就像这样:
此外,您不需要
- config
flag as stylelint将找到.stylelintrc
文件自动。Stylelint is throwing the following error because there is no
src
folder in your hierarchy and therefore no.tsx
files to lint:The error will go away once you create a
.tsx
file in asrc
folder. Alternatively, you can use the--allow-empty-input
flag, like so:Additionally, you don't need the
--config
flag as Stylelint will find a.stylelintrc
file automatically.