Skip to content

Commit 736972a

Browse files
fixed broken tests
1 parent 80ffa51 commit 736972a

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

.eslintrc.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@ env:
33
node: true
44
browser: true
55
es2021: true
6-
parser: 'vue-eslint-parser'
76
parserOptions:
87
parser: '@typescript-eslint/parser'
98
ecmaVersion: 2021
109
sourceType: module
1110
plugins:
1211
- '@typescript-eslint'
13-
- 'import'
14-
- 'vue'
1512
extends:
1613
- eslint:recommended
17-
- plugin:vue/vue3-recommended
1814
- plugin:@typescript-eslint/recommended
1915
- plugin:import/errors
2016
- plugin:import/warnings
@@ -131,20 +127,6 @@ rules:
131127
alphabetize:
132128
order: asc
133129
caseInsensitive: true
134-
vue/html-indent:
135-
- error
136-
- 4
137-
vue/max-attributes-per-line:
138-
- error
139-
- singleline: 3
140-
multiline: 1
141-
vue/require-default-prop: off
142-
vue/html-self-closing:
143-
- error
144-
- html:
145-
void: never
146-
normal: always
147-
component: always
148130
settings:
149131
import/resolver:
150132
typescript: {}

src/behavioral/Plugin.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,30 @@ export class PluginManager<T> {
7575
this.plugins = []
7676
}
7777

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

8282
if (-1 === i) {
8383
this.plugins.push(plugin)
84+
return true
8485
}
8586
}
87+
88+
return false
8689
}
8790

88-
deregister(...plugins: Plugin<T>[]): void {
91+
deregister(...plugins: Plugin<T>[] | string[]): boolean {
8992
for (const plugin of plugins) {
9093
const i = this.indexOf(plugin)
9194

9295
if (-1 < i) {
9396
this.plugins.splice(i, 1)
97+
return true
9498
}
9599
}
100+
101+
return false
96102
}
97103

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

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

0 commit comments

Comments
 (0)