UNPKG

635 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6var schema = exports.schema = [{
7 type: 'string'
8}];
9
10exports.default = function (context) {
11 var pattern = new RegExp(context.options[0] || '^([A-Z][a-z0-9]*)+Type$');
12
13 return {
14 TypeAlias: function TypeAlias(typeAliasNode) {
15 var typeIdentifierName = typeAliasNode.id.name;
16
17 if (!pattern.test(typeIdentifierName)) {
18 context.report(typeAliasNode, 'Type identifier \'{{name}}\' does not match pattern \'{{pattern}}\'.', {
19 name: typeIdentifierName,
20 pattern: pattern.toString()
21 });
22 }
23 }
24 };
25};
\No newline at end of file