Skip to content

Commit 92448bc

Browse files
devversionmmalerba
authored andcommitted
build: fix tslint being unable to type check cross-package references
Since we use a `tsconfig.json` for TSLint which does not have any path mappings, TSlint is unable to use the `ts.TypeChecker` for nodes which are declared in a separate entry-point or package. This causes custom TSLint rules such as the `undecorated-base-class-di` rule to accidentally ignore issues such as that `MatCheckbox` (from mdc-checkbox) depends on the undecorated base class `MatMenu`.
1 parent 6cf2dd2 commit 92448bc

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

tsconfig.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@
1515
"skipLibCheck": true,
1616
"target": "es2015",
1717
"lib": ["es5", "es2015", "dom"],
18-
"types": ["jasmine"]
18+
"types": ["jasmine"],
19+
"baseUrl": ".",
20+
"paths": {
21+
"@angular/cdk": ["./src/cdk"],
22+
"@angular/cdk/*": ["./src/cdk/*"],
23+
"@angular/material/*": ["./src/material/*"],
24+
"@angular/material-experimental/*": ["./src/material-experimental/*"],
25+
"@angular/material-experimental": ["./src/material-experimental"],
26+
"@angular/cdk-experimental/*": ["./src/cdk-experimental/*"],
27+
"@angular/cdk-experimental": ["./src/cdk-experimental"],
28+
"@angular/material-moment-adapter": ["./src/material-moment-adapter"],
29+
"@angular/material-examples": ["./src/packages/material-examples"]
30+
}
1931
},
2032
"include": [
2133
"src/**/*.ts",
@@ -33,6 +45,12 @@
3345

3446
// IDEs should not type-check the different node_modules directories of the different packages.
3547
// This would cause the IDEs to be slower and also linters would check the node_modules.
36-
"node_modules/"
48+
"node_modules/",
49+
50+
// Exclude schematic template files and test cases which aren't valid TS files.
51+
"src/material/schematics/ng-generate/*/files/**/*",
52+
"src/cdk/schematics/ng-generate/*/files/**/*",
53+
"src/cdk/schematics/ng-update/test-cases/**/*",
54+
"src/material/schematics/ng-update/test-cases/**/*"
3755
]
3856
}

0 commit comments

Comments
 (0)