mirror of
https://github.com/Microsoft/vscode
synced 2024-11-05 18:29:38 +00:00
27 lines
927 B
TypeScript
27 lines
927 B
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* 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;')
|
|
}
|
|
});
|
|
}
|
|
};
|
|
}
|
|
};
|