Skip to content

Commit 2c8a55c

Browse files
committed
Squashed commit of the following:
commit e419aaf Author: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Wed Apr 9 09:54:18 2025 +0000 refactor(ast_tools): move limit for inlining to a const in `Visit` generator (#10291) Pure refactor. `Visit` generator adds `#[inline]` attr to visitor methods containing 5 or less statements. Make this limit a `const`, rather than having it inline in multiple places. commit a605247 Author: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Wed Apr 9 09:54:17 2025 +0000 refactor(ast_tools): make visit call generator functions generic (#10290) Pure refactor. Make functions in `Visit` generator which generate `visitor.visit_*(...)` statements generic over `VisitorOutputs`. `VisitorOutputs` trait represents a set of outputs. In generator for `Visit` and `VisitMut`, there are 2 outputs for the 2 traits. But other generators need to be able to just generate `Visit` alone. Preparatory work for #10292. commit 411610f Author: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Wed Apr 9 09:54:17 2025 +0000 refactor(ast_tools): change methods to free functions in `Visit` generator (#10289) Pure refactor. Move methods of `VisitBuilder` which generate `visitor.visit_*(...)` statements to be free functions, so that they can be exported and used by other generators. Preparatory work for #10292. commit 267922b Author: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Wed Apr 9 09:16:59 2025 +0000 perf(transformer/jsx): speed up decoding `JSXText` strings (#9741) close: #10249 Speed up transforming `JSXText` nodes by: 1. Avoiding allocations (construct strings directly in arena, with no intermediate `String`s). 2. Where no HTML entity decoding or string concatenation is required, reuse a slice of source text, rather than generating a new `Atom` and copying string data. commit 11647e8 Author: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Wed Apr 9 09:16:59 2025 +0000 test(transformer/jsx): tests for `JSXText` strings (#10324) Add tests for transforming `JSXText` and `JSXAttributeValue`. Tests cover: * Whitespace and line breaks. * HTML entities ([`HTMLCharacterReference`](https://facebook.github.io/jsx/#sec-HTMLCharacterReference)). commit b54fb3e Author: Yuji Sugiura <6259812+leaysgur@users.noreply.github.com> Date: Wed Apr 9 17:13:24 2025 +0900 fix(estree): Rename `TSInstantiationExpression`.`type_parameters` to `type_arguments` (#10327) Part of #9705 commit 9734152 Author: Yuji Sugiura <6259812+leaysgur@users.noreply.github.com> Date: Wed Apr 9 16:14:25 2025 +0900 fix(ast): Handle `TSThisType` in `TSTypePredicate` (#10328) Part of #9705 When given this code: ```ts interface X { y(): this is { z: 1 } } ``` Currently the parser treats `this` inside the type annotation as `Identifier` named `this`, but it should be `TSThisType`. commit 81867c4 Author: camc314 <18101008+camc314@users.noreply.github.com> Date: Wed Apr 9 04:39:13 2025 +0000 fix(linter): fix stack overflow in react/exhaustive deps (#10322) fixes #10319 commit a95ba40 Author: Sysix <3897725+Sysix@users.noreply.github.com> Date: Tue Apr 8 22:33:17 2025 +0000 refactor(language_server): make server more error resistance by falling back to default config (#10257) When the client does provide us with an invalid config path / file, the server should not crash. Related oxc-project/oxc-zed#10 #10123 commit e0b6c8c Author: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Tue Apr 8 22:05:34 2025 +0000 fix(transformer/react): correct comment (#10323) Fix comment in function for decoding HTML entities in `JSXText` elements. Hex code escape is `&#x1234;` not `&x1234;`. Also reformat comments in this function. commit 294d24b Author: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Tue Apr 8 16:15:13 2025 +0000 refactor(ast/estree): simplify serialization for `JSXOpeningFragment` (#10316) Follow-on after #10208. We can remove the `JSXOpeningFragmentAttributes` serializer, and use `TsEmptyArray` instead. This results in `attributes?: []` in the TS type def, which seems reasonable since a JSX fragment can't have attributes. Really this field shouldn't exist at all! It can probably be considered a mistake in `acorn-jsx` that it does. commit cc07efd Author: therewillbecode <tomw08@gmail.com> Date: Tue Apr 8 16:55:36 2025 +0100 fix(ast/estree): Fix `JSXOpeningFragment` (#10208) Fix `JSXOpeningFragment` node estree TS serialization by skipping `selfClosing` and `attributes` fields when AST is TS. Part of our broader work to align our AST's ESTree output with that of TS-ESLint's. Relates to #9705 --------- Co-authored-by: overlookmotel <theoverlookmotel@gmail.com> commit 48ed6a1 Author: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Tue Apr 8 13:07:27 2025 +0000 fix(ast/estree): fix span for `TemplateElement` in TS AST (#10315) Part of #9705. TS-ESLint differs from Acorn in the `span` of `TemplateElement`. TS-ESLint includes the preceding `` ` `` or `}` and following `${` or `` ` `` in the span. ```js const template = `abc${x}def${x}ghi`; // Acorn: ^^^ ^^^ ^^^ // TS-ESLint: ^^^^^^ ^^^^^^ ^^^^^ ``` Make the span follow TS-ESLint in the TS AST. commit 48c711a Author: 翠 / green <green@sapphi.red> Date: Tue Apr 8 19:53:14 2025 +0900 fix(minifier): panic when compressing `a ? b() : b()` (#10311) found in vitejs/rolldown-vite#104 commit 4268b23 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue Apr 8 17:13:17 2025 +0800 chore(deps): lock file maintenance rust crates (#10300) commit eba5fcf Author: oxc-bot <boshen_chen@qq.com> Date: Tue Apr 8 13:52:15 2025 +0800 release(crates): v0.63.0 (#10309) commit 52ea978 Author: Ulrich Stark <8657779+ulrichstark@users.noreply.github.com> Date: Tue Apr 8 06:07:48 2025 +0200 refactor(linter): update comments, improve tests, add variant All to LintFilterKind (#10259) I split this PR into easily reviewable commits. While working on this PR, I noticed two possible follow up changes: `LintFilterKind::Rule` and `LintFilterKind::Generic` behave exactly the same in `ConfigStoreBuilder::with_filter` because `LintFilterKind::Rule` never actually uses or checks for the plugin it stores. Should I include the check for plugin? The proposed fifth `LintFilterKind` isn't implemented yet (see: `// TODO: plugin + category? e.g -A react:correctness)`). Should I add it? commit 9aaba69 Author: Sub <9058689+zubhav@users.noreply.github.com> Date: Tue Apr 8 08:07:31 2025 +0400 fix(linter): nested configuration directory resolution (#10157) Fixes #10156 I'm not very familiar with the inner workings of this project - this was a fix based on what I could understand after exploring the codebase for the first time. @camchenry It would be great to get your eyes on this since you are familiar with the nested config implementation. commit e0057c3 Author: Sysix <3897725+Sysix@users.noreply.github.com> Date: Tue Apr 8 01:49:06 2025 +0000 perf(language_server): only restart internal linter once when multiple config changes detected (#10256)
1 parent d9444f1 commit 2c8a55c

File tree

97 files changed

+1718
-693
lines changed

Some content is hidden

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

97 files changed

+1718
-693
lines changed

.typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extend-exclude = [
2222
"tasks/coverage/snapshots",
2323
"tasks/prettier_conformance/prettier",
2424
"tasks/prettier_conformance/snapshots",
25+
"tasks/transform_conformance/tests/babel-plugin-transform-react-jsx/test/fixtures/text/escapes/input.jsx",
2526
"tasks/transform_conformance/tests/**/output.js",
2627
"tasks/transform_conformance/overrides",
2728
"tasks/transform_conformance/snapshots",

Cargo.lock

Lines changed: 38 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -104,30 +104,30 @@ doc_lazy_continuation = "allow" # FIXME
104104

105105
[workspace.dependencies]
106106
# publish = true
107-
oxc = { version = "0.62.0", path = "crates/oxc" }
108-
oxc_allocator = { version = "0.62.0", path = "crates/oxc_allocator" }
109-
oxc_ast = { version = "0.62.0", path = "crates/oxc_ast" }
110-
oxc_ast_macros = { version = "0.62.0", path = "crates/oxc_ast_macros" }
111-
oxc_ast_visit = { version = "0.62.0", path = "crates/oxc_ast_visit" }
112-
oxc_cfg = { version = "0.62.0", path = "crates/oxc_cfg" }
113-
oxc_codegen = { version = "0.62.0", path = "crates/oxc_codegen" }
114-
oxc_data_structures = { version = "0.62.0", path = "crates/oxc_data_structures" }
115-
oxc_diagnostics = { version = "0.62.0", path = "crates/oxc_diagnostics" }
116-
oxc_ecmascript = { version = "0.62.0", path = "crates/oxc_ecmascript" }
117-
oxc_estree = { version = "0.62.0", path = "crates/oxc_estree" }
118-
oxc_isolated_declarations = { version = "0.62.0", path = "crates/oxc_isolated_declarations" }
119-
oxc_mangler = { version = "0.62.0", path = "crates/oxc_mangler" }
120-
oxc_minifier = { version = "0.62.0", path = "crates/oxc_minifier" }
121-
oxc_napi = { version = "0.62.0", path = "crates/oxc_napi" }
122-
oxc_parser = { version = "0.62.0", path = "crates/oxc_parser", features = ["regular_expression"] }
123-
oxc_parser_napi = { version = "0.62.0", path = "napi/parser" }
124-
oxc_regular_expression = { version = "0.62.0", path = "crates/oxc_regular_expression" }
125-
oxc_semantic = { version = "0.62.0", path = "crates/oxc_semantic" }
126-
oxc_span = { version = "0.62.0", path = "crates/oxc_span" }
127-
oxc_syntax = { version = "0.62.0", path = "crates/oxc_syntax" }
128-
oxc_transform_napi = { version = "0.62.0", path = "napi/transform" }
129-
oxc_transformer = { version = "0.62.0", path = "crates/oxc_transformer" }
130-
oxc_traverse = { version = "0.62.0", path = "crates/oxc_traverse" }
107+
oxc = { version = "0.63.0", path = "crates/oxc" }
108+
oxc_allocator = { version = "0.63.0", path = "crates/oxc_allocator" }
109+
oxc_ast = { version = "0.63.0", path = "crates/oxc_ast" }
110+
oxc_ast_macros = { version = "0.63.0", path = "crates/oxc_ast_macros" }
111+
oxc_ast_visit = { version = "0.63.0", path = "crates/oxc_ast_visit" }
112+
oxc_cfg = { version = "0.63.0", path = "crates/oxc_cfg" }
113+
oxc_codegen = { version = "0.63.0", path = "crates/oxc_codegen" }
114+
oxc_data_structures = { version = "0.63.0", path = "crates/oxc_data_structures" }
115+
oxc_diagnostics = { version = "0.63.0", path = "crates/oxc_diagnostics" }
116+
oxc_ecmascript = { version = "0.63.0", path = "crates/oxc_ecmascript" }
117+
oxc_estree = { version = "0.63.0", path = "crates/oxc_estree" }
118+
oxc_isolated_declarations = { version = "0.63.0", path = "crates/oxc_isolated_declarations" }
119+
oxc_mangler = { version = "0.63.0", path = "crates/oxc_mangler" }
120+
oxc_minifier = { version = "0.63.0", path = "crates/oxc_minifier" }
121+
oxc_napi = { version = "0.63.0", path = "crates/oxc_napi" }
122+
oxc_parser = { version = "0.63.0", path = "crates/oxc_parser", features = ["regular_expression"] }
123+
oxc_parser_napi = { version = "0.63.0", path = "napi/parser" }
124+
oxc_regular_expression = { version = "0.63.0", path = "crates/oxc_regular_expression" }
125+
oxc_semantic = { version = "0.63.0", path = "crates/oxc_semantic" }
126+
oxc_span = { version = "0.63.0", path = "crates/oxc_span" }
127+
oxc_syntax = { version = "0.63.0", path = "crates/oxc_syntax" }
128+
oxc_transform_napi = { version = "0.63.0", path = "napi/transform" }
129+
oxc_transformer = { version = "0.63.0", path = "crates/oxc_transformer" }
130+
oxc_traverse = { version = "0.63.0", path = "crates/oxc_traverse" }
131131

132132
# publish = false
133133
oxc_formatter = { path = "crates/oxc_formatter" }
@@ -202,7 +202,7 @@ nonmax = "0.5.5"
202202
num-bigint = "0.4.6"
203203
num-traits = "0.2.19"
204204
papaya = "0.2.1"
205-
petgraph = { version = "0.7.1", default-features = false }
205+
petgraph = { version = "0.8.0", default-features = false }
206206
phf = "0.11.3"
207207
pico-args = "0.5.0"
208208
prettyplease = "0.2.32"

apps/oxlint/src/lint.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,19 @@ impl Runner for LintRunner {
176176

177177
if use_nested_config {
178178
// get all of the unique directories among the paths to use for search for
179-
// oxlint config files in those directories
180-
// e.g. `/some/file.js` and `/some/other/file.js` would both result in `/some`
179+
// oxlint config files in those directories and their ancestors
180+
// e.g. `/some/file.js` will check `/some` and `/`
181+
// `/some/other/file.js` will check `/some/other`, `/some`, and `/`
181182
let mut directories = FxHashSet::default();
182183
for path in &paths {
183184
let path = Path::new(path);
184-
if let Some(directory) = path.parent() {
185+
// Start from the file's parent directory and walk up the tree
186+
let mut current = path.parent();
187+
while let Some(dir) = current {
185188
// NOTE: Initial benchmarking showed that it was faster to iterate over the directories twice
186189
// rather than constructing the configs in one iteration. It's worth re-benchmarking that though.
187-
directories.insert(directory);
190+
directories.insert(dir);
191+
current = dir.parent();
188192
}
189193
}
190194
for directory in directories {
@@ -1009,6 +1013,14 @@ mod test {
10091013
Tester::new().with_cwd("fixtures/extends_config".into()).test_and_snapshot(args);
10101014
}
10111015

1016+
#[test]
1017+
fn test_nested_config_subdirectory() {
1018+
// This tests the specific scenario from issue #10156
1019+
// where a file is located in a subdirectory of a directory with a config file
1020+
let args = &["package3-deep-config"];
1021+
Tester::new().with_cwd("fixtures/nested_config".into()).test_and_snapshot(args);
1022+
}
1023+
10121024
#[test]
10131025
fn test_nested_config_explicit_config_precedence() {
10141026
// `--config` takes absolute precedence over nested configs, and will be used for
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
source: apps/oxlint/src/tester.rs
3+
---
4+
##########
5+
arguments: package3-deep-config
6+
working directory: fixtures/nested_config
7+
----------
8+
9+
x ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-console.html\eslint(no-console)]8;;\: eslint(no-console): Unexpected console statement.
10+
,-[package3-deep-config/src/components/component.js:2:3]
11+
1 | export function Component() {
12+
2 | console.log("hello");
13+
: ^^^^^^^^^^^
14+
3 | }
15+
`----
16+
help: Delete this console statement.
17+
18+
Found 0 warnings and 1 error.
19+
Finished in <variable>ms on 1 file using 1 threads.
20+
----------
21+
CLI result: LintFoundErrors
22+
----------

0 commit comments

Comments
 (0)