Skip to content

Conversation

@aegilops
Copy link
Contributor

This commit refactors the event filtering logic in the eventFilter function and introduces a new FilterConfig interface to define the structure of the filter configuration. The eventFilter function creation checks if the filter_config is undefined and always returns true if it is.

It also removes some namespace imports and changes uses of String to string.

This commit refactors the event filtering logic in the `eventFilter` function and introduces a new `FilterConfig` interface to define the structure of the filter configuration. The `eventFilter` function creation checks if the `filter_config` is undefined and always returns true if it is.

It also removes some namespace imports and changes uses of `String` to `string`.
}

export const eventFilter = (event: EmitterWebhookEvent): boolean => {
export const eventFilter = !validateFilterConfig(filter_config) ? (_: EmitterWebhookEvent) => true : (event: EmitterWebhookEvent): boolean => {

Check failure

Code scanning / ESLint

Disallow unused variables

'_' is defined but never used.
}

if (filter_config.include === undefined && filter_config.exclude === undefined) {
console.error("Filter config has neither an include nor an exclude property");

Check failure

Code scanning / ESLint

disallow the use of `console`

Unexpected console statement.
if (applyFilter(payload, exclude_filter, false)) return false;
function validateFilterConfig(config: FilterConfig | undefined): boolean {
if (config === undefined) {
console.error("Filter config is undefined");

Check failure

Code scanning / ESLint

disallow the use of `console`

Unexpected console statement.
@aegilops aegilops merged commit f31633d into main Jan 15, 2024
@aegilops aegilops deleted the lint branch January 15, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants