ls-lint: Windows: Inconsistent slash matching

Hi, first of all thanks for the tool, simple, fast, superb!

I found issue with using it on windows.

Given config:

ls:
  src/**/*:
    .dir: kebab-case | snake_case
ignore:
  - src/@types
  - src/atoms/dashboard-table

The result is:

>ls-lint
2020/04/20 11:40:42 .\src\@types failed for rules: kebabcase | snakecase
2020/04/20 11:40:42 .\src\atoms\dashboard-table\local-atoms\CustomDate failed for rules: kebabcase | snakecase
2020/04/20 11:40:42 .\src\atoms\dashboard-table\local-atoms\DaysOfAdmissionTag failed for rules: kebabcase | snakecase
2020/04/20 11:40:42 .\src\atoms\dashboard-table\local-atoms\Flag failed for rules: kebabcase | snakecase
2020/04/20 11:40:42 .\src\atoms\dashboard-table\local-atoms\ObraCheckboxes failed for rules: kebabcase | snakecase

I think this is strange, because obviously the ls part works on windows with slash / but the ignore part does not (which is correct as the docs mention you should use backslash on windows)

So now I fixed the ignore part to have backslash pattern for windows.

ls:
  src/**/*:
    .dir: kebab-case | snake_case
ignore:
  - src/@types
  - src\@types
  - src/atoms/dashboard-table
  - src\atoms\dashboard-table

But I don’t like the inconsistency that the ls part works while the ignore does not.

To fix this, the tool should handle the original config so it works properly on Widnows to get better user experience.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (21 by maintainers)

Most upvoted comments

I just give @MiroslavPetrik, @harrytran998, … a chance to test the beta version for the next days - i will release v1.9.0 on thursday.

To test the current beta version: npm install @ls-lint/ls-lint@1.9.0-beta.5

I agree

Try to add this feature soon

v1.9.0 released 🕺

Retagged the v1.8.1 to latest 👍

Alright

FYI: The ls part works, cause doublestar supports this for the glob patterns (like * or **). For a normal ls definition, this should not work.

For now, i could implement a --file solution like: (in case there could be more operating systems which use backslashes or some other sep char)

ls-lint --file=".ls-lint-windows.yml" for your windows machines.

What do you think?