Skip to content

Commit 7e592f0

Browse files
committed
fixup linting errors
1 parent 301d059 commit 7e592f0

File tree

2 files changed

+84
-57
lines changed

2 files changed

+84
-57
lines changed

src/index.ts

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ class LogForwardingPlugin {
4040
// schema for the function section of serverless.yml
4141
this.serverless.configSchemaHandler.defineFunctionProperties('aws', {
4242
properties: {
43-
logForwarding: {
43+
logForwarding: {
4444
type: 'object',
4545
properties: {
4646
enabled: {
47-
type: 'boolean'
47+
type: 'boolean',
4848
},
4949
},
50-
required: ['enabled']
50+
required: ['enabled'],
5151
},
5252
},
53-
required: []
53+
required: [],
5454
});
5555

5656
// schema for the custom props section of serverless.yml
@@ -60,17 +60,21 @@ class LogForwardingPlugin {
6060
type: 'object',
6161
properties: {
6262
destinationARN: { type: 'string' },
63-
roleArn: { type: 'string'},
64-
filterPattern: { type: 'string'},
65-
normalizedFilterID: { type: 'string'},
66-
stages: { type: 'array', uniqueItems: true, items: { type: 'string' } },
63+
roleArn: { type: 'string' },
64+
filterPattern: { type: 'string' },
65+
normalizedFilterID: { type: 'string' },
66+
stages: {
67+
type: 'array',
68+
uniqueItems: true,
69+
items: { type: 'string' },
70+
},
6771
createLambdaPermission: { type: 'boolean' },
6872
},
69-
required: [ 'destinationARN'],
70-
}
73+
required: ['destinationARN'],
74+
},
7175
},
72-
required: ['logForwarding']
73-
})
76+
required: ['logForwarding'],
77+
});
7478
}
7579

7680
loadConfig(): void {
@@ -80,7 +84,9 @@ class LogForwardingPlugin {
8084
}
8185
this.config = { ...CONFIG_DEFAULTS, ...service.custom.logForwarding };
8286
if (this.config.destinationARN === undefined) {
83-
throw new Error('Serverless-log-forwarding is not configured correctly. Please see README for proper setup.');
87+
throw new Error(
88+
'Serverless-log-forwarding is not configured correctly. Please see README for proper setup.',
89+
);
8490
}
8591
}
8692

@@ -153,11 +159,16 @@ class LogForwardingPlugin {
153159
return this.serverless.service.provider.stage;
154160
}
155161

