Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ To enable TypeScript support, create a `tsconfig.json` file at the root of your
-----------
{
// extend Kibana's tsconfig, or use your own settings
"extends": "../../kibana/tsconfig.json",
"extends": "../../kibana/tsconfig.base.json",

// tell the TypeScript compiler where to find your source files
"include": [
Expand Down
2 changes: 1 addition & 1 deletion examples/alerting_example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/bfetch_explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/dashboard_embeddable_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/developer_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
9 changes: 6 additions & 3 deletions examples/embeddable_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target",
"skipLibCheck": true
"skipLibCheck": true,
"jsx": "react",
},
"include": [
"index.ts",
Expand All @@ -12,5 +14,6 @@
"server/**/*.ts",
"../../typings/**/*"
],
"exclude": []
"exclude": [],
"references": [{"path": "../../tsconfig.src.json"}]
}
2 changes: 1 addition & 1 deletion examples/embeddable_explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/state_containers_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/ui_action_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/ui_actions_explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/url_generators_examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion examples/url_generators_explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"**/@types/chai": "^4.2.11",
"**/cypress/@types/lodash": "^4.14.155",
"**/cypress/lodash": "^4.15.19",
"**/typescript": "3.9.5",
"**/typescript": "4.0.0-beta",
"**/graphql-toolkit/lodash": "^4.17.15",
"**/hoist-non-react-statics": "^3.3.2",
"**/isomorphic-git/**/base64-js": "^1.2.1",
Expand Down Expand Up @@ -503,7 +503,7 @@
"supertest-as-promised": "^4.0.2",
"tape": "^4.13.0",
"tree-kill": "^1.2.2",
"typescript": "3.9.5",
"typescript": "4.0.0-beta",
"typings-tester": "^0.3.2",
"vinyl-fs": "^3.0.3",
"xml2js": "^0.4.22",
Expand Down
2 changes: 1 addition & 1 deletion packages/elastic-datemath/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"outDir": "./target"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-analytics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-config-schema/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target",
"target": "ES2019",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"src/**/*.ts"
]
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-expect/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"expect.js.d.ts"
]
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-i18n/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"src/**/*.ts",
"src/**/*.tsx",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-interpreter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": ["index.d.ts", "src/**/*.d.ts"]
}
2 changes: 1 addition & 1 deletion packages/kbn-monaco/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"declaration": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"index.d.ts",
"src/**/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-plugin-generator/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": ["**/*", "index.js.d.ts"],
"exclude": ["sao_template/template/*"]
}
2 changes: 1 addition & 1 deletion packages/kbn-plugin-helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Plugin code can be written in [TypeScript](http://www.typescriptlang.org/) if de
```js
{
// extend Kibana's tsconfig, or use your own settings
"extends": "../../kibana/tsconfig.json",
"extends": "../../kibana/tsconfig.base.json",

// tell the TypeScript compiler where to find your source files
"include": [
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-plugin-helpers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target",
"declaration": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"./src/**/*.ts",
"./dist/*.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-release-notes/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"declaration": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-telemetry-tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"src/**/*",
]
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test-subj-selector/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"index.d.ts"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"types/**/*",
"src/**/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"include": [
"index.d.ts",
"theme.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-utility-types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationDir": "./target",
Expand Down
8 changes: 5 additions & 3 deletions src/dev/typescript/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ export class Project {
public name: string;
public config: any;
public disableTypeCheck: boolean;
public disableNoEmit: boolean;

private readonly include: IMinimatch[];
private readonly exclude: IMinimatch[];

constructor(
public tsConfigPath: string,
options: { name?: string; disableTypeCheck?: boolean } = {}
options: { name?: string; disableTypeCheck?: boolean; disableNoEmit?: boolean } = {}
) {
this.config = parseTsConfig(tsConfigPath);

Expand All @@ -69,16 +70,17 @@ export class Project {
exclude?: string[];
};

if (files || !include) {
if ((files && files.length > 0) || !include) {
throw new Error(
'tsconfig.json files in the Kibana repo must use "include" keys and not "files"'
);
}

this.directory = dirname(this.tsConfigPath);
this.disableTypeCheck = options.disableTypeCheck || false;
this.disableNoEmit = options.disableNoEmit || false;
this.name = options.name || relative(REPO_ROOT, this.directory) || basename(this.directory);
this.include = makeMatchers(this.directory, include);
this.include = makeMatchers(this.directory, include || []);
this.exclude = makeMatchers(this.directory, exclude);
}

Expand Down
7 changes: 6 additions & 1 deletion src/dev/typescript/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ import { REPO_ROOT } from '../constants';
import { Project } from './project';

export const PROJECTS = [
new Project(resolve(REPO_ROOT, 'tsconfig.json')),
new Project(resolve(REPO_ROOT, 'tsconfig.oss.json'), {
disableNoEmit: true,
}),
new Project(resolve(REPO_ROOT, 'tsconfig.test.json'), {
disableNoEmit: true,
}),
new Project(resolve(REPO_ROOT, 'test/tsconfig.json'), { name: 'kibana/test' }),
new Project(resolve(REPO_ROOT, 'x-pack/tsconfig.json')),
new Project(resolve(REPO_ROOT, 'x-pack/test/tsconfig.json'), { name: 'x-pack/test' }),
Expand Down
6 changes: 4 additions & 2 deletions src/dev/typescript/run_type_check_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function runTypeCheckCli() {
process.exit();
}

const tscArgs = ['--noEmit', '--pretty', ...(opts['skip-lib-check'] ? ['--skipLibCheck'] : [])];
const tscArgs = ['--pretty', ...(opts['skip-lib-check'] ? ['--skipLibCheck'] : [])];
const projects = filterProjectsByFlag(opts.project).filter((p) => !p.disableTypeCheck);

if (!projects.length) {
Expand All @@ -90,7 +90,9 @@ export function runTypeCheckCli() {
execInProjects(log, projects, process.execPath, (project) => [
...(project.name.startsWith('x-pack') ? ['--max-old-space-size=4096'] : []),
require.resolve('typescript/bin/tsc'),
...['--project', project.tsConfigPath],
...(project.config.compilerOptions?.composite
? ['-b', project.tsConfigPath]
: ['--noEmit', '--project', project.tsConfigPath]),
...tscArgs,
]);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion test/plugin_functional/plugins/app_link_test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion test/plugin_functional/plugins/core_plugin_a/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
2 changes: 1 addition & 1 deletion test/plugin_functional/plugins/core_plugin_b/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../../tsconfig.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
Expand Down
Loading