Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

allow for "budgets" as a deprecation handler

Aperta
#64 4 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
tooling

Direzione di ricerca

Inizia dalla configurazione del workflow in config/deprecation-workflow.js e verifica come sono configurati gli handler esistenti. Definisci come vengono tracciati i conteggi del budget, quando il superamento di un budget genera un errore e come i conteggi correnti possono essere copiati dal browser nella configurazione. Il lavoro è completato quando il comportamento di budget proposto funziona in esecuzioni controllate senza compromettere gli handler silence, log o throw.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Context

Currently, ember-cli-deprecation-workflow supports 3 handlers for deprecations:

silence Keeps this deprecation from spewing all over the console
log Normal deprecation behavior runs for this deprecation and messages are logged to the console
throw The error is thrown instead of allowing the deprecated behavior to run. WARNING: APPLICATION MAY GO 💥

While these work for their intended purposes really well, they don't necessarily help cases where you might not be able to address a deprecation right away, but a team wants to prevent the deprecation count from growing from things like copy-pasting code that will cause new deprecations to pile up.

Proposal

Users of this addon will be able to specify a budget option to the handler option for each deprecation. If the deprecation is triggered more than the allowed budget in certain scenarios (e.g. a test suite run where conditions are more controlled), then the handler will throw. This would allow a team to keep existing code that causes deprecations but fail builds in CI for any new code that increases deprecation use.

For example, take the following config/deprecation-workflow.js:

// config/deprecation-workflow.js
window.deprecationWorkflow = window.deprecationWorkflow || {};
window.deprecationWorkflow.config = {
  workflow: [
    { matchId: 'ember-string-utils.fmt', handler: { budget: 10 } },
  ]
};

if a new pull request was opened with the following code:

Ember.String.format('some string %s', 'hi')

This would increase the number of deprecations invoked to 11, violating the budget, causing ember-cli-deprecation-workflow to throw, failing the build.

We would likely also need some facility to make copy/pasting the existing deprecation count (to set the initial budget) to config/deprecation-workflow.js from the browser easier as well.

I'd be happy to PR this, just wanted to get thoughts on the idea before going through the effort of writing code.

Lingua principale
JavaScript
Stelle
166
Fork
44
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ember-cli/ember-cli-deprecation-workflow

Tutte le issue di ember-cli/ember-cli-deprecation-workflow

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.