Skip to content

Commit 7d490d3

Browse files
committed
Clarify/elaborate on comments in tsconfig.json
1 parent dafae6d commit 7d490d3

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
3-
"target": "ES2022",
4-
"module": "ES2022",
3+
"target": "ES2021",
4+
"module": "ES2020",
55
"moduleResolution": "node",
66

77
// Trying to check Ember apps and addons with `allowJs: true` is a recipe
@@ -20,18 +20,21 @@
2020

2121
// Interop: these are viral and will require anyone downstream of your
2222
// package to *also* set them to true. If you *must* enable them to consume
23-
// an upstream package, you should
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.
2430
"allowSyntheticDefaultImports": false,
2531
"esModuleInterop": false,
2632

2733
// --- Lint-style rules
2834

29-
// You should feel free to change these, especially if you are already
30-
// covering them via linting (e.g. with @typescript-eslint).
31-
"noFallthroughCasesInSwitch": true,
32-
"noUnusedLocals": true,
33-
"noUnusedParameters": true,
34-
"noImplicitReturns": true,
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.
3538
"noPropertyAccessFromIndexSignature": true,
3639

3740
// --- Compilation/integration settings

ts/tests/commands/precompile-test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from 'path';
33
import { hook } from 'capture-console';
44
import ember from 'ember-cli-blueprint-test-helpers/lib/helpers/ember';
55
import blueprintHelpers from 'ember-cli-blueprint-test-helpers/helpers';
6+
import ts from 'typescript';
67
const setupTestHooks = blueprintHelpers.setupTestHooks;
78
const emberNew = blueprintHelpers.emberNew;
89

@@ -63,8 +64,8 @@ describe('Acceptance: ts:precompile command', function () {
6364
fs.writeFileSync('src/test-file.ts', `export const testString: string = 'hello';`);
6465

6566
let pkg = fs.readJsonSync('package.json');
66-
let tsconfig = fs.readJSONSync('tsconfig.json');
67-
tsconfig.include.push('src');
67+
let tsconfig = ts.readConfigFile('tsconfig.json', ts.sys.readFile).config;
68+
tsconfig.tsconfig.include.push('src');
6869
tsconfig.compilerOptions.paths[`${pkg.name}/src/*`] = ['src/*'];
6970
fs.writeJSONSync('tsconfig.json', tsconfig);
7071

@@ -85,7 +86,7 @@ describe('Acceptance: ts:precompile command', function () {
8586
);
8687

8788
let pkg = fs.readJsonSync('package.json');
88-
let tsconfig = fs.readJSONSync('tsconfig.json');
89+
let tsconfig = ts.readConfigFile('tsconfig.json', ts.sys.readFile).config;
8990
tsconfig.include.push('src');
9091
tsconfig.compilerOptions.paths[`${pkg.name}/*`] = ['addon-test-support/*'];
9192
fs.writeJSONSync('tsconfig.json', tsconfig);

0 commit comments

Comments
 (0)