Compare commits

..

2 commits

Author SHA1 Message Date
Edward Betts c65e60a1f1 Include ferry distances 2024-05-05 14:57:13 +03:00
Edward Betts ca7c449410 Add eslintrc.js 2024-05-05 14:56:36 +03:00
3 changed files with 25 additions and 2 deletions

17
.eslintrc.js Normal file
View file

@ -0,0 +1,17 @@
module.exports = {
"env": {
"browser": true,
"es6": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 14,
"sourceType": "module"
},
"rules": {
}
};

View file

@ -58,7 +58,9 @@ def load_trains(
return trains return trains
def load_ferries(data_dir: str) -> list[StrDict]: def load_ferries(
data_dir: str, route_distances: travel.RouteDistances | None = None
) -> list[StrDict]:
"""Load ferries.""" """Load ferries."""
ferries = load_travel("ferry", "ferries", data_dir) ferries = load_travel("ferry", "ferries", data_dir)
terminals = travel.parse_yaml("ferry_terminals", data_dir) terminals = travel.parse_yaml("ferry_terminals", data_dir)
@ -70,6 +72,9 @@ def load_ferries(data_dir: str) -> list[StrDict]:
item["from_terminal"] = from_terminal item["from_terminal"] = from_terminal
item["to_terminal"] = to_terminal item["to_terminal"] = to_terminal
if route_distances:
travel.add_leg_route_distance(item, route_distances)
geojson = from_terminal["routes"].get(item["to"]) geojson = from_terminal["routes"].get(item["to"])
if geojson: if geojson:
item["geojson_filename"] = geojson item["geojson_filename"] = geojson
@ -131,7 +136,7 @@ def build_trip_list(
travel_items = sorted( travel_items = sorted(
load_flights(data_dir) load_flights(data_dir)
+ load_trains(data_dir, route_distances=route_distances) + load_trains(data_dir, route_distances=route_distances)
+ load_ferries(data_dir), + load_ferries(data_dir, route_distances=route_distances),
key=depart_datetime, key=depart_datetime,
) )

View file

@ -11,6 +11,7 @@
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"copy-webpack-plugin": "^12.0.2", "copy-webpack-plugin": "^12.0.2",
"eslint": "^9.2.0",
"webpack": "^5.91.0", "webpack": "^5.91.0",
"webpack-cli": "^5.1.4" "webpack-cli": "^5.1.4"
}, },