Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint: fix runtime-import-check plugin #11212

Merged
merged 2 commits into from
May 27, 2022
Merged
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 @@ -108,9 +108,7 @@ module.exports = {
};
function checkModuleImport(node) {
const module = /** @type {string} */(node.value);
if (matchedImportRule.restricted.some(
restricted => restricted.includes(`/${restricted}/`) || restricted.endsWith(`/${restricted}`)
)) {
if (matchedImportRule.restricted.some(restricted => module.includes(`/${restricted}/`) || module.endsWith(`/${restricted}`))) {
context.report({
node,
message: `'${module}' cannot be imported in '${matchedFolder}', only '${matchedImportRule.allowed.join(', ')}' ${matchedImportRule.allowed.length === 1 ? 'is' : 'are'} allowed.`
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/src/common/debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { Disposable } from '@theia/core';
import { ApplicationError } from '@theia/core/lib/common/application-error';
import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
import { CommandIdVariables } from '@theia/variable-resolver/lib/browser';
import { CommandIdVariables } from '@theia/variable-resolver/lib/common/variable-types';
import { DebugConfiguration } from './debug-configuration';

export interface DebuggerDescription {
Expand Down
3 changes: 1 addition & 2 deletions packages/debug/src/node/debug-service-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
import { injectable, inject } from '@theia/core/shared/inversify';
import { DebugConfiguration } from '../common/debug-configuration';
import { DebugService, DebuggerDescription } from '../common/debug-service';

import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
import { CommandIdVariables } from '@theia/variable-resolver/lib/browser';
import { CommandIdVariables } from '@theia/variable-resolver/lib/common/variable-types';
import { DebugAdapterSessionManager } from './debug-adapter-session-manager';
import { DebugAdapterContributionRegistry } from './debug-adapter-contribution-registry';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { PluginDebugConfigurationProvider } from './plugin-debug-configuration-p
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
import { WebSocketConnectionProvider } from '@theia/core/lib/browser/messaging/ws-connection-provider';
import { WorkspaceService } from '@theia/workspace/lib/browser';
import { CommandIdVariables } from '@theia/variable-resolver/lib/browser';
import { CommandIdVariables } from '@theia/variable-resolver/lib/common/variable-types';
import { DebugConfigurationProviderTriggerKind } from '../../../common/plugin-api-rpc';
import { DebuggerContribution } from '../../../common/plugin-protocol';
import { DebugRequestTypes } from '@theia/debug/lib/browser/debug-session-connection';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ import { injectable, inject } from '@theia/core/shared/inversify';
import { VariableRegistry } from './variable';
import URI from '@theia/core/lib/common/uri';
import { JSONExt, ReadonlyJSONValue } from '@theia/core/shared/@phosphor/coreutils';

/**
* Holds variable-names to command id mappings (e.g. Provided by specific plugins / extensions)
* see "variables": https://code.visualstudio.com/api/references/contribution-points#contributes.debuggers
*/
export interface CommandIdVariables {
[id: string]: string
}
import { CommandIdVariables } from '../common/variable-types';

export interface VariableResolveOptions {
context?: URI;
Expand Down
2 changes: 1 addition & 1 deletion packages/variable-resolver/src/browser/variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { injectable } from '@theia/core/shared/inversify';
import { Disposable, DisposableCollection, MaybePromise } from '@theia/core';
import URI from '@theia/core/lib/common/uri';
import { CommandIdVariables } from './variable-resolver-service';
import { CommandIdVariables } from '../common/variable-types';

/**
* Variable can be used inside of strings using ${variableName} syntax.
Expand Down
23 changes: 23 additions & 0 deletions packages/variable-resolver/src/common/variable-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// *****************************************************************************
// Copyright (C) 2022 Ericsson and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
// with the GNU Classpath Exception which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
// *****************************************************************************

/**
* Holds variable-names to command id mappings (e.g. Provided by specific plugins / extensions)
* see "variables": https://code.visualstudio.com/api/references/contribution-points#contributes.debuggers
*/
export interface CommandIdVariables {
[id: string]: string
}