Skip to content

Resolve ember-source from the linted file - #269

Merged
NullVoxPopuli merged 1 commit into
ember-tooling:mainfrom
NullVoxPopuli-ai-agent:nvp/resolve-ember-source-per-file
Oct 23, 2026
Merged

NullVoxPopuli merged 1 commit into
ember-tooling:mainfrom
NullVoxPopuli-ai-agent:nvp/resolve-ember-source-per-file

Conversation

@NullVoxPopuli-ai-agent

Copy link
Copy Markdown

In a pnpm monorepo, the built-in keyword check (on, fn, eq and the others) used the wrong ember-source. It now uses the ember-source that the linted file resolves.

Cause

The parser called require('ember-source/package.json') from its own folder. ember-source is not a dependency of the parser, so pnpm puts no copy next to it, and Node finds the hoisted copy in node_modules/.pnpm/node_modules. In a monorepo with more than one ember-source, that copy can be any of them.

Example: in ember-inspector, the UI package uses 7.3.1 and three test apps use 7.0.0. The parser got 7.0.0, so no-undef flagged every keyword in the UI.

Fix

  • The lookup starts at the directory of the linted file. The result is cached per directory.
  • If the file path is not absolute, the lookup starts at the current directory.
  • The emberSourceVersion option still wins over the lookup.

Tests

A new test makes a temporary monorepo: 7.0.0 at the root, 7.3.1 in packages/new-app, nothing in packages/old-app. A file in new-app gets the keywords, and a file in old-app does not. The test fails on the old lookup.

