mirror of
https://github.com/Microsoft/vscode
synced 2024-09-29 16:01:05 +00:00
eslint: add a new rule to enforce declare _serviceBrand: undefined
(#165396)
This commit is contained in:
parent
bc1088e8a5
commit
98546b2287
27
.eslintplugin/code-declare-service-brand.ts
Normal file
27
.eslintplugin/code-declare-service-brand.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as eslint from 'eslint';
|
||||
|
||||
export = new class DeclareServiceBrand implements eslint.Rule.RuleModule {
|
||||
|
||||
readonly meta: eslint.Rule.RuleMetaData = {
|
||||
fixable: 'code'
|
||||
};
|
||||
|
||||
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
|
||||
return {
|
||||
['PropertyDefinition[key.name="_serviceBrand"][value]']: (node: any) => {
|
||||
return context.report({
|
||||
node,
|
||||
message: `The '_serviceBrand'-property should not have a value`,
|
||||
fix: (fixer) => {
|
||||
return fixer.replaceText(node, 'declare _serviceBrand: undefined;')
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
|
@ -72,6 +72,7 @@
|
|||
"local/code-no-nls-in-standalone-editor": "warn",
|
||||
"local/code-no-standalone-editor": "warn",
|
||||
"local/code-no-unexternalized-strings": "warn",
|
||||
"local/code-declare-service-brand": "warn",
|
||||
"local/code-layering": [
|
||||
"warn",
|
||||
{
|
||||
|
@ -331,7 +332,7 @@
|
|||
"vs/base/parts/*/~",
|
||||
"vs/platform/*/~",
|
||||
"tas-client-umd", // node module allowed even in /common/
|
||||
"@microsoft/1ds-core-js",// node module allowed even in /common/
|
||||
"@microsoft/1ds-core-js", // node module allowed even in /common/
|
||||
"@microsoft/1ds-post-js" // node module allowed even in /common/
|
||||
]
|
||||
},
|
||||
|
|
|
@ -35,7 +35,7 @@ type AuthenticationProviderOption = IQuickPickItem & { provider: IAuthentication
|
|||
const configureContinueOnPreference = { iconClass: Codicon.settingsGear.classNames, tooltip: localize('configure continue on', 'Configure this preference in settings') };
|
||||
export class EditSessionsWorkbenchService extends Disposable implements IEditSessionsStorageService {
|
||||
|
||||
_serviceBrand = undefined;
|
||||
declare _serviceBrand: undefined;
|
||||
|
||||
private serverConfiguration = this.productService['editSessions.store'];
|
||||
private storeClient: EditSessionsStoreClient | undefined;
|
||||
|
|
Loading…
Reference in a new issue