styled-components / stylelint-processor-styled-components

Lint your styled components with stylelint!

Home Page:https://styled-components.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No source checked and no outputs

lonyele opened this issue · comments

Environment

"styled-components": "^3.4.10",  or the latest version 4@beta
"stylelint": "^9.6.0", 
"stylelint-config-recommended": "^2.1.0",
"stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.5.0"

.stylelintrc

{
  "processors": ["stylelint-processor-styled-components"],
  "extends": [
    "stylelint-config-recommended",
    "stylelint-config-prettier",
    "stylelint-config-styled-components"
  ]
}

package.json command
"stylelint './sr/**/*.{js, ts, tsx}' --formatter verbose"

Steps to reproduce

  1. fresh normal create-react-app or typescript version project with the above versions
// styled-component code.
export const TestHello = styled.h1`
  fonttss-size: 1.5em;
      text-align: center;
  col--or: palevioletred;
  whatt: he~~ck;
`;

Expected Behavior

Should show me which lines have a problem such as "property-no-unknown"

Actual Behavior

$ stylelint './sr/**/*.{js, ts, tsx}' --formatter verbose"
0 source checked
0 problems found

are showned at the command line after running npm script.

If I install vscode extension, It works fine. Though I want to use it normally like the instruction on styled-components site. I followed all the steps and there is no source checked and no errors outputting. Maybe relates to #218 stylelint/stylelint#3261 I also added rules to .stylelintrc, still It's not checking any files. Maybe I've done something wrong

@lonyele Did you write a wrong glob pattern, './sr/**/*.{js, ts, tsx}'? Usually, you source files may locate in src.

Oh, sorry that's a typo. My project is using this one "stylelint './src/**/*.{js, ts, tsx}' --formatter verbose"

@lonyele Notice that your output contains "0 source checked", which means no files are matched. It must be pattern problem, or you will see something like below.

[zhong@localhost linttest]$ npx stylelint test.js --formatter verbose
1 source checked
 /Users/zhong/Desktop/test/linttest/test.js

@chinesedfan Yeah that's right. That is the weird part I think... I cannot make it check any source. I've tested with any js, ts, tsx and also I tested with directly reference component something like `./src/components/MyComonents.tsx'
If It doesn't bother you, can you git clone my repo that can reproduce this problem and check what has been done wrong?
here is the repo https://github.com/lonyele/test-project-setting.git

  1. yarn install
  2. There is one component called TestHello.tsx that has styled-component.
  3. Mess up the styled-component
  4. yarn lint:css
  5. I see "0 source checked"...
    I hope I've done some stupid mistake

@lonyele I didn't find an offical glob specification, but if changed the pattern without inner spaces, it works.

-    "lint:css": "stylelint './src/**/*.{js, ts, tsx}' --formatter verbose",
+    "lint:css": "stylelint './src/**/*.{js,ts,tsx}' --formatter verbose",

I git clone it again and failed again... It seems like there are no similar issues opened/closed. Probably something is wrong with my usage... Thank you for checking it

  1. yarn lint:css
  2. I see "0 source checked"...

@lonyele In fact, after cloned your test repository without any changes, I can see 1 source(src/setupTests.js) is checked. And if changed like my previous comment, 9 sources will be checked.

I've tested with any js, ts, tsx and also I tested with directly reference component something like `./src/components/MyComonents.tsx'

If something like "npx stylelint test.js --formatter verbose" in your side still returns "0 source checked", that is really weird. Maybe you can clone your repository in another computer, or ask another friend to test. At last, I will close this issue because it should not be a problem of this processor.

Just the follow-up. I tested at new environment(Ubuntu) and It works fine... something has been messed up with my laptop