I also linted ember-inspector (emberjs/ember-inspector#2818) with this branch and without the emberSourceVersion option. The no-undef errors for the keywords are gone.

🤖 Generated with Claude Code

The built-in keyword check looked up ember-source from the parser's
own folder. ember-source is a dependency of the project, not of the
parser, so with pnpm that lookup finds only the hoisted copy. In a
monorepo the hoisted copy can be a different version than the one the
package uses. For example, a 7.3 app next to 7.0 test apps got 7.0, and
`no-undef` flagged `on`, `fn` and the other keywords.

The lookup now starts at the directory of the linted file, and the
result is cached per directory. The `emberSourceVersion` option still
wins over the lookup.

A new test makes a monorepo with 7.0.0 at the root and 7.3.1 in one
package. It fails on the old lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NullVoxPopuli-ai-agent pushed a commit to NullVoxPopuli-ai-agent/ember-inspector that referenced this pull request Oct 23, 2026
ember-eslint-parser finds ember-source, but from its own folder. With
pnpm, that is the hoisted 7.0 of the test apps, which is older than
the keywords. The parser fix is ember-tooling/ember-eslint-parser#269.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Oct 23, 2026
@NullVoxPopuli
NullVoxPopuli marked this pull request as ready for review October 23, 2026 14:39
@github-actions

Copy link
Copy Markdown
Contributor

🏎️ Benchmark Comparison

Parse

Benchmark Control (p50) Experiment (p50) Δ
🟢 gts small 941.08 ms 899.69 ms -4.4%
⚪ gts medium 1579.40 ms 1594.64 ms +1.0%
⚪ gts large 746.53 ms 747.25 ms +0.1%
⚪ gjs small 783.31 ms 789.60 ms +0.8%
⚪ gjs medium 1369.95 ms 1363.61 ms -0.5%
⚪ gjs large 628.04 ms 622.49 ms -0.9%
🔴 hbs small 128.11 ms 138.85 ms +8.4%
🟢 hbs medium 737.08 ms 718.30 ms -2.5%
🟢 hbs large 818.60 ms 799.53 ms -2.3%

🟢 faster · 🔴 slower · 🟠 slightly slower · ⚪ within 2%

Full mitata output
clk: ~3.10 GHz
cpu: AMD EPYC 7763 64-Core Processor
runtime: node 24.21.0 (x64-linux)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
gts small (control)          965.27 ms/iter    1.00 s      █               
                       (822.17 ms … 1.24 s)    1.10 s ▅▅ ▅ █  ▅▅ ▅ ▅  ▅   ▅
                    ( 15.09 mb …  91.67 mb)  35.13 mb ██▁█▁█▁▁██▁█▁█▁▁█▁▁▁█

gts small (experiment)       933.96 ms/iter 950.99 ms █████ █ ███   █     █
                       (816.97 ms … 1.20 s)    1.08 s █████ █ ███   █     █
                    ( 14.85 mb …  91.55 mb)  34.73 mb █████▁█▁███▁▁▁█▁▁▁▁▁█

                             ┌                                            ┐
                              ╷      ┌──────────────┬─────┐               ╷
         gts small (control)  ├──────┤              │     ├───────────────┤
                              ╵      └──────────────┴─────┘               ╵
                             ╷   ┌─────────────┬──┐                   ╷
      gts small (experiment) ├───┤             │  ├───────────────────┤
                             ╵   └─────────────┴──┘                   ╵
                             └                                            ┘
                             816.97 ms           960.60 ms           1.10 s

summary
  gts small (experiment)
   1.03x faster than gts small (control)

------------------------------------------- -------------------------------
gts medium (control)            1.62 s/iter    1.63 s     █                
                          (1.49 s … 2.04 s)    1.67 s     █         █ █    
                    ( 33.32 mb … 105.53 mb)  85.71 mb █▁▁▁█▁▁█▁▁█▁▁▁█▁█▁▁▁█

gts medium (experiment)         1.63 s/iter    1.64 s      █     █         
                          (1.50 s … 2.04 s)    1.68 s ▅   ▅█ ▅   █ ▅ ▅  ▅ ▅
                    ( 33.70 mb … 105.61 mb)  85.97 mb █▁▁▁██▁█▁▁▁█▁█▁█▁▁█▁█

                             ┌                                            ┐
                             ╷        ┌────────────────────┬──┐        ╷
        gts medium (control) ├────────┤                    │  ├────────┤
                             ╵        └────────────────────┴──┘        ╵
                               ╷         ┌───────────────────┬──┐         ╷
     gts medium (experiment)   ├─────────┤                   │  ├─────────┤
                               ╵         └───────────────────┴──┘         ╵
                             └                                            ┘
                             1.49 s              1.59 s              1.68 s

summary
  gts medium (control)
   1.01x faster than gts medium (experiment)

------------------------------------------- -------------------------------
gts large (control)          789.99 ms/iter 791.15 ms █ █  █               
                       (723.91 ms … 1.15 s) 837.43 ms █▅█ ▅█      ▅ ▅     ▅
                    ( 18.03 mb …  89.85 mb)  41.51 mb ███▁██▁▁▁▁▁▁█▁█▁▁▁▁▁█

gts large (experiment)       791.14 ms/iter 792.58 ms ██ █                 
                       (725.47 ms … 1.10 s) 859.87 ms ██▅█▅     ▅      ▅  ▅
                    ( 18.67 mb …  90.02 mb)  41.98 mb █████▁▁▁▁▁█▁▁▁▁▁▁█▁▁█

                             ┌                                            ┐
                             ╷┌────────────────────┬               ╷
         gts large (control) ├┤                    │───────────────┤
                             ╵└────────────────────┴               ╵
                              ╷┌───────────────────┬┐                     ╷
      gts large (experiment)  ├┤                   │├─────────────────────┤
                              ╵└───────────────────┴┘                     ╵
                             └                                            ┘
                             723.91 ms         791.89 ms          859.87 ms

summary
  gts large (control)
   1x faster than gts large (experiment)

------------------------------------------- -------------------------------
gjs small (control)          812.99 ms/iter 812.80 ms        █             
                       (740.52 ms … 1.08 s) 884.56 ms ▅▅ ▅▅▅▅█  ▅▅        ▅
                    ( 32.25 mb …  48.06 mb)  34.84 mb ██▁█████▁▁██▁▁▁▁▁▁▁▁█

gjs small (experiment)       815.77 ms/iter 818.36 ms █      █             
                       (744.19 ms … 1.10 s) 894.08 ms █▅▅▅  ▅█  ▅▅        ▅
                    ( 31.99 mb …  48.08 mb)  34.67 mb ████▁▁██▁▁██▁▁▁▁▁▁▁▁█

                             ┌                                            ┐
                             ╷    ┌───────────────┬                    ╷
         gjs small (control) ├────┤               │────────────────────┤
                             ╵    └───────────────┴                    ╵
                              ╷ ┌──────────────────┬┐                     ╷
      gjs small (experiment)  ├─┤                  │├─────────────────────┤
                              ╵ └──────────────────┴┘                     ╵
                             └                                            ┘
                             740.52 ms         817.30 ms          894.08 ms

summary
  gjs small (control)
   1x faster than gjs small (experiment)

------------------------------------------- -------------------------------
gjs medium (control)            1.41 s/iter    1.42 s               █      
                          (1.31 s … 1.79 s)    1.44 s ▅ ▅▅ ▅▅  ▅    █  ▅▅ ▅
                    ( 27.03 mb … 100.38 mb)  69.40 mb █▁██▁██▁▁█▁▁▁▁█▁▁██▁█

gjs medium (experiment)         1.40 s/iter    1.42 s      █   █          █
                          (1.31 s … 1.77 s)    1.43 s ▅   ▅█▅  █    ▅  ▅  █
                    ( 27.49 mb …  99.75 mb)  74.62 mb █▁▁▁███▁▁█▁▁▁▁█▁▁█▁▁█

                             ┌                                            ┐
                              ╷      ┌──────────────────────────┬──┐      ╷
        gjs medium (control)  ├──────┤                          │  ├──────┤
                              ╵      └──────────────────────────┴──┘      ╵
                             ╷         ┌──────────────────────┬────┐     ╷
     gjs medium (experiment) ├─────────┤                      │    ├─────┤
                             ╵         └──────────────────────┴────┘     ╵
                             └                                            ┘
                             1.31 s              1.37 s              1.44 s

summary
  gjs medium (experiment)
   1x faster than gjs medium (control)

------------------------------------------- -------------------------------
gjs large (control)          659.94 ms/iter 638.64 ms █                    
                    (607.53 ms … 933.15 ms) 730.80 ms █  █                 
                    (  2.12 mb …  74.21 mb)  33.11 mb ██████▁▁▁▁█▁▁▁▁▁▁▁▁▁█

gjs large (experiment)       661.04 ms/iter 639.52 ms  █                   
                    (605.72 ms … 932.06 ms) 742.50 ms  █   ▅               
                    (  2.58 mb …  74.19 mb)  32.98 mb ▇█▇▇▁█▁▁▁▁▇▁▁▁▁▁▁▁▁▁▇

                             ┌                                            ┐
                              ┌────────────────┬                      ╷
         gjs large (control)  │                │──────────────────────┤
                              └────────────────┴                      ╵
                             ╷ ┌───────────────┬                          ╷
      gjs large (experiment) ├─┤               │──────────────────────────┤
                             ╵ └───────────────┴                          ╵
                             └                                            ┘
                             605.72 ms         674.11 ms          742.50 ms

summary
  gjs large (control)
   1x faster than gjs large (experiment)

------------------------------------------- -------------------------------
hbs small (control)          144.56 ms/iter 152.23 ms      █ █         █   
                    (112.03 ms … 263.34 ms) 158.36 ms ▅ ▅  █ █  ▅   ▅  █  ▅
                    ( 51.34 mb …  57.25 mb)  53.94 mb █▁█▁▁█▁█▁▁█▁▁▁█▁▁█▁▁█

hbs small (experiment)       150.52 ms/iter 151.12 ms                 █    
                    (110.99 ms … 290.31 ms) 160.13 ms ▅ ▅    ▅▅▅ ▅▅   █  ▅▅
                    ( 51.25 mb …  56.17 mb)  53.87 mb █▁█▁▁▁▁███▁██▁▁▁█▁▁██

                             ┌                                            ┐
                              ╷         ┌───────────────────┬──────┐    ╷
         hbs small (control)  ├─────────┤                   │      ├────┤
                              ╵         └───────────────────┴──────┘    ╵
                             ╷              ┌────────────────────┬┐       ╷
      hbs small (experiment) ├──────────────┤                    │├───────┤
                             ╵              └────────────────────┴┘       ╵
                             └                                            ┘
                             110.99 ms         135.56 ms          160.13 ms

summary
  hbs small (control)
   1.04x faster than hbs small (experiment)

------------------------------------------- -------------------------------
hbs medium (control)         773.72 ms/iter 756.92 ms  █                   
                       (726.17 ms … 1.04 s) 809.94 ms  █ ▅                ▅
                    (  9.11 mb …  82.47 mb)  33.03 mb ▇█▁█▇▁▁▇▁▁▁▁▁▁▁▁▁▁▁▁█

hbs medium (experiment)      753.16 ms/iter 745.86 ms  █ ██                
                    (706.46 ms … 978.08 ms) 794.23 ms ▅█▅██    ▅         ▅▅
                    (  9.11 mb …  82.86 mb)  33.12 mb █████▁▁▁▁█▁▁▁▁▁▁▁▁▁██

                             ┌                                            ┐
                                      ╷┌──────────────────┬               ╷
        hbs medium (control)          ├┤                  │───────────────┤
                                      ╵└──────────────────┴               ╵
                             ╷ ┌─────────────────┬                 ╷
     hbs medium (experiment) ├─┤                 │─────────────────┤
                             ╵ └─────────────────┴                 ╵
                             └                                            ┘
                             706.46 ms         758.20 ms          809.94 ms

summary
  hbs medium (experiment)
   1.03x faster than hbs medium (control)

------------------------------------------- -------------------------------
hbs large (control)          841.77 ms/iter 823.27 ms      █               
                       (806.83 ms … 1.06 s) 867.08 ms   █  █               
                    ( 53.47 mb …  64.86 mb)  55.50 mb ███████▁▁▁▁▁▁▁▁▁▁▁▁▁█

hbs large (experiment)       823.88 ms/iter 805.90 ms   █                  
                       (793.58 ms … 1.04 s) 855.72 ms ▅▅█                  
                    ( 53.53 mb …  64.85 mb)  55.51 mb ███▁▇▇▁▁▁▁▁▁▁▁▁▁▁▁▁▁▇

                             ┌                                            ┐
                                     ╷  ┌──────────────────┬              ╷
         hbs large (control)         ├──┤                  │──────────────┤
                                     ╵  └──────────────────┴              ╵
                             ╷ ┌────────────────┬                  ╷
      hbs large (experiment) ├─┤                │──────────────────┤
                             ╵ └────────────────┴                  ╵
                             └                                            ┘
                             793.58 ms         830.33 ms          867.08 ms

summary
  hbs large (experiment)
   1.02x faster than hbs large (control)
### Project mode (type-aware)
Benchmark Control (p50) Experiment (p50) Δ
⚪ project warm parse x150 587.92 ms 581.96 ms -1.0%
⚪ project parse+typed x150 625.92 ms 616.22 ms -1.6%
⚪ projectService warm parse x150 603.58 ms 609.65 ms +1.0%
⚪ projectService parse+typed x150 638.03 ms 637.51 ms -0.1%

🟢 faster · 🔴 slower · 🟠 slightly slower · ⚪ within 2%

Full mitata output
clk: ~2.98 GHz
cpu: AMD EPYC 7763 64-Core Processor
runtime: node 24.21.0 (x64-linux)

benchmark                                   avg (min … max) p75 / p99    (min … top 1%)
----------------------------------------------------------- -------------------------------
project warm parse x150 (control)            588.35 ms/iter 593.77 ms         █  █         
                                    (572.66 ms … 610.48 ms) 601.30 ms █▁██▁▁▁▁█▁▁██▁▁█▁█▁▁█
                                  gc(275.46 ms … 283.79 ms) 114.26 mb (112.88 mb…115.08 mb)

project warm parse x150 (experiment)         584.79 ms/iter 588.99 ms                 █   ▃
                                    (568.13 ms … 601.74 ms) 593.89 ms ▆▁▁▁▁▁▆▆▆▁▆▆▁▁▁▁█▁▁▁█
                                  gc(274.86 ms … 285.83 ms) 111.81 mb (101.73 mb…117.58 mb)

                                             ┌                                            ┐
                                                   ╷     ┌──────────────┬───────┐         ╷
           project warm parse x150 (control)       ├─────┤              │       ├─────────┤
                                                   ╵     └──────────────┴───────┘         ╵
                                             ╷           ┌──────────┬────┐      ╷
        project warm parse x150 (experiment) ├───────────┤          │    ├──────┤
                                             ╵           └──────────┴────┘      ╵
                                             └                                            ┘
                                             568.13 ms         584.71 ms          601.30 ms

summary
  project warm parse x150 (experiment)
   1.01x faster than project warm parse x150 (control)

----------------------------------------------------------- -------------------------------
project parse+typed x150 (control)           628.45 ms/iter 633.88 ms █                    
                                    (612.47 ms … 662.26 ms) 650.90 ms █▁▆▆▁▁▁▆▆▆▁▆▁▁▆▁▁▁▁▁▆
                                  gc(282.36 ms … 319.11 ms) 119.48 mb (118.72 mb…123.36 mb)

project parse+typed x150 (experiment)        619.53 ms/iter 625.92 ms       █  █   █       
                                    (598.86 ms … 653.97 ms) 639.03 ms █▁▁██▁█▁▁█▁▁▁██▁▁▁▁▁█
                                  gc(286.56 ms … 295.99 ms) 112.62 mb (111.51 mb…116.85 mb)

                                             ┌                                            ┐
                                                         ┌─────────────┬───┐              ╷
          project parse+typed x150 (control)             │             │   ├──────────────┤
                                                         └─────────────┴───┘              ╵
                                             ╷      ┌──────────┬────┐           ╷
       project parse+typed x150 (experiment) ├──────┤          │    ├───────────┤
                                             ╵      └──────────┴────┘           ╵
                                             └                                            ┘
                                             598.86 ms         624.88 ms          650.90 ms

summary
  project parse+typed x150 (experiment)
   1.01x faster than project parse+typed x150 (control)

----------------------------------------------------------- -------------------------------
projectService warm parse x150 (control)     604.33 ms/iter 607.98 ms             █   ▃    
                                    (590.31 ms … 622.56 ms) 611.82 ms ▆▆▁▁▁▁▆▁▁▁▁▁█▁▁▆█▆▁▁▆
                                  gc(286.40 ms … 320.96 ms) 115.70 mb (114.52 mb…116.20 mb)

projectService warm parse x150 (experiment)  605.46 ms/iter 613.99 ms ██                  █
                                    (592.22 ms … 616.40 ms) 615.08 ms ██▁▁▁▁▁▁█▁▁▁▁▁▁███▁██
                                  gc(282.71 ms … 318.91 ms) 111.93 mb (110.64 mb…112.52 mb)

                                             ┌                                            ┐
                                             ╷          ┌─────────────┬──────┐      ╷
    projectService warm parse x150 (control) ├──────────┤             │      ├──────┤
                                             ╵          └─────────────┴──────┘      ╵
                                                ╷  ┌─────────────────────┬──────────────┐ ╷
 projectService warm parse x150 (experiment)    ├──┤                     │              ├─┤
                                                ╵  └─────────────────────┴──────────────┘ ╵
                                             └                                            ┘
                                             590.31 ms         602.70 ms          615.08 ms

summary
  projectService warm parse x150 (control)
   1x faster than projectService warm parse x150 (experiment)

----------------------------------------------------------- -------------------------------
projectService parse+typed x150 (control)    643.22 ms/iter 649.38 ms     █  █  █          
                                    (614.70 ms … 679.77 ms) 672.31 ms █▁▁▁█▁▁██▁█▁█▁█▁▁▁▁▁█
                                  gc(290.40 ms … 337.15 ms) 120.20 mb (119.05 mb…125.01 mb)

projectService parse+typed x150 (experiment) 638.78 ms/iter 644.49 ms   █          █       
                                    (626.36 ms … 660.74 ms) 647.36 ms █▁█▁█▁▁▁█▁▁█▁█▁▁▁█▁██
                                  gc(295.47 ms … 310.19 ms) 116.45 mb (114.97 mb…121.14 mb)

                                             ┌                                            ┐
                                             ╷        ┌────────────┬────┐                 ╷
   projectService parse+typed x150 (control) ├────────┤            │    ├─────────────────┤
                                             ╵        └────────────┴────┘                 ╵
                                                      ╷ ┌───────┬───┐  ╷
projectService parse+typed x150 (experiment)          ├─┤       │   ├──┤
                                                      ╵ └───────┴───┘  ╵
                                             └                                            ┘
                                             614.70 ms         643.50 ms          672.31 ms

summary
  projectService parse+typed x150 (experiment)
   1.01x faster than projectService parse+typed x150 (control)

@NullVoxPopuli
NullVoxPopuli merged commit 46a4a0a into ember-tooling:main Oct 23, 2026
40 checks passed
@NullVoxPopuli
NullVoxPopuli deleted the nvp/resolve-ember-source-per-file branch October 23, 2026 14:49
@github-actions github-actions Bot mentioned this pull request Oct 23, 2026
NullVoxPopuli-ai-agent pushed a commit to NullVoxPopuli-ai-agent/ember-inspector that referenced this pull request Oct 23, 2026
ember-eslint-parser 0.16.1 looks up ember-source from the linted file
(ember-tooling/ember-eslint-parser#269), so it finds the 7.3 of the UI
package and not the hoisted 7.0 of the test apps.

Only the parser entries change in the lockfile. `pnpm update` also
moved the postcss peer of webpack in the test apps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NullVoxPopuli-ai-agent pushed a commit to NullVoxPopuli-ai-agent/ember-inspector that referenced this pull request Oct 23, 2026
ember-eslint-parser finds ember-source, but from its own folder. With
pnpm, that is the hoisted 7.0 of the test apps, which is older than
the keywords. The parser fix is ember-tooling/ember-eslint-parser#269.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NullVoxPopuli-ai-agent pushed a commit to NullVoxPopuli-ai-agent/ember-inspector that referenced this pull request Oct 23, 2026
ember-eslint-parser 0.16.1 looks up ember-source from the linted file
(ember-tooling/ember-eslint-parser#269), so it finds the 7.3 of the UI
package and not the hoisted 7.0 of the test apps.

Only the parser entries change in the lockfile. `pnpm update` also
moved the postcss peer of webpack in the test apps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants