* line restricted zones for export exressions * more robust rule * fix or mute eslint errors Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
31850b88b5
commit
36ab9d32ba
|
@ -196,6 +196,28 @@ ruleTester.run('@kbn/eslint/no-restricted-paths', rule, {
|
|||
],
|
||||
|
||||
invalid: [
|
||||
{
|
||||
code: 'export { b } from "../server/b.js"',
|
||||
filename: path.join(__dirname, './files/no_restricted_paths/client/a.js'),
|
||||
options: [
|
||||
{
|
||||
basePath: __dirname,
|
||||
zones: [
|
||||
{
|
||||
target: 'files/no_restricted_paths/client/**/*',
|
||||
from: 'files/no_restricted_paths/server/**/*',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
errors: [
|
||||
{
|
||||
message: 'Unexpected path "../server/b.js" imported in restricted zone.',
|
||||
line: 1,
|
||||
column: 19,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'import b from "../server/b.js"',
|
||||
filename: path.join(__dirname, './files/no_restricted_paths/client/a.js'),
|
||||
|
|
|
@ -126,6 +126,10 @@ module.exports = {
|
|||
}
|
||||
|
||||
return {
|
||||
ExportNamedDeclaration(node) {
|
||||
if (!node.source) return;
|
||||
checkForRestrictedImportPath(node.source.value, node.source);
|
||||
},
|
||||
ImportDeclaration(node) {
|
||||
checkForRestrictedImportPath(node.source.value, node.source);
|
||||
},
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
export {
|
||||
ProcessedImportResponse,
|
||||
processImportResponse,
|
||||
} from '../../../../plugins/saved_objects_management/public/lib';
|
||||
} from '../../../../plugins/saved_objects_management/public/lib'; // eslint-disable-line @kbn/eslint/no-restricted-paths
|
||||
|
|
2
src/legacy/ui/public/private/index.d.ts
vendored
2
src/legacy/ui/public/private/index.d.ts
vendored
|
@ -17,4 +17,4 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
export { IPrivate } from '../../../../plugins/kibana_legacy/public/utils/private';
|
||||
export { IPrivate } from '../../../../plugins/kibana_legacy/public/';
|
||||
|
|
|
@ -19,4 +19,5 @@
|
|||
|
||||
export { KbnUrlProvider } from './url';
|
||||
export { RedirectWhenMissingProvider } from './redirect_when_missing';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { modifyUrl } from '../../../../core/utils';
|
||||
|
|
|
@ -17,4 +17,5 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { buildPipeline } from '../../../../../../plugins/visualizations/public/legacy/build_pipeline';
|
||||
|
|
|
@ -33,6 +33,7 @@ export { DashboardConstants, createDashboardEditUrl } from './dashboard_constant
|
|||
|
||||
export { DashboardStart, DashboardUrlGenerator } from './plugin';
|
||||
export { DASHBOARD_APP_URL_GENERATOR } from './url_generator';
|
||||
export { addEmbeddableToDashboardUrl } from './url_utils/url_helper';
|
||||
|
||||
export function plugin(initializerContext: PluginInitializerContext) {
|
||||
return new DashboardPlugin(initializerContext);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export { OptInExampleFlyout } from './components';
|
||||
import { TelemetryManagementSectionPlugin } from './plugin';
|
||||
|
||||
export function plugin() {
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
|
||||
export { useVisualizeAppState } from './visualize_app_state';
|
||||
export { makeStateful } from './make_stateful';
|
||||
export { addEmbeddableToDashboardUrl } from '../../../../../dashboard/public/url_utils/url_helper';
|
||||
export { addEmbeddableToDashboardUrl } from '../../../../../dashboard/public/';
|
||||
|
|
|
@ -26,9 +26,9 @@ export const plugin = () => {
|
|||
return new MapsPlugin();
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export {
|
||||
RenderTooltipContentParams,
|
||||
ITooltipProperty,
|
||||
} from '../../../../plugins/maps/public/classes/tooltips/tooltip_property';
|
||||
} from '../../../../plugins/maps/public/classes/tooltips/tooltip_property'; // eslint-disable-line @kbn/eslint/no-restricted-paths
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { MapEmbeddable, MapEmbeddableInput } from '../../../../plugins/maps/public/embeddable';
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { LicenseStatus } from '../../../../../plugins/license_management/public/application/sections/license_dashboard/license_status/license_status';
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { AddLicense } from '../../../../../plugins/license_management/public/application/sections/license_dashboard/add_license/add_license';
|
||||
|
||||
/*
|
||||
|
|
|
@ -11,6 +11,7 @@ import { UserRT } from '../user';
|
|||
import { CommentResponseRt } from './comment';
|
||||
import { CasesStatusResponseRt } from './status';
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { ActionTypeExecutorResult } from '../../../../actions/server/types';
|
||||
|
||||
const StatusRt = rt.union([rt.literal('open'), rt.literal('closed')]);
|
||||
|
|
|
@ -10,7 +10,7 @@ export {
|
|||
UseRequestConfig,
|
||||
sendRequest,
|
||||
useRequest,
|
||||
} from '../../../../src/plugins/es_ui_shared/public/request/np_ready_request';
|
||||
} from '../../../../src/plugins/es_ui_shared/public/';
|
||||
|
||||
export {
|
||||
FormSchema,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
export { getFlattenedObject } from '../../../../../../../src/core/utils';
|
||||
export { getFlattenedObject } from '../../../../../../../src/core/public';
|
||||
|
||||
export {
|
||||
agentConfigRouteService,
|
||||
|
|
|
@ -12,7 +12,7 @@ export {
|
|||
UseRequestConfig,
|
||||
sendRequest,
|
||||
useRequest,
|
||||
} from '../../../../src/plugins/es_ui_shared/public/request/np_ready_request';
|
||||
} from '../../../../src/plugins/es_ui_shared/public/';
|
||||
|
||||
export {
|
||||
FormSchema,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { TelemetryPluginSetup } from '../../../../../../src/plugins/telemetry/public';
|
||||
|
||||
export { OptInExampleFlyout } from '../../../../../../src/plugins/telemetry_management_section/public/components';
|
||||
export { OptInExampleFlyout } from '../../../../../../src/plugins/telemetry_management_section/public/';
|
||||
export { PRIVACY_STATEMENT_URL } from '../../../../../../src/plugins/telemetry/common/constants';
|
||||
export { TelemetryPluginSetup, shouldShowTelemetryOptIn };
|
||||
|
||||
|
|
|
@ -4,5 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { getPaths, foldLeftRight } from '../../siem/server/utils/build_validation/__mocks__/utils';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { exactCheck } from '../../siem/server/utils/build_validation/exact_check';
|
||||
|
|
|
@ -7,15 +7,26 @@
|
|||
export {
|
||||
transformError,
|
||||
buildSiemResponse,
|
||||
} from '../../siem/server/lib/detection_engine/routes/utils';
|
||||
} from '../../siem/server/lib/detection_engine/routes/utils'; // eslint-disable-line @kbn/eslint/no-restricted-paths
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { deleteTemplate } from '../../siem/server/lib/detection_engine/index/delete_template';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { deletePolicy } from '../../siem/server/lib/detection_engine/index/delete_policy';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { deleteAllIndex } from '../../siem/server/lib/detection_engine/index/delete_all_index';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { setPolicy } from '../../siem/server/lib/detection_engine/index/set_policy';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { setTemplate } from '../../siem/server/lib/detection_engine/index/set_template';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { getTemplateExists } from '../../siem/server/lib/detection_engine/index/get_template_exists';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { getPolicyExists } from '../../siem/server/lib/detection_engine/index/get_policy_exists';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { createBootstrapIndex } from '../../siem/server/lib/detection_engine/index/create_bootstrap_index';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { getIndexExists } from '../../siem/server/lib/detection_engine/index/get_index_exists';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { buildRouteValidation } from '../../siem/server/utils/build_validation/route_validation';
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { validate } from '../../siem/server/lib/detection_engine/routes/rules/validate';
|
||||
|
|
|
@ -8,6 +8,7 @@ import { PluginInitializerContext, CoreStart } from 'kibana/public';
|
|||
import { NavigationPublicPluginStart as NavigationStart } from '../../../../src/plugins/navigation/public';
|
||||
import { DataPublicPluginStart } from '../../../../src/plugins/data/public';
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { MonitoringConfig } from '../server';
|
||||
|
||||
export interface MonitoringPluginDependencies {
|
||||
|
|
1
x-pack/plugins/reporting/common/types.d.ts
vendored
1
x-pack/plugins/reporting/common/types.d.ts
vendored
|
@ -4,4 +4,5 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
export { ConfigType } from '../server/config';
|
||||
|
|
|
@ -9,12 +9,9 @@ export {
|
|||
XJsonMode,
|
||||
collapseLiteralStrings,
|
||||
expandLiteralStrings,
|
||||
} from '../../../../src/plugins/es_ui_shared/public';
|
||||
|
||||
export {
|
||||
UseRequestConfig,
|
||||
useRequest,
|
||||
} from '../../../../src/plugins/es_ui_shared/public/request/np_ready_request';
|
||||
} from '../../../../src/plugins/es_ui_shared/public';
|
||||
|
||||
export {
|
||||
getErrorMessage,
|
||||
|
|
|
@ -10,6 +10,6 @@ export {
|
|||
UseRequestConfig,
|
||||
sendRequest,
|
||||
useRequest,
|
||||
} from '../../../../../src/plugins/es_ui_shared/public/request/np_ready_request';
|
||||
} from '../../../../../src/plugins/es_ui_shared/public/';
|
||||
|
||||
export { useXJsonMode } from '../../../../../src/plugins/es_ui_shared/static/ace_x_json/hooks';
|
||||
|
|
Loading…
Reference in a new issue