1

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.

THIAGO DE BONIS
  • 760
  • 7
  • 22

1 Answers1

7

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.

jeddy3
  • 3,451
  • 1
  • 12
  • 21