Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# CI workflow used for code quality checks
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
lint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: 'npm'
- run: npm ci
- run: npm run lint
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ node_modules
pack
out
lib
eslint.config.js
*.railsl
*.vsix
*.jar
Expand Down
12 changes: 12 additions & 0 deletions backend/customWords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
blockly
railblocks
tokessa
hamann
heyden
jucy
freepik
flaticon
railsl
ebnf
editorsprache
setzanweisungen
27 changes: 27 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import js from "@eslint/js";
import globals from "globals";
import { defineConfig } from "eslint/config";
import cspellPlugin from '@cspell/eslint-plugin';

const cspellImport = ['@cspell/dict-de-de'];

export default defineConfig([
{ files: ["**/*.{js,mjs,cjs}"], plugins: { js }, extends: ["js/recommended"], languageOptions: { globals: globals.browser } },
{
plugins: { '@cspell': cspellPlugin },
rules: {
"no-unused-vars": "warn",
"no-undef": "warn",
"eol-last": "error",
'@cspell/spellchecker': ['warn', {
report: 'simple',
cspell: {
language: 'en-GB, en-US, de',
import: cspellImport,
caseSensitive: false,
},
customWordListFile: "./backend/customWords.txt", // add custom words, that spellchecker doesn't know
}],
},
},
]);
2 changes: 1 addition & 1 deletion frontend/dynamic_blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Blockly.Blocks.TrackStatement = {
valueInput.appendField(Blockly.Msg.RAILBLOCKS_TRACK_TEXT_END)

// Now the block looks like this:
// ValueInput["Set track" [Comma seperated dropdown fields] "to: "] -<
// ValueInput["Set track" [Comma separated dropdown fields] "to: "] -<
}
}

Expand Down
5 changes: 4 additions & 1 deletion frontend/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*
* https://github.com/kieler/RailBlocks
*
* Copyright 2025 by
* Copyright 2025-2026 by
* + Tokessa Hamann
* + Henri Heyden and
* + Kiel University
* + Department of Computer Science
Expand Down Expand Up @@ -52,6 +53,7 @@ export class FieldPlusMinus extends Blockly.Field {
* @param margin -- Ignored inherited parameter.
* @private
*/
// eslint-disable-next-line no-unused-vars
updateSize_ (margin) {
this.size_ = new Blockly.utils.Size(10, 20)
}
Expand Down Expand Up @@ -198,5 +200,6 @@ export class FieldPlusMinus extends Blockly.Field {

getText () { return '' }
getValue () {}
// eslint-disable-next-line no-unused-vars
setValue (_0, _1) {}
}
4 changes: 2 additions & 2 deletions frontend/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ generator.forBlock.LoopStatement = (block, gen) => {
}

// This one and the next are value inputs' inputs, which is why they look different.
generator.forBlock.TrackStatementVectorStop = (block, gen) => {
generator.forBlock.TrackStatementVectorStop = () => {
return ['stop.', Order.ATOMIC]
}

generator.forBlock.TrackStatementVectorDir = (block, gen) => {
generator.forBlock.TrackStatementVectorDir = (block) => {
// Very hard to read.
// "full" and "slow" are the two options, the field value is either "ITEM1" or "ITEM2".
const SPEED = ['full', 'slow'][block.getFieldValue('SPEED')[4] - 1]
Expand Down
Loading