diff --git a/.eslintrc.yml b/.eslintrc.yml index 55ab7a8..5aebddf 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -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 @@ -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: {} \ No newline at end of file diff --git a/src/behavioral/Plugin.ts b/src/behavioral/Plugin.ts index 36108c2..bf986ef 100644 --- a/src/behavioral/Plugin.ts +++ b/src/behavioral/Plugin.ts @@ -75,24 +75,30 @@ export class PluginManager { this.plugins = [] } - register(...plugins: Plugin[]): void { + register(...plugins: Plugin[] | 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[]): void { + deregister(...plugins: Plugin[] | string[]): boolean { for (const plugin of plugins) { const i = this.indexOf(plugin) if (-1 < i) { this.plugins.splice(i, 1) + return true } } + + return false } /** @@ -113,9 +119,11 @@ export class PluginManager { * @param {Plugin | 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): number { + protected indexOf(plugin: Plugin | 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) {