Skip to content

Commit

Permalink
updated eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-jonathan committed Nov 14, 2024
1 parent 9128b73 commit 474115a
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 197 deletions.
198 changes: 100 additions & 98 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,8 +49,7 @@ rules:
- error
- 4
- SwitchCase: 1
no-tabs:
- error
no-tabs: error
object-curly-spacing:
- error
- always
Expand All @@ -56,93 +59,92 @@ 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
minProperties: 2
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: {}
59 changes: 29 additions & 30 deletions src/behavioral/RequestChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/

import {
Optional,
Optional,
} from '@cosmicmind/foundationjs'

export type Chainable<T> = {
Expand Down Expand Up @@ -64,37 +64,37 @@ export type Chainable<T> = {
}

export abstract class RequestChain<T> implements Chainable<T> {
protected _next: Optional<Chainable<T>>
protected _next: Optional<Chainable<T>>

/**
/**
* Retrieves the next item in the chain.
*
* @returns {Optional<Chainable<T>>} The next item in the chain, or undefined if there isn't a next item.
*/
get next(): Optional<Chainable<T>> {
return this._next
}
get next(): Optional<Chainable<T>> {
return this._next
}

/**
/**
* Appends a chainable object to the current object.
*
* @param {Chainable<T>} chainable - The chainable object to append.
* @return {void} - This method does not return anything.
*/
append(chainable: Chainable<T>): void {
this._next = chainable
}
append(chainable: Chainable<T>): 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.
*
Expand All @@ -104,14 +104,13 @@ export abstract class RequestChain<T> implements Chainable<T> {
*
* @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.
Expand All @@ -137,15 +136,15 @@ export abstract class RequestChain<T> implements Chainable<T> {
* @returns {Optional<RequestChain<T>>} - The generated request chain.
*/
export function generateRequestChain<T>(...chainables: RequestChain<T>[]): Optional<RequestChain<T>> {
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]
}
Loading

0 comments on commit 474115a

Please sign in to comment.