This repository has been archived on 2024-09-09 . You can view files and clone it, but cannot push or open issues or pull requests.
37f98d9b5e
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
"use strict";
|
|||
/*---------------------------------------------------------------------------------------------
|
|||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|||
*--------------------------------------------------------------------------------------------*/
|
|||
var _a;
|
|||
module.exports = new (_a = class ApiInterfaceNaming {
|
|||
constructor() {
|
|||
this.meta = {
|
|||
messages: {
|
|||
naming: 'Interfaces must not be prefixed with uppercase `I`',
|
|||
}
|
|||
};
|
|||
}
|
|||
create(context) {
|
|||
return {
|
|||
['TSInterfaceDeclaration Identifier']: (node) => {
|
|||
const name = node.name;
|
|||
if (ApiInterfaceNaming._nameRegExp.test(name)) {
|
|||
context.report({
|
|||
node,
|
|||
messageId: 'naming'
|
|||
});
|
|||
}
|
|||
}
|
|||
};
|
|||
}
|
|||
},
|
|||
_a._nameRegExp = /I[A-Z]/,
|
|||
_a);
|