Skip to content

Commit 2ac2244

Browse files
authored
Merge branch 'main' into linter/issue-20465-vue-js-plugin-ranges
2 parents cafa0ba + 144f27a commit 2ac2244

118 files changed

Lines changed: 3668 additions & 559 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/renovate.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
"rangeStrategy": "auto",
1212
"schedule": ["at any time"],
1313
"automergeSchedule": ["at any time"]
14+
},
15+
{
16+
"groupName": "emnapi",
17+
"matchManagers": ["npm"],
18+
"matchPackageNames": ["emnapi", "/^@emnapi\\//"]
1419
}
1520
]
1621
}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ jobs:
462462
cache: rust
463463
- run: rustup toolchain install "${TOOLCHAIN}" --profile minimal --component rust-docs
464464
# https://github.com/rust-lang/rust/issues/146895
465-
- run: RUSTDOCFLAGS='-D warnings' cargo +"${TOOLCHAIN}" doc --no-deps --document-private-items -Zrustdoc-mergeable-info
465+
- run: RUSTDOCFLAGS='-D warnings' cargo +"${TOOLCHAIN}" doc --no-deps --document-private-items --all-features -Zrustdoc-mergeable-info
466466

467467
conformance:
468468
name: Conformance

apps/oxfmt/src/cli/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod reporter;
44
mod result;
55
mod runner;
66
mod service;
7-
mod walk;
7+
pub(crate) mod walk;
88

99
pub use crate::core::utils::init_tracing;
1010
#[cfg(feature = "napi")]

apps/oxfmt/src/stdin/mod.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ use std::{
44
path::PathBuf,
55
};
66

7+
use ignore::gitignore::Gitignore;
8+
9+
use crate::cli::walk::resolve_ignore_paths;
710
use crate::cli::{CliRunResult, FormatCommand, Mode};
811
use crate::core::{
912
ConfigResolver, ExternalFormatter, FormatFileStrategy, FormatResult, JsConfigLoaderCb,
@@ -40,7 +43,7 @@ impl StdinRunner {
4043
let stderr = &mut BufWriter::new(io::stderr());
4144

4245
let cwd = self.cwd;
43-
let FormatCommand { mode, config_options, .. } = self.options;
46+
let FormatCommand { mode, config_options, ignore_options, .. } = self.options;
4447

4548
let Mode::Stdin(filepath) = mode else {
4649
unreachable!("`StdinRunner::run()` called with non-Stdin mode");
@@ -98,6 +101,24 @@ impl StdinRunner {
98101
return CliRunResult::InvalidOptionConfig;
99102
};
100103

104+
// Check if the file is ignored by global ignores or config`.ignorePatterns`
105+
let resolved_ignore_paths = match resolve_ignore_paths(&cwd, &ignore_options.ignore_path) {
106+
Ok(paths) => paths,
107+
Err(err) => {
108+
utils::print_and_flush(stderr, &format!("{err}\n"));
109+
return CliRunResult::InvalidOptionConfig;
110+
}
111+
};
112+
let is_ignored = resolved_ignore_paths.iter().any(|ignore_path| {
113+
let (gitignore, _) = Gitignore::new(ignore_path);
114+
gitignore.matched_path_or_any_parents(strategy.path(), false).is_ignore()
115+
}) || config_resolver.is_path_ignored(strategy.path(), false);
116+
117+
if is_ignored {
118+
utils::print_and_flush(stdout, &source_text);
119+
return CliRunResult::FormatSucceeded;
120+
}
121+
101122
// Resolve options for the stdin file entry
102123
let resolved_options = config_resolver.resolve(&strategy);
103124

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Input
2+
3+
## Command
4+
```
5+
oxfmt --stdin-filepath test.ts
6+
```
7+
8+
## File tree
9+
```
10+
- fixtures/ <CWD>
11+
- .oxfmtrc.json
12+
- .prettierignore
13+
- input.ts
14+
```
15+
16+
# Result
17+
18+
## Exit code
19+
0
20+
21+
## stdout
22+
```
23+
const x: number = 1;
24+
```
25+
26+
## stderr
27+
```
28+
29+
```
30+
31+
## File changes
32+
No changes
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Input
2+
3+
## Command
4+
```
5+
oxfmt --stdin-filepath ignored/test.ts
6+
```
7+
8+
## File tree
9+
```
10+
- fixtures/ <CWD>
11+
- .oxfmtrc.json
12+
- .prettierignore
13+
- input.ts
14+
```
15+
16+
# Result
17+
18+
## Exit code
19+
0
20+
21+
## stdout
22+
```
23+
const x:number=1
24+
```
25+
26+
## stderr
27+
```
28+
29+
```
30+
31+
## File changes
32+
No changes
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Input
2+
3+
## Command
4+
```
5+
oxfmt --stdin-filepath prettierignored/test.ts
6+
```
7+
8+
## File tree
9+
```
10+
- fixtures/ <CWD>
11+
- .oxfmtrc.json
12+
- .prettierignore
13+
- input.ts
14+
```
15+
16+
# Result
17+
18+
## Exit code
19+
0
20+
21+
## stdout
22+
```
23+
const x:number=1
24+
```
25+
26+
## stderr
27+
```
28+
29+
```
30+
31+
## File changes
32+
No changes
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignorePatterns": ["ignored/"]
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
prettierignored/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const x:number=1

0 commit comments

Comments
 (0)