Skip to content

.styluaignore in CWD is incorrectly ignored if cwd not included in paths to format #249

@JohnnyMorganz

Description

@JohnnyMorganz

If you have a project structured such as

src/
    foo.lua
    bar.lua
tests/
.styluaignore

and you run stylua src (because you don't want to format the tests folder), it doesn't use the .styluaignore present in the current working directory.

e.g. if .styluaignore mentioned to ignore bar.lua, it would be ignored if you run stylua ., but it will still be formatted if you run stylua src. This is because the .styluaignore file isn't actually ever "noticed" by the directory walker, since the cwd wasn't passed as a starting point.

This behaviour is confusing, as you would expect the .styluaignore to be taken into account if it was present in the cwd where stylua was ran.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions