使用 STYLELINT 找不到与模式匹配的文件

发布于 2025-01-20 14:09:40 字数 2792 浏览 4 评论 0原文

我刚刚安装了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:

enter image description here

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三生路 2025-01-27 14:09:40

StyleLint正在抛出以下错误,因为您的层次结构中没有src文件夹,因此否.tsx文件:

错误:找到与模式“ ./ src/” // tsx'的文件。

在您在src文件夹中创建.tsx文件后,该错误将消失。另外,您可以使用 - wally-empty-input flag,就像这样:

npx stylelint './**/*.tsx' --allow-empty-input

此外,您不需要- 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:

Error: No files matching the pattern "'./src/**/*.tsx'" were found.

The error will go away once you create a .tsx file in a src folder. Alternatively, you can use the --allow-empty-input flag, like so:

npx stylelint './**/*.tsx' --allow-empty-input

Additionally, you don't need the --config flag as Stylelint will find a .stylelintrc file automatically.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文