Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The CLI tool will now only write files if the contents differ, and not modify if no change ([#827](https://github.com/JohnnyMorganz/StyLua/issues/827))
- Fixed parentheses around a Luau compound type inside of a type table indexer being removed causing a syntax error ([#828](https://github.com/JohnnyMorganz/StyLua/issues/828))
- Fixed function body parentheses being placed on multiple lines unnecessarily when there are no parameters ([#830](https://github.com/JohnnyMorganz/StyLua/issues/830))
- Fixed directory paths w/o globs in `.styluaignore` not matching when using `--respect-ignores` ([#845](https://github.com/JohnnyMorganz/StyLua/issues/845))

## [0.19.1] - 2023-11-15

Expand Down
19 changes: 18 additions & 1 deletion src/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ fn path_is_stylua_ignored(path: &Path, search_parent_directories: bool) -> Resul
.context("failed to parse ignore file")?;

Ok(matches!(
ignore.matched(path, false),
ignore.matched_path_or_any_parents(path, false),
ignore::Match::Ignore(_)
))
}
Expand Down Expand Up @@ -769,4 +769,21 @@ mod tests {

cwd.close().unwrap();
}

#[test]
fn test_respect_ignores_directory_no_glob() {
// https://github.com/JohnnyMorganz/StyLua/issues/845
let cwd = construct_tree!({
".styluaignore": "build/",
"build/foo.lua": "local x = 1",
});

let mut cmd = create_stylua();
cmd.current_dir(cwd.path())
.args(["--check", "--respect-ignores", "build/foo.lua"])
.assert()
.success();

cwd.close().unwrap();
}
}