mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
Revert "[packages] prevent and remove basename collisions for js/ts code"
This reverts commit bba406b9b0
.
This commit is contained in:
parent
6bdc5bfd54
commit
8e12174d32
5 changed files with 18 additions and 47 deletions
|
@ -9,6 +9,5 @@
|
|||
import type { PackageRule } from '@kbn/repo-linter';
|
||||
|
||||
import { matchingPackageNameRule } from './matching_package_name';
|
||||
import { noBasenameCollisionsRule } from './no_basename_collisions';
|
||||
|
||||
export const RULES: PackageRule[] = [matchingPackageNameRule, noBasenameCollisionsRule];
|
||||
export const RULES: PackageRule[] = [matchingPackageNameRule];
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import Path from 'path';
|
||||
|
||||
import { PackageRule } from '@kbn/repo-linter';
|
||||
import { SetMap } from '@kbn/set-map';
|
||||
|
||||
export const noBasenameCollisionsRule = PackageRule.create('noBasenameCollisions', {
|
||||
async check() {
|
||||
const groupedByBasename = new SetMap<string, string>();
|
||||
|
||||
for (const file of this.getAllFiles()) {
|
||||
if (!file.isJsTsCode()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const repoRelWithoutExt = Path.resolve(
|
||||
file.repoRelDir,
|
||||
Path.basename(file.repoRel, file.ext)
|
||||
);
|
||||
|
||||
groupedByBasename.add(repoRelWithoutExt, file.repoRel);
|
||||
}
|
||||
|
||||
for (const [, paths] of groupedByBasename) {
|
||||
if (paths.size > 1) {
|
||||
const list = Array.from(paths, (p) => `\n - ${p}`).join('');
|
||||
this.err(
|
||||
`Having two JS/TS files with the same name but different extensions is not allowed:${list}`
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
|
@ -36,7 +36,7 @@ export class RepoPath {
|
|||
|
||||
private _basename: string | undefined;
|
||||
/**
|
||||
* basename of the path (including extension)
|
||||
* basename of the path
|
||||
* (lazy and cached getter)
|
||||
*/
|
||||
public get basename() {
|
||||
|
@ -64,10 +64,6 @@ export class RepoPath {
|
|||
return this.ext === '.js' || this.ext === '.jsx' || this.ext === '.mjs';
|
||||
}
|
||||
|
||||
isJsTsCode() {
|
||||
return this.isTypeScript() || this.isJavaScript();
|
||||
}
|
||||
|
||||
isFixture() {
|
||||
const parts = this.repoRel.split('/');
|
||||
if (parts.includes('__fixtures__') || this.repoRel.endsWith('.test-d.ts')) {
|
||||
|
|
8
x-pack/plugins/ml/server/models/filter/index.js
Normal file
8
x-pack/plugins/ml/server/models/filter/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { FilterManager } from './filter_manager';
|
8
x-pack/plugins/watcher/common/lib/get_moment/index.js
Normal file
8
x-pack/plugins/watcher/common/lib/get_moment/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { getMoment } from './get_moment';
|
Loading…
Add table
Add a link
Reference in a new issue