Skip to content

Add no-legacy-computed rule to disallow computed and computed macros#2818

Open
Copilot wants to merge 2 commits into
masterfrom
copilot/lint-computed-macros
Open

Add no-legacy-computed rule to disallow computed and computed macros#2818
Copilot wants to merge 2 commits into
masterfrom
copilot/lint-computed-macros

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This adds an opt-in lint rule to prevent introducing legacy Ember computed APIs while teams migrate to tracked/getter-based patterns. It covers both computed from @ember/object and all macro imports from @ember/object/computed.

  • New rule: ember/no-legacy-computed

    • Reports ImportSpecifier for computed imported from @ember/object
    • Reports all imports from @ember/object/computed (e.g. and, gt, sortBy, etc.)
    • Implemented as non-recommended (no default config changes)
  • Rule docs

    • Added docs/rules/no-legacy-computed.md with scope, rationale, and correct/incorrect examples
    • Regenerated rule documentation metadata so the rule appears in the README rule table
  • Rule tests

    • Added focused coverage for:
      • valid non-Ember imports and modern patterns
      • invalid direct and aliased computed imports
      • invalid single/multiple macro imports from @ember/object/computed
      • side-effect import from @ember/object/computed
// now flagged
import { computed } from '@ember/object';
import { and, gt, sortBy } from '@ember/object/computed';

Copilot AI changed the title [WIP] Add lint rule against computed macros Add no-legacy-computed rule to disallow computed and computed macros Jul 1, 2026
Copilot AI requested a review from NullVoxPopuli July 1, 2026 18:00
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review July 2, 2026 16:25
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🏎️ Benchmark Comparison

Benchmark Control (p50) Experiment (p50) Δ
🟢 js small 14.39 ms 14.03 ms -2.5%
js medium 6.93 ms 6.93 ms -0.0%
🟢 js large 2.90 ms 2.80 ms -3.3%
gjs small 1.25 ms 1.25 ms -0.4%
gjs medium 622.30 µs 616.99 µs -0.9%
gjs large 237.79 µs 239.48 µs +0.7%
gts small 1.24 ms 1.24 ms -0.0%
gts medium 619.76 µs 620.04 µs +0.0%
gts large 237.79 µs 239.12 µs +0.6%

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

Full mitata output
clk: ~3.35 GHz
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
runtime: node 24.16.0 (x64-linux)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
js small (control)            17.08 ms/iter  17.74 ms  █▅                  
                      (12.10 ms … 30.43 ms)  30.19 ms ▆██ ▆ ▃              
                    (  5.62 mb …  10.20 mb)   7.34 mb ███▄███▄▁▁▁▄▁█▄▁▁▄▁▄▄

js small (experiment)         14.52 ms/iter  15.75 ms    █▅                
                      (12.16 ms … 19.17 ms)  18.65 ms ▃ ▃██ ▃▆   ▃         
                    (  6.81 mb …   8.24 mb)   6.93 mb █▁███▄██▄▄▄█▁██▄▄▄▁▁▄

                             ┌                                            ┐
                             ╷  ┌────────┬─┐                              ╷
          js small (control) ├──┤        │ ├──────────────────────────────┤
                             ╵  └────────┴─┘                              ╵
                             ╷ ┌───┬──┐      ╷
       js small (experiment) ├─┤   │  ├──────┤
                             ╵ └───┴──┘      ╵
                             └                                            ┘
                             12.10 ms           21.15 ms           30.19 ms

summary
  js small (experiment)
   1.18x faster than js small (control)

------------------------------------------- -------------------------------
js medium (control)            7.71 ms/iter   8.04 ms  █                   
                       (6.34 ms … 14.84 ms)  14.73 ms  █▂                  
                    (  3.45 mb …   4.15 mb)   3.56 mb ▇██▃▆▄▄▁▂▁▁▂▁▂▂▁▁▁▁▁▂

js medium (experiment)         7.45 ms/iter   7.70 ms   █                  
                       (6.20 ms … 13.44 ms)  12.94 ms  ▆█                  
                    (  2.59 mb …   4.47 mb)   3.56 mb ▇███▅▄▃▅▂▃▂▁▁▂▂▁▁▁▂▁▂

                             ┌                                            ┐
                              ╷ ┌────┬─┐                                  ╷
         js medium (control)  ├─┤    │ ├──────────────────────────────────┤
                              ╵ └────┴─┘                                  ╵
                             ╷  ┌───┬┐                           ╷
      js medium (experiment) ├──┤   │├───────────────────────────┤
                             ╵  └───┴┘                           ╵
                             └                                            ┘
                             6.20 ms           10.47 ms            14.73 ms

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

------------------------------------------- -------------------------------
js large (control)             3.54 ms/iter   3.69 ms  █                   
                        (2.60 ms … 9.77 ms)   8.44 ms ▂█                   
                    (  8.11 kb …   2.98 mb)   1.45 mb ██▄▃▄▃▂▂▂▂▁▂▃▁▁▂▂▁▁▁▁

js large (experiment)          3.13 ms/iter   2.93 ms  █▅                  
                        (2.51 ms … 8.16 ms)   6.10 ms  ██                  
                    (313.64 kb …   2.57 mb)   1.43 mb ▄██▃▂▂▃▂▂▁▂▂▂▂▁▂▂▂▁▁▁

                             ┌                                            ┐
                              ╷┌─────┬┐                                   ╷
          js large (control)  ├┤     │├───────────────────────────────────┤
                              ╵└─────┴┘                                   ╵
                             ╷ ┌──┬                     ╷
       js large (experiment) ├─┤  │─────────────────────┤
                             ╵ └──┴                     ╵
                             └                                            ┘
                             2.51 ms            5.47 ms             8.44 ms

