mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
Exclude ambient type definitions from checkTsProjects (#33737)
This commit is contained in:
parent
74d3301b08
commit
53ab06898b
3 changed files with 9 additions and 3 deletions
|
@ -48,6 +48,10 @@ export class File {
|
|||
return this.ext === '.ts' || this.ext === '.tsx';
|
||||
}
|
||||
|
||||
public isTypescriptAmbient() {
|
||||
return this.path.endsWith('.d.ts');
|
||||
}
|
||||
|
||||
public isSass() {
|
||||
return this.ext === '.sass' || this.ext === '.scss';
|
||||
}
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { relative } from 'path';
|
||||
import { relative, resolve } from 'path';
|
||||
|
||||
import { REPO_ROOT } from '../constants';
|
||||
import { File } from '../file';
|
||||
import { PROJECTS } from './projects';
|
||||
|
||||
/**
|
||||
|
@ -33,6 +34,7 @@ import { PROJECTS } from './projects';
|
|||
*/
|
||||
export function getTsProjectForAbsolutePath(path: string) {
|
||||
const relPath = relative(REPO_ROOT, path);
|
||||
const file = new File(resolve(REPO_ROOT, path));
|
||||
const projects = PROJECTS.filter(p => p.isAbsolutePathSelected(path));
|
||||
|
||||
if (!projects.length) {
|
||||
|
@ -41,7 +43,7 @@ export function getTsProjectForAbsolutePath(path: string) {
|
|||
);
|
||||
}
|
||||
|
||||
if (projects.length !== 1) {
|
||||
if (projects.length !== 1 && !file.isTypescriptAmbient()) {
|
||||
const configPaths = projects.map(p => `"${relative(REPO_ROOT, p.tsConfigPath)}"`);
|
||||
|
||||
const pathsMsg = `${configPaths.slice(0, -1).join(', ')} or ${
|
||||
|
|
|
@ -55,7 +55,7 @@ export async function runCheckTsProjectsCli() {
|
|||
if (projects.length === 0) {
|
||||
isNotInTsProject.push(file);
|
||||
}
|
||||
if (projects.length > 1) {
|
||||
if (projects.length > 1 && !file.isTypescriptAmbient()) {
|
||||
isInMultipleTsProjects.push(file);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue