Skip to content

Commit

Permalink
fix: update cli and fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ni55aN committed Aug 30, 2024
1 parent dd91892 commit 0e0020a
Show file tree
Hide file tree
Showing 10 changed files with 2,106 additions and 1,650 deletions.
6 changes: 0 additions & 6 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 @@ -3,3 +3,6 @@ node_modules
.vscode/
dist
docs
/coverage
.rete-cli
.sonar
14 changes: 14 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import tseslint from 'typescript-eslint';
import configs from 'rete-cli/configs/eslint.mjs';
import gloals from 'globals'

export default tseslint.config(
...configs,
{
languageOptions: {
globals: {
...gloals.browser
}
}
}
)
3,701 changes: 2,073 additions & 1,628 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
"rete-area-plugin": "^2.0.0"
},
"devDependencies": {
"globals": "^15.9.0",
"rete": "^2.0.1",
"rete-area-plugin": "^2.0.0",
"rete-cli": "^1.0.2",
"rete-cli": "~2.0.0",
"typescript": "~4.8.4"
},
"dependencies": {
Expand Down
5 changes: 2 additions & 3 deletions src/extensions/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ export function keyboard<Schemes extends BaseSchemes, A extends Action>(plugin:
document.addEventListener('keydown', e => {
if (!e.ctrlKey && !e.metaKey) return

/* eslint-disable indent */
switch (e.code) {
case 'KeyZ':
plugin.undo()
void plugin.undo()
break
case 'KeyY':
plugin.redo()
void plugin.redo()
break
default:
}
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export class HistoryPlugin<Schemes extends BaseSchemes, A extends Action = Actio
this.area = this.parentScope<BaseAreaPlugin<Schemes, BaseArea<Schemes>>>(BaseAreaPlugin)
this.editor = this.area.parentScope<NodeEditor<Schemes>>(NodeEditor)

this.presets.forEach(preset => preset.connect(this))
this.presets.forEach(preset => {
preset.connect(this)
})

this.editor.addPipe(context => {
if (context.type === 'cleared') {
Expand Down
2 changes: 1 addition & 1 deletion src/presets/classic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function trackConnections<S extends BaseSchemes>(history: HistoryPlugin<S, Conne
export function setup<S extends BaseSchemes>(props?: { timing?: number }): Preset<S, HistoryActions<S>> {
return {
connect(history) {
const timing = props?.timing ?? (history.timing * 2)
const timing = props?.timing ?? history.timing * 2

trackNodes(history, { timing })
trackConnections(history)
Expand Down
14 changes: 7 additions & 7 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Base interface for all actions
* @example export class CustomAction<S extends BaseSchemes> implements HistoryAction {
async undo() {
// undo logic
}
async redo() {
// redo logic
}
}
*async undo() {
* // undo logic
*}
*async redo() {
* // redo logic
*}
*}
*/
export interface Action {
undo(): void | Promise<void>
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 0e0020a

Please sign in to comment.