Skip to content

Commit

Permalink
fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-jonathan committed Nov 17, 2024
1 parent 80ffa51 commit 736972a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
18 changes: 0 additions & 18 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ env:
node: true
browser: true
es2021: true
parser: 'vue-eslint-parser'
parserOptions:
parser: '@typescript-eslint/parser'
ecmaVersion: 2021
sourceType: module
plugins:
- '@typescript-eslint'
- 'import'
- 'vue'
extends:
- eslint:recommended
- plugin:vue/vue3-recommended
- plugin:@typescript-eslint/recommended
- plugin:import/errors
- plugin:import/warnings
Expand Down Expand Up @@ -131,20 +127,6 @@ rules:
alphabetize:
order: asc
caseInsensitive: true
vue/html-indent:
- error
- 4
vue/max-attributes-per-line:
- error
- singleline: 3
multiline: 1
vue/require-default-prop: off
vue/html-self-closing:
- error
- html:
void: never
normal: always
component: always
settings:
import/resolver:
typescript: {}
16 changes: 12 additions & 4 deletions src/behavioral/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,30 @@ export class PluginManager<T> {
this.plugins = []
}

register(...plugins: Plugin<T>[]): void {
register(...plugins: Plugin<T>[] | string[]): boolean {
for (const plugin of plugins) {
const i = this.indexOf(plugin)

if (-1 === i) {
this.plugins.push(plugin)
return true
}
}

return false
}

deregister(...plugins: Plugin<T>[]): void {
deregister(...plugins: Plugin<T>[] | string[]): boolean {
for (const plugin of plugins) {
const i = this.indexOf(plugin)

if (-1 < i) {
this.plugins.splice(i, 1)
return true
}
}

return false
}

/**
Expand All @@ -113,9 +119,11 @@ export class PluginManager<T> {
* @param {Plugin<T> | string} plugin - The plugin to search for. Can be either a Plugin object or a string representing the plugin name.
* @return {number} - The index of the plugin in the plugins array. Returns -1 if the plugin is not found.
*/
protected indexOf(plugin: Plugin<T>): number {
protected indexOf(plugin: Plugin<T> | string): number {
const plugins = this.plugins
const name = plugin.name
const name = 'string' === typeof plugin
? plugin
: plugin.name

for (let i = plugins.length - 1; i >= 0; --i) {
if (name === plugins[i].name) {
Expand Down

0 comments on commit 736972a

Please sign in to comment.