summary
  js large (experiment)
   1.13x faster than js large (control)

------------------------------------------- -------------------------------
gjs small (control)            1.39 ms/iter   1.32 ms █                    
                        (1.17 ms … 6.89 ms)   6.16 ms █▂                   
                    (244.48 kb …   1.66 mb)   1.06 mb ██▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gjs small (experiment)         1.46 ms/iter   1.28 ms █                    
                        (1.16 ms … 7.00 ms)   5.98 ms █                    
                    (168.46 kb …   1.78 mb)   1.06 mb █▅▁▁▄▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷┌┬                                          ╷
         gjs small (control) ├┤│──────────────────────────────────────────┤
                             ╵└┴                                          ╵
                             ╷┌─┬                                       ╷
      gjs small (experiment) ├┤ │───────────────────────────────────────┤
                             ╵└─┴                                       ╵
                             └                                            ┘
                             1.16 ms            3.66 ms             6.16 ms

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

------------------------------------------- -------------------------------
gjs medium (control)         679.86 µs/iter 642.01 µs █                    
                      (568.88 µs … 6.38 ms)   3.67 ms █                    
                    (131.96 kb …   1.10 mb) 542.25 kb █▇▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gjs medium (experiment)      671.21 µs/iter 636.44 µs  █                   
                      (566.03 µs … 6.70 ms)   1.84 ms ▃█                   
                    (113.27 kb …   1.04 mb) 541.27 kb ██▄▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ┌─┬                                          ╷
        gjs medium (control) │ │──────────────────────────────────────────┤
                             └─┴                                          ╵
                             ┌─┬                ╷
     gjs medium (experiment) │ │────────────────┤
                             └─┴                ╵
                             └                                            ┘
                             566.03 µs           2.12 ms            3.67 ms

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

------------------------------------------- -------------------------------
gjs large (control)          266.11 µs/iter 257.19 µs  █▄                  
                      (225.58 µs … 6.08 ms) 331.24 µs  ██                  
                    ( 63.20 kb …   1.24 mb) 217.35 kb ▆███▆▇▆▅▄▅▄▃▂▂▁▁▁▁▁▁▁

gjs large (experiment)       277.63 µs/iter 266.43 µs  █                   
                      (224.43 µs … 6.40 ms) 444.21 µs ▆█                   
                    (133.56 kb … 965.82 kb) 216.65 kb ███▇▇▅▃▂▂▁▁▁▁▁▁▂▂▂▂▁▁

                             ┌                                            ┐
                             ╷ ┌──────┬            ╷
         gjs large (control) ├─┤      │────────────┤
                             ╵ └──────┴            ╵
                             ╷┌─────────┬                                 ╷
      gjs large (experiment) ├┤         │─────────────────────────────────┤
                             ╵└─────────┴                                 ╵
                             └                                            ┘
                             224.43 µs         334.32 µs          444.21 µs

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

------------------------------------------- -------------------------------
gts small (control)            1.35 ms/iter   1.27 ms █                    
                        (1.17 ms … 7.24 ms)   5.58 ms █                    
                    (216.52 kb …   1.91 mb)   1.06 mb █▆▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gts small (experiment)         1.35 ms/iter   1.28 ms █                    
                        (1.16 ms … 7.11 ms)   5.94 ms █                    
                    (415.04 kb …   1.72 mb)   1.05 mb ██▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷┌┬                                       ╷
         gts small (control) ├┤│───────────────────────────────────────┤
                             ╵└┴                                       ╵
                             ╷┌┬                                          ╷
      gts small (experiment) ├┤│──────────────────────────────────────────┤
                             ╵└┴                                          ╵
                             └                                            ┘
                             1.16 ms            3.55 ms             5.94 ms

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

------------------------------------------- -------------------------------
gts medium (control)         670.86 µs/iter 637.81 µs  █                   
                      (568.35 µs … 6.48 ms)   1.36 ms  █▇                  
                    (540.29 kb …   1.13 mb) 542.38 kb ▇██▄▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

gts medium (experiment)      673.77 µs/iter 638.14 µs  █                   
                      (569.31 µs … 6.64 ms)   1.91 ms ▃█                   
                    (539.31 kb …   1.26 mb) 541.51 kb ██▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁

                             ┌                                            ┐
                             ╷┌─┬                       ╷
        gts medium (control) ├┤ │───────────────────────┤
                             ╵└─┴                       ╵
                             ╷┌──┬                                        ╷
     gts medium (experiment) ├┤  │────────────────────────────────────────┤
                             ╵└──┴                                        ╵
                             └                                            ┘
                             568.35 µs           1.24 ms            1.91 ms

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

------------------------------------------- -------------------------------
gts large (control)          265.17 µs/iter 259.53 µs  █▇                  
                      (224.66 µs … 5.69 ms) 324.51 µs  ██                  
                    (170.66 kb … 934.19 kb) 217.09 kb ▃███▆█▆▅▅▅▆▄▃▃▂▁▁▁▁▁▁

gts large (experiment)       264.24 µs/iter 257.42 µs  █▄▂                 
                      (225.67 µs … 5.95 ms) 315.42 µs  ███                 
                    (181.12 kb … 739.03 kb) 216.47 kb ▅████▇▇▅▅▅▆▆▄▃▂▂▁▁▁▁▁

                             ┌                                            ┐
                             ╷  ┌──────────────┬                          ╷
         gts large (control) ├──┤              │──────────────────────────┤
                             ╵  └──────────────┴                          ╵
                             ╷   ┌─────────────┬                      ╷
      gts large (experiment) ├───┤             │──────────────────────┤
                             ╵   └─────────────┴                      ╵
                             └                                            ┘
                             224.66 µs         274.58 µs          324.51 µs

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lint against all computed and computed macros

2 participants