From 474115a9217baf16f8fd7bcfee47a47c6630d117 Mon Sep 17 00:00:00 2001 From: Daniel Jonathan <9982123+daniel-jonathan@users.noreply.github.com> Date: Wed, 13 Nov 2024 20:14:00 -0500 Subject: [PATCH] updated eslint --- .eslintrc.yml | 198 +++++++++++++++++---------------- src/behavioral/RequestChain.ts | 59 +++++----- vite.config.test.ts | 69 ------------ 3 files changed, 129 insertions(+), 197 deletions(-) delete mode 100644 vite.config.test.ts diff --git a/.eslintrc.yml b/.eslintrc.yml index 7eaff38..55ab7a8 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -2,38 +2,42 @@ root: true env: node: true browser: true - es6: true -parser: '@typescript-eslint/parser' + es2021: true +parser: 'vue-eslint-parser' +parserOptions: + parser: '@typescript-eslint/parser' + ecmaVersion: 2021 + sourceType: module plugins: - '@typescript-eslint' + - 'import' + - 'vue' extends: - eslint:recommended - - plugin:@typescript-eslint/eslint-recommended + - plugin:vue/vue3-recommended - plugin:@typescript-eslint/recommended - - plugin:yml/standard + - plugin:import/errors + - plugin:import/warnings + - plugin:import/typescript overrides: - files: - - '**/*.js' + - '**/*.js' + - '**/*.ts' rules: - '@typescript-eslint/no-inferrable-types': - - 0 - '@typescript-eslint/explicit-function-return-type': - - 0 + '@typescript-eslint/no-inferrable-types': off + '@typescript-eslint/explicit-function-return-type': off rules: - '@typescript-eslint/no-empty-interface': - - error - '@typescript-eslint/no-inferrable-types': - - error - '@typescript-eslint/explicit-function-return-type': - - error - eqeqeq: - - error - camelcase: - - error - no-console: - - error - no-lonely-if: - - error + '@typescript-eslint/no-empty-interface': error + '@typescript-eslint/no-explicit-any': warn + '@typescript-eslint/explicit-module-boundary-types': error + '@typescript-eslint/no-unused-vars': + - error + - argsIgnorePattern: '^_' + varsIgnorePattern: '^_' + eqeqeq: error + camelcase: error + no-console: error + no-lonely-if: error comma-dangle: - error - arrays: never @@ -45,8 +49,7 @@ rules: - error - 4 - SwitchCase: 1 - no-tabs: - - error + no-tabs: error object-curly-spacing: - error - always @@ -56,17 +59,16 @@ rules: curly: - error - all - template-curly-spacing: - - error - no-trailing-spaces: - - error - no-spaced-func: - - error - space-before-blocks: - - error + template-curly-spacing: error + no-trailing-spaces: error + space-before-blocks: error semi: - error - never + quotes: + - error + - single + - avoidEscape: true object-curly-newline: - error - multiline: true @@ -74,75 +76,75 @@ rules: consistent: true object-property-newline: - error - object-shorthand: - - error + - allowAllPropertiesOnSameLine: true + object-shorthand: error no-param-reassign: - error - props: false - no-extra-parens: - - error - no-return-await: - - error - no-self-compare: - - error - no-template-curly-in-string: - - error - no-throw-literal: - - error - no-undef-init: - - error - no-unmodified-loop-condition: - - error - no-unneeded-ternary: - - error - no-unreachable-loop: - - error - no-unsafe-optional-chaining: - - error - no-unused-expressions: - - error + no-extra-parens: error + no-return-await: error + no-self-compare: error + no-template-curly-in-string: error + no-throw-literal: error + no-undef-init: error + no-unmodified-loop-condition: error + no-unneeded-ternary: error + no-unreachable-loop: error + no-unsafe-optional-chaining: error + no-unused-expressions: error no-use-before-define: - error - functions: false - no-useless-backreference: - - error - no-useless-call: - - error - no-useless-computed-key: - - error - no-useless-concat: - - error - no-useless-constructor: - - error - no-useless-rename: - - error - no-useless-return: - - error - no-var: - - error - nonblock-statement-body-position: - - error - one-var-declaration-per-line: - - error - prefer-arrow-callback: - - error - prefer-const: - - error - prefer-exponentiation-operator: - - error - prefer-numeric-literals: - - error - prefer-object-spread: - - error - prefer-promise-reject-errors: - - error - prefer-template: - - error - prefer-rest-params: - - error - rest-spread-spacing: - - error - require-atomic-updates: - - error - require-await: + classes: true + variables: true + no-useless-backreference: error + no-useless-call: error + no-useless-computed-key: error + no-useless-concat: error + no-useless-constructor: error + no-useless-rename: error + no-useless-return: error + no-var: error + nonblock-statement-body-position: error + one-var-declaration-per-line: error + prefer-arrow-callback: error + prefer-const: error + prefer-exponentiation-operator: error + prefer-numeric-literals: error + prefer-object-spread: error + prefer-promise-reject-errors: error + prefer-template: error + prefer-rest-params: error + rest-spread-spacing: error + require-atomic-updates: error + require-await: error + import/order: + - error + - groups: + - builtin + - external + - internal + - parent + - sibling + - index + newlines-between: always + 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/RequestChain.ts b/src/behavioral/RequestChain.ts index b48f598..8c16693 100644 --- a/src/behavioral/RequestChain.ts +++ b/src/behavioral/RequestChain.ts @@ -35,7 +35,7 @@ */ import { - Optional, + Optional, } from '@cosmicmind/foundationjs' export type Chainable = { @@ -64,37 +64,37 @@ export type Chainable = { } export abstract class RequestChain implements Chainable { - protected _next: Optional> + protected _next: Optional> - /** + /** * Retrieves the next item in the chain. * * @returns {Optional>} The next item in the chain, or undefined if there isn't a next item. */ - get next(): Optional> { - return this._next - } + get next(): Optional> { + return this._next + } - /** + /** * Appends a chainable object to the current object. * * @param {Chainable} chainable - The chainable object to append. * @return {void} - This method does not return anything. */ - append(chainable: Chainable): void { - this._next = chainable - } + append(chainable: Chainable): void { + this._next = chainable + } - /** + /** * Clears the next reference of the object. * * @returns {void} */ - clear(): void { - this._next = undefined - } + clear(): void { + this._next = undefined + } - /** + /** * Executes the processor if the given arguments are executable, * otherwise passes the arguments to the next execute method in the chain. * @@ -104,14 +104,13 @@ export abstract class RequestChain implements Chainable { * * @returns {void} */ - execute(...args: T[]): void { - if (this.isProcessable(...args)) { - this.processor(...args) - } - else { - this.next?.execute(...args) + execute(...args: T[]): void { + if (this.isProcessable(...args)) { + this.processor(...args) + } else { + this.next?.execute(...args) + } } - } /** * Determines if the given arguments are processable. @@ -137,15 +136,15 @@ export abstract class RequestChain implements Chainable { * @returns {Optional>} - The generated request chain. */ export function generateRequestChain(...chainables: RequestChain[]): Optional> { - if (1 < chainables.length) { - let chain = chainables[0] + if (1 < chainables.length) { + let chain = chainables[0] - for (let i = 1, l = chainables.length; i < l; ++i) { - const item = chainables[i] - chain.append(item) - chain = item + for (let i = 1, l = chainables.length; i < l; ++i) { + const item = chainables[i] + chain.append(item) + chain = item + } } - } - return chainables[0] + return chainables[0] } \ No newline at end of file diff --git a/vite.config.test.ts b/vite.config.test.ts deleted file mode 100644 index 0a9fcdb..0000000 --- a/vite.config.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * BSD 3-Clause License - * - * Copyright © 2024, Daniel Jonathan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/// - -import { - URL, - fileURLToPath, -} from 'node:url' - -import { - defineConfig, -} from 'vite' - -const srcDir = 'src' -const distDir = 'dist' -const testsDir = '__tests__' -const benchmarksDir = '__benchmarks__' - -const alias = { - '@': fileURLToPath(new URL(srcDir, import.meta.url)), -} - -export default defineConfig({ - resolve: { - alias, - }, - test: { - include: [ `${testsDir}/**/*.spec.ts` ], - benchmark: { - include: [ `${benchmarksDir}/**/*.bench.ts` ], - outputFile: `${distDir}/benchmarks.json`, - }, - coverage: { - provider: 'v8', - include: [ `**/${srcDir}/**` ], - extension: [ '.ts' ], - }, - }, -})