editorconfig-checker.javascript
editorconfig-checker.javascript copied to clipboard
Works incorrectly with paths
Hello! Please help me figure out how to exclude several folders from the scan.
documentation says to use valid regular expressions

with one folder - exception works

but if I use a valid regular expression - the plugin doesn't work
path not found as the result

please explain where I went wrong and how to set an exception for a group of certain files or folders.
Can you try:
"editorconfig": "editorconfig-checker -exclude 'libs|styles\\.css'"
I think it has to do with how npm/node interprets the script command.
@mstruebing doesnt work
...path not found
and if I leave only the folder - it doesn't work either

the impression is that the regular expression is not perceived at all, only the simplest string.
For me it works:
https://user-images.githubusercontent.com/12071529/183366955-cb34e0f3-d405-4fa8-98e1-da1b9e9e13ae.mov
Uhhh, sorry, I just realized: it looks like you are on windows by the path your terminal shows? I don't really have a clue about windows development and don't have a machine to test.
Could you may run the command with --verbose --debug to may see additional information?
that's how it works

but if you put '...' - it stops working

even if you specify one folder, but in quotes - it no longer works
path not found

look like ' - is a part of path

It looks like any paths are incorrectly being mapped. Also the paths in .editorconfig file itself.
With the following (part of) .editorconfig:
[tests/**.ts]
trim_trailing_whitespace = false
It should not give the following errors:

I don't know it is required in this context, but the regex
libs|styles\\.css
may need parentheses:
(libs|styles\\.css)
Also, I don't know if it applies here, but Windows' CMD.EXE needs the double quote character (instead of the apostrophe) to surround strings. So can you try:
"editorconfig-checker -exclude \"(libs|styles\\.css)\""
@rasa Thanks a lot, it looks like your solution works! I'll check with a fresh mind, but so far I've managed to ignore files and folders! thanks again.
@Alecto Great news! If it's solved your issue, please close this ticket if you don't mind. Thanks.
This is still an issue when using the .editorconfig paths, instead of CLI command. Creating some custom altered version for the CLI command, specifically for one OS, will not work for an .editorconfig file.
See reply above; https://github.com/editorconfig-checker/editorconfig-checker.javascript/issues/387#issuecomment-1213539658
@jerone Your fix changes \\ to / in the .editorconfig file. Is this the issue you are raising? That editorconfig-checker handles /s properly, but fails on treating \\ as a valid directory separator on Windows?
If that is the case, note that https://spec.editorconfig.org/#file-format says: "Backslashes (\) are not allowed as path separators (even on Windows)."
@jerone Your fix changes
\\to/in the.editorconfigfile. Is this the issue you are raising? That editorconfig-checker handles/s properly, but fails on treating\\as a valid directory separator on Windows?
Aldo this was an half year ago, I think that "fix" was an test to see editorconfig-checker in action. The issue at that time, was that it would not handle any path separators. See https://github.com/editorconfig-checker/editorconfig-checker.javascript/issues/387#issuecomment-1237329381 If that is still an issue, I have no idea.