Skip to content

Commit ae729ce

Browse files
committed
Update blueprint to use @tsconfig/ember
This aligns us with the emerging default across the rest of the ecosystem and, just as importantly, means that we don't need to have folks do anything manually to stay in sync as we iterate on and improve the base config over time: they just need to upgrade the version of the base config they're using in their `package.json`.
1 parent 52009e2 commit ae729ce

File tree

5 files changed

+12
-63
lines changed

5 files changed

+12
-63
lines changed

blueprint-files/ember-cli-typescript/tsconfig.json

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,6 @@
11
{
2+
"extends": "@tsconfig/ember/tsconfig.json",
23
"compilerOptions": {
3-
"target": "ES2021",
4-
"module": "ES2020",
5-
"moduleResolution": "node",
6-
7-
// Trying to check Ember apps and addons with `allowJs: true` is a recipe
8-
// for many unresolvable type errors, because with *considerable* extra
9-
// configuration it ends up including many files which are *not* valid and
10-
// cannot be: they *appear* to be resolve-able to TS, but are in fact not in
11-
// valid Node-resolvable locations and may not have TS-ready types. This
12-
// will likely improve over time
13-
"allowJs": false,
14-
15-
// --- TS for SemVer Types compatibility
16-
// Strictness settings -- you should *not* change these: Ember code is not
17-
// guaranteed to type check with these set to looser values.
18-
"strict": true,
19-
"noUncheckedIndexedAccess": true,
20-
21-
// Interop: these are viral and will require anyone downstream of your
22-
// package to *also* set them to true. If you *must* enable them to consume
23-
// an upstream package, you should document that for downstream consumers to
24-
// be aware of.
25-
//
26-
// These *are* safe for apps to enable, since they do not *have* downstream
27-
// consumers; but leaving them off is still preferred when possible, since
28-
// it makes it easier to switch between apps and addons and have the same
29-
// rules for what can be imported and how.
30-
"allowSyntheticDefaultImports": false,
31-
"esModuleInterop": false,
32-
33-
// --- Lint-style rules
34-
35-
// TypeScript also supplies some lint-style checks; nearly all of them are
36-
// better handled by ESLint with the `@typescript-eslint`. This one is more
37-
// like a safety check, though, so we leave it on.
38-
"noPropertyAccessFromIndexSignature": true,
39-
40-
// --- Compilation/integration settings
41-
// Setting `noEmitOnError` here allows ember-cli-typescript to catch errors
42-
// and inject them into Ember CLI's build error reporting, which provides
43-
// nice feedback for when
44-
"noEmitOnError": true,
45-
46-
// We use Babel for emitting runtime code, because it's very important that
47-
// we always and only use the same transpiler for non-stable features, in
48-
// particular decorators. If you were to change this to `true`, it could
49-
// lead to accidentally generating code with `tsc` instead of Babel, and
50-
// could thereby result in broken code at runtime.
51-
"noEmit": true,
52-
53-
// Ember makes heavy use of decorators; TS does not support them at all
54-
// without this flag.
55-
"experimentalDecorators": true,
56-
57-
// Support generation of source maps. Note: you must *also* enable source
58-
// maps in your `ember-cli-babel` config and/or `babel.config.js`.
59-
"declaration": true,
60-
"declarationMap": true,
61-
"inlineSourceMap": true,
62-
"inlineSources": true,
634

645
// The combination of `baseUrl` with `paths` allows Ember's classic package
656
// layout, which is not resolvable with the Node resolution algorithm, to

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@ember/optional-features": "2.0.0",
5656
"@glimmer/component": "^1.0.4",
5757
"@glimmer/tracking": "^1.0.4",
58+
"@tsconfig/ember": "^1.0.0",
5859
"@typed-ember/renovate-config": "1.2.1",
5960
"@types/capture-console": "1.0.1",
6061
"@types/chai": "4.3.0",

ts/blueprints/ember-cli-typescript/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ module.exports = {
148148

149149
let packages = [
150150
'typescript',
151+
'@tsconfig/ember',
151152
'ember-cli-typescript-blueprints',
152153
'@types/ember-resolver',
153154
'@types/ember__test-helpers',

ts/tests/blueprints/ember-cli-typescript-test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ describe('Acceptance: ember-cli-typescript generator', function () {
6060
expect(pkgJson.scripts.postpack).to.be.undefined;
6161
expect(pkgJson.devDependencies).to.include.all.keys('ember-cli-typescript-blueprints');
6262
expect(pkgJson.devDependencies).to.include.all.keys('ember-data');
63+
expect(pkgJson.devDependencies).to.include.all.keys('@tsconfig/ember');
6364
expect(pkgJson.devDependencies).to.include.all.keys('@types/ember-data');
6465
expect(pkgJson.devDependencies).to.include.all.keys('@types/ember-data__adapter');
6566
expect(pkgJson.devDependencies).to.include.all.keys('@types/ember-data__model');
@@ -73,15 +74,13 @@ describe('Acceptance: ember-cli-typescript generator', function () {
7374
expect(tsconfig).to.exist;
7475

7576
const tsconfigJson = ts.parseConfigFileTextToJson('tsconfig.json', tsconfig.content).config;
77+
expect(tsconfigJson.extends).to.equal('@tsconfig/ember/tsconfig.json');
7678
expect(tsconfigJson.compilerOptions.paths).to.deep.equal({
7779
'my-app/tests/*': ['tests/*'],
7880
'my-app/*': ['app/*'],
7981
'*': ['types/*'],
8082
});
8183

82-
expect(tsconfigJson.compilerOptions.inlineSourceMap).to.equal(true);
83-
expect(tsconfigJson.compilerOptions.inlineSources).to.equal(true);
84-
8584
expect(tsconfigJson.include).to.deep.equal(['app/**/*', 'tests/**/*', 'types/**/*']);
8685

8786
const projectTypes = file('types/my-app/index.d.ts');

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,11 @@
10991099
dependencies:
11001100
defer-to-connect "^2.0.0"
11011101

1102+
"@tsconfig/ember@^1.0.0":
1103+
version "1.0.0"
1104+
resolved "https://registry.yarnpkg.com/@tsconfig/ember/-/ember-1.0.0.tgz#e982a5d47b03bb0ac5a93d011596f8520e046d96"
1105+
integrity sha512-2FXPaVQLJxDHzfkHYVH2R3YC62/e1/k3kQ/1KyzET8/MhJoJeL9F+wmPxASm8v2QYBj8Ct+COS+ZTknrfJ/SAQ==
1106+
11021107
"@typed-ember/[email protected]":
11031108
version "1.2.1"
11041109
resolved "https://registry.yarnpkg.com/@typed-ember/renovate-config/-/renovate-config-1.2.1.tgz#2e964c03a60df375a5a67aad9ef7d84911101a1c"
@@ -7415,9 +7420,11 @@ imurmurhash@^0.1.4:
74157420

74167421
"in-repo-a@link:tests/dummy/lib/in-repo-a":
74177422
version "0.0.0"
7423+
uid ""
74187424

74197425
"in-repo-b@link:tests/dummy/lib/in-repo-b":
74207426
version "0.0.0"
7427+
uid ""
74217428

74227429
indent-string@^4.0.0:
74237430
version "4.0.0"

0 commit comments

Comments
 (0)