156-
makeSubsctiptionFilter(functionName: string, deps?: string[]): SubscriptionFilterCF {
162+
makeSubsctiptionFilter(
163+
functionName: string,
164+
deps?: string[],
165+
): SubscriptionFilterCF {
157166
const functionObject = this.serverless.service.getFunction(functionName);
158167
const logGroupName = this.provider.naming.getLogGroupName(functionObject.name);
159168
const logGroupId = this.provider.naming.getLogGroupLogicalId(functionName);
160-
const roleObject = this.config.roleArn ? { RoleArn: this.config.roleArn } : {};
169+
const roleObject = this.config.roleArn
170+
? { RoleArn: this.config.roleArn }
171+
: {};
161172
return {
162173
Type: 'AWS::Logs::SubscriptionFilter',
163174
Properties: {

src/types.ts

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export interface SlsFunction {
22
name: string;
33
logForwarding?: {
44
enabled?: boolean;
5-
}
5+
};
66
}
77

88
export interface PluginConfig {
@@ -14,75 +14,91 @@ export interface PluginConfig {
1414
destinationARN: string;
1515
}
1616

17-
/**
18-
* If your plugin adds new properties to any level in the serverless.yml
19-
* you can use these functions to add JSON ajv based schema validation for
20-
* those properties
21-
*
22-
* @see https://www.serverless.com/framework/docs/guides/plugins/custom-configuration
23-
*/
17+
/**
18+
* If your plugin adds new properties to any level in the serverless.yml
19+
* you can use these functions to add JSON ajv based schema validation for
20+
* those properties
21+
*
22+
* @see https://www.serverless.com/framework/docs/guides/plugins/custom-configuration
23+
*/
2424
export interface ConfigSchemaHandler {
2525
/**
26-
* If your plugin requires additional top-level properties (like provider, custom, service...), you can use the defineTopLevelProperty helper to add their definition.
26+
* If your plugin requires additional top-level properties (like provider, custom, service...)
27+
* you can use the defineTopLevelProperty helper to add their definition.
2728
* @see https://www.serverless.com/framework/docs/guides/plugins/custom-configuration#top-level-properties-via-definetoplevelproperty
2829
*/
29-
defineTopLevelProperty (providerName: string, schema: Record<string, unknown>): void;
30+
defineTopLevelProperty(
31+
providerName: string,
32+
schema: Record<string, unknown>
33+
): void;
3034
/**
31-
* If your plugin depends on properties defined in the custom: section, you can use the defineCustomProperties helper
35+
* If your plugin depends on properties defined in the custom: section, you can use the
36+
* defineCustomProperties helper
3237
* @see https://www.serverless.com/framework/docs/guides/plugins/custom-configuration#properties-in-custom-via-definecustomproperties
3338
*/
34-
defineCustomProperties (jsonSchema: object): void,
39+
defineCustomProperties(jsonSchema: object): void;
3540
/**
36-
* If your plugin adds support to a new function event, you can use the defineFunctionEvent helper
41+
* If your plugin adds support to a new function event, you can use the
42+
* defineFunctionEvent helper
3743
* @see https://www.serverless.com/framework/docs/guides/plugins/custom-configuration#function-events-via-definefunctionevent
3844
*/
39-
defineFunctionEvent (providerName: string, event: string, jsonSchema: Record<string, object>): void
45+
defineFunctionEvent(
46+
providerName: string,
47+
event: string,
48+
jsonSchema: Record<string, object>
49+
): void;
4050
/**
41-
* If your plugin adds new properties to a function event, you can use the defineFunctionEventProperties helper
51+
* If your plugin adds new properties to a function event, you can use the
52+
* defineFunctionEventProperties helper
4253
* @see https://www.serverless.com/framework/docs/guides/plugins/custom-configuration#function-event-properties-via-definefunctioneventproperties
4354
*/
44-
defineFunctionEventProperties (providerName: string, existingEvent: string, jsonSchema: object): void;
55+
defineFunctionEventProperties(
56+
providerName: string,
57+
existingEvent: string,
58+
jsonSchema: object
59+
): void;
4560
/**
46-
* If your plugin adds new properties to functions, you can use the defineFunctionProperties helper.
61+
* If your plugin adds new properties to functions, you can use the
62+
* defineFunctionProperties helper.
4763
* @see https://www.serverless.com/framework/docs/guides/plugins/custom-configuration#function-properties-via-definefunctionproperties
4864
*/
49-
defineFunctionProperties (providerName: string, schema: object): void;
65+
defineFunctionProperties(providerName: string, schema: object): void;
5066
/**
5167
* If your plugin provides support for a new provider, register it via defineProvider
5268
* @see https://www.serverless.com/framework/docs/guides/plugins/custom-configuration#new-provider-via-defineprovider
5369
*/
54-
defineProvider (providerName: string, options?: Record<string, unknown>): void;
70+
defineProvider(providerName: string, options?: Record<string, unknown>): void;
5571
}
5672

5773
export interface ServerlessInstance {
5874
service: {
59-
service: string
75+
service: string;
6076
resources: {
61-
Resources: ResourcesCF
62-
},
77+
Resources: ResourcesCF;
78+
};
6379
provider: {
64-
stage: string,
65-
region: string
66-
},
80+
stage: string;
81+
region: string;
82+
};
6783
functions: {
6884
name: unknown[];
69-
},
70-
getFunction (name: string): SlsFunction,
85+
};
86+
getFunction(name: string): SlsFunction;
7187
custom: {
72-
logForwarding: PluginConfig
73-
},
74-
},
88+
logForwarding: PluginConfig;
89+
};
90+
};
7591
providers: {
7692
aws: {
77-
getRegion (): string,
78-
},
79-
},
80-
getProvider (name: string): AWSProvider,
81-
configSchemaHandler: ConfigSchemaHandler,
93+
getRegion(): string;
94+
};
95+
};
96+
getProvider(name: string): AWSProvider;
97+
configSchemaHandler: ConfigSchemaHandler;
8298
cli: {
83-
log (str: string, entity?: string): void,
84-
consoleLog (str: string): void,
85-
}
99+
log(str: string, entity?: string): void;
100+
consoleLog(str: string): void;
101+
};
86102
}
87103

88104
export interface ServerlessConfig {
@@ -93,10 +109,10 @@ export interface ServerlessConfig {
93109

94110
export interface AWSProvider {
95111
naming: {
96-
getLogGroupName(name: string): string,
97-
getNormalizedFunctionName(name: string): string,
98-
getLogGroupLogicalId(name: string): string
99-
}
112+
getLogGroupName(name: string): string;
113+
getNormalizedFunctionName(name: string): string;
114+
getLogGroupLogicalId(name: string): string;
115+
};
100116
}
101117

102118
export interface ObjectCF<TProps> {

0 commit comments

Comments
 (0)