Skip to content

Commit

Permalink
Do not allow deprecations to exist (#44)
Browse files Browse the repository at this point in the history
* Do not allow deprecations to exist

* We don't need deprecation-workflow (the package). See: ember-cli/ember-cli-deprecation-workflow#156

* Fix a deprecation

* Fix deprecations
  • Loading branch information
NullVoxPopuli committed Jan 9, 2024
1 parent 3f5b777 commit 0e25436
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 24 deletions.
49 changes: 27 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions reactiveweb/src/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ export class State<Value> {
* that error will be the value returned by this property
*/
get error() {
if (this.data?.state !== 'REJECTED') {
return null;
}

return this.data?.error ?? null;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/min-supported/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@babel/eslint-parser": "^7.22.15",
"@ember/optional-features": "^2.0.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.2.0",
"@ember/test-helpers": "^3.2.1",
"@embroider/compat": "^3.2.3",
"@embroider/core": "^3.3.0",
"@embroider/webpack": "^3.2.0",
Expand Down
5 changes: 5 additions & 0 deletions tests/test-app/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import Application from '@ember/application';
import { importSync, isDevelopingApp, macroCondition } from '@embroider/macros';

import loadInitializers from 'ember-load-initializers';
import Resolver from 'ember-resolver';
import config from 'test-app/config/environment';

if (macroCondition(isDevelopingApp())) {
importSync('test-app/deprecation-workflow');
}

export default class App extends Application {
modulePrefix = config.modulePrefix;
podModulePrefix = config.podModulePrefix;
Expand Down
23 changes: 23 additions & 0 deletions tests/test-app/app/deprecation-workflow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { registerDeprecationHandler } from '@ember/debug';

import config from 'test-app/config/environment';

const SHOULD_THROW = config.environment !== 'production';
const SILENCED_DEPRECATIONS: string[] = [
// Add ids of deprecations you temporarily want to silence here.
];

registerDeprecationHandler((message, options, next) => {
if (!options) {
console.error('Missing options');
throw new Error(message);
}

if (SILENCED_DEPRECATIONS.includes(options.id)) {
return;
} else if (SHOULD_THROW) {
throw new Error(message);
}

next(message, options);
});
3 changes: 2 additions & 1 deletion tests/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@babel/eslint-parser": "^7.22.15",
"@ember/optional-features": "^2.0.0",
"@ember/string": "^3.1.1",
"@ember/test-helpers": "^3.2.0",
"@ember/test-helpers": "^3.2.1",
"@embroider/compat": "^3.2.3",
"@embroider/core": "^3.3.0",
"@embroider/webpack": "^3.2.0",
Expand Down Expand Up @@ -98,6 +98,7 @@
},
"dependencies": {
"@ember/test-waiters": "^3.1.0",
"@embroider/macros": "^1.13.4",
"@nullvoxpopuli/eslint-configs": "^3.2.2",
"ember-concurrency": "^3.1.1",
"ember-resources": "^6.4.2",
Expand Down

0 comments on commit 0e25436

Please sign in to comment.