Skip to content

Commit

Permalink
Merge pull request #9 from retejs/new-linter
Browse files Browse the repository at this point in the history
fix: update cli and fix linting errors
  • Loading branch information
Ni55aN authored Aug 30, 2024
2 parents fda61fb + 0a7ead2 commit 1edabab
Show file tree
Hide file tree
Showing 11 changed files with 2,073 additions and 1,640 deletions.
3 changes: 0 additions & 3 deletions .eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ node_modules
npm-debug.log
dist
docs
/coverage
.rete-cli
.sonar
6 changes: 6 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import tseslint from 'typescript-eslint';
import configs from 'rete-cli/configs/eslint.mjs';

export default tseslint.config(
...configs
)
3,675 changes: 2,049 additions & 1,626 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"devDependencies": {
"rete": "^2.0.1",
"rete-cli": "^1.0.2",
"rete-cli": "~2.0.1",
"typescript": "4.8.4"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/control-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class ControlFlow<Schemes extends ClassicScheme> {

if (input && !inputKeys.includes(input)) throw new Error('inputs don\'t have a key')

Check warning on line 62 in src/control-flow.ts

View workflow job for this annotation

GitHub Actions / release / publish

Unsafe call of an `any` typed value

Check warning on line 62 in src/control-flow.ts

View workflow job for this annotation

GitHub Actions / release / publish

Unsafe call of an `any` typed value

setup.execute(input, (output) => {
setup.execute(input, output => {
const outputKeys = setup.outputs()

if (!outputKeys.includes(output)) throw new Error('outputs don\'t have a key')
Expand Down
8 changes: 5 additions & 3 deletions src/dataflow-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class DataflowEngine<Schemes extends DataflowEngineScheme> extends Scope<
this.getDataflow().add(node, {
inputs: options.inputs,
outputs: options.outputs,
data: async (fetchInputs) => {
data: async fetchInputs => {
const cache = this.cache.get(node.id)

if (cache) return cache
Expand Down Expand Up @@ -91,14 +91,16 @@ export class DataflowEngine<Schemes extends DataflowEngineScheme> extends Scope<
if (nodeId) {
const setup = this.getDataflow().setups.get(nodeId)

if (!setup) throw 'setup'
if (!setup) throw new Error('setup')

const outputKeys = setup.outputs()

this.cache.delete(nodeId)
this.editor.getConnections()
.filter(c => c.source === nodeId && outputKeys.includes(c.sourceOutput))
.forEach(c => this.reset(c.target))
.forEach(c => {
this.reset(c.target)
})
} else {
this.cache.clear()
}
Expand Down
4 changes: 3 additions & 1 deletion src/dataflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export class Dataflow<Schemes extends ClassicScheme> {
}))

for (const { c, sourceData } of consWithSourceData) {
const previous = inputs[c.targetInput] ? inputs[c.targetInput] : []
const previous = inputs[c.targetInput]
? inputs[c.targetInput]
: []

inputs[c.targetInput] = [...previous, sourceData[c.sourceOutput]]
}
Expand Down
4 changes: 3 additions & 1 deletion src/utils/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export class Cache<Key, T> {
const item = this.cache.get(key)

this.cache.delete(key)
this.onDelete && this.onDelete(item)
if (this.onDelete) {
this.onDelete(item)
}
}

clear() {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/cancellable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function createCancellblePromise(...sequence: S<any, any>[]): Cancellable<any> {
res()
})

const n = (sequence as S<any, any>[]).reduce((p, item) => {
const n = sequence.reduce((p, item) => {
const t = p.then(item as any).then(commit)

return t
Expand Down
4 changes: 1 addition & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"compilerOptions": {
"strict": true
},
"extends": "rete-cli/configs/tsconfig.json",
"include": ["src"]
}

0 comments on commit 1edabab

Please sign in to comment.