Update config files to TS
This commit is contained in:
parent
8dc0b102a0
commit
69949fb8f4
@ -1,6 +1,13 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ['eslint:recommended', 'plugin:svelte/recommended', 'prettier'],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:svelte/recommended',
|
||||
'prettier'
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint'],
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2020,
|
||||
@ -11,7 +18,14 @@ module.exports = {
|
||||
es2017: true,
|
||||
node: true
|
||||
},
|
||||
rules: {
|
||||
indent: ['error', 2, { SwitchCase: 2 }]
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.svelte'],
|
||||
parser: 'svelte-eslint-parser',
|
||||
parserOptions: {
|
||||
parser: '@typescript-eslint/parser'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
||||
"format": "prettier --plugin-search-dir . --write ."
|
||||
},
|
||||
|
@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import Reason from '$lib/raw-fetchers/reason.svelte';
|
||||
import { tocs as tocMap } from '$lib/stores/tocMap';
|
||||
|
||||
export let services;
|
||||
export let click;
|
||||
@ -196,7 +197,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableTxt" colspan="8">
|
||||
{service.operator}
|
||||
{tocMap.get(service.operatorCode.toLowerCase()) || service.operatorCode}
|
||||
{#if service.isCharter}charter{/if}
|
||||
{#if serviceData.length} | {serviceData.length} carriages{/if}
|
||||
{#if service.delayReason}
|
||||
|
@ -1,53 +1,44 @@
|
||||
const tocMap = {
|
||||
gw: 'Great Western Railway',
|
||||
sw: 'South Western Railway',
|
||||
id: 'Island Line',
|
||||
nt: 'Northern',
|
||||
aw: 'Transport for Wales',
|
||||
cc: 'c2c',
|
||||
cs: 'Caledonian Sleeper',
|
||||
ch: 'Chiltern Railways',
|
||||
xc: 'CrossCountry',
|
||||
em: 'East Midlands Railway',
|
||||
es: 'Eurostar',
|
||||
ht: 'Hull Trains',
|
||||
tl: 'Thameslink',
|
||||
gc: 'Grand Central',
|
||||
gx: 'Gatwick Express',
|
||||
hx: 'Heathrow Express',
|
||||
ls: 'Locomotive Services Limited',
|
||||
me: 'Merseyrail',
|
||||
lr: 'Network Rail OTM',
|
||||
xr: 'TfL Elizabeth Line',
|
||||
se: 'SouthEastern',
|
||||
sn: 'Southern',
|
||||
le: 'Greater Anglia',
|
||||
lm: 'West Midlands Railway',
|
||||
sr: 'ScotRail',
|
||||
gn: 'Great Northern',
|
||||
lt: 'TfL London Underground',
|
||||
lo: 'TfL London Overground',
|
||||
sj: 'Sheffield SuperTram',
|
||||
tp: 'TransPennine Express',
|
||||
vt: 'Avanti West Coast',
|
||||
gr: 'LNER',
|
||||
wc: 'West Coast Railway',
|
||||
ty: 'Vintage Trains',
|
||||
ld: 'Lumo',
|
||||
so: 'Rail Adventure',
|
||||
ln: 'Grand Union Trains',
|
||||
zz: 'Freight/Charter Company',
|
||||
wm: 'West Midlands Railway (WMT)',
|
||||
uk: 'Unknown Operator'
|
||||
};
|
||||
|
||||
const tocs = new Map<string, string>([
|
||||
['uk', 'Unknown Operator'],
|
||||
['wm', 'West Midlands Railway (WMT)'],
|
||||
['zz', 'Freight/Charter Operation'],
|
||||
export const tocs = new Map<string, string>([
|
||||
[ 'gw', 'Great Western Railway' ],
|
||||
[ 'sw', 'South Western Railway' ],
|
||||
[ 'id', 'Island Line' ],
|
||||
[ 'nt', 'Northern' ],
|
||||
[ 'aw', 'Transport for Wales' ],
|
||||
[ 'cc', 'c2c' ],
|
||||
[ 'cs', 'Caledonian Sleeper' ],
|
||||
[ 'ch', 'Chiltern Railways' ],
|
||||
[ 'xc', 'CrossCountry' ],
|
||||
[ 'em', 'East Midlands Railway' ],
|
||||
[ 'es', 'Eurostar' ],
|
||||
[ 'ht', 'Hull Trains' ],
|
||||
[ 'tl', 'Thameslink' ],
|
||||
[ 'gc', 'Grand Central' ],
|
||||
[ 'gx', 'Gatwick Express' ],
|
||||
[ 'hx', 'Heathrow Express' ],
|
||||
[ 'ls', 'Locomotive Services Limited' ],
|
||||
[ 'me', 'Merseyrail' ],
|
||||
[ 'lr', 'Network Rail OTM' ],
|
||||
[ 'xr', 'TfL Elizabeth Line' ],
|
||||
[ 'se', 'Southeastern' ],
|
||||
[ 'sn', 'Southern' ],
|
||||
[ 'le', 'Greater Anglia' ],
|
||||
[ 'ga', 'Greater Anglia' ],
|
||||
[ 'lm', 'West Midlands Railway' ],
|
||||
[ 'sr', 'ScotRail' ],
|
||||
[ 'gn', 'Great Northern' ],
|
||||
[ 'lt', 'TfL London Underground' ],
|
||||
[ 'lo', 'TfL London Overground' ],
|
||||
[ 'sj', 'Sheffield SuperTram' ],
|
||||
[ 'tp', 'TransPennine Express' ],
|
||||
[ 'vt', 'Avanti West Coast' ],
|
||||
[ 'gr', 'LNER' ],
|
||||
[ 'wc', 'West Coast Railway' ],
|
||||
[ 'ty', 'Vintage Trains' ],
|
||||
[ 'ld', 'Lumo' ],
|
||||
[ 'so', 'Rail Adventure' ],
|
||||
[ 'ln', 'Grand Union Trains' ],
|
||||
['so', 'Rail Adventure']
|
||||
])
|
||||
|
||||
export default tocMap;
|
||||
export { tocs }
|
||||
[ 'zz', 'Freight/Charter Company' ],
|
||||
[ 'wm', 'West Midlands Railway (WMT)' ],
|
||||
[ 'uk', 'Unknown Operator' ]
|
||||
]
|
||||
)
|
@ -1,13 +1,14 @@
|
||||
<script>
|
||||
import tocMap from "$lib/stores/tocMap";
|
||||
export let toc = ""
|
||||
export let full = false;
|
||||
<script lang="ts">
|
||||
export let toc: string
|
||||
export let full: boolean = false;
|
||||
|
||||
let text = ""
|
||||
import { tocs as map } from "$lib/stores/tocMap";
|
||||
|
||||
let text: string
|
||||
|
||||
$: {
|
||||
if (full) {
|
||||
text = tocMap[toc.toLowerCase()] || toc;
|
||||
text = map.get(toc.toLowerCase()) || toc;
|
||||
} else {
|
||||
text = toc;
|
||||
}
|
||||
@ -23,6 +24,8 @@
|
||||
border-radius: 5px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
.gw { /* GWR */
|
||||
background-color: #07352d;
|
||||
@ -85,7 +88,7 @@
|
||||
background-color: rgb(40, 40, 40);
|
||||
color: rgb(219, 123, 5);
|
||||
}
|
||||
.le { /*Greater Anglia */
|
||||
.le, .ga { /*Greater Anglia */
|
||||
background-color: rgb(122, 124, 154);
|
||||
color: rgb(151, 0, 0);
|
||||
border-color: red;
|
||||
@ -175,4 +178,8 @@
|
||||
background-color: rgb(89, 89, 89);
|
||||
color: white;
|
||||
}
|
||||
.uk {
|
||||
background-color: whitesmoke;
|
||||
color: black;
|
||||
}
|
||||
</style>
|
@ -1,14 +1,17 @@
|
||||
import adapter from '@sveltejs/adapter-static';
|
||||
import adapter from '@sveltejs/adapter-auto';
|
||||
import { vitePreprocess } from '@sveltejs/kit/vite';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
kit: {
|
||||
adapter: adapter({
|
||||
pages: 'build',
|
||||
assets: 'build',
|
||||
fallback: 'index.html',
|
||||
precompress: true,
|
||||
strict: true
|
||||
})
|
||||
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
||||
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||
adapter: adapter()
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -8,9 +8,10 @@
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true
|
||||
"strict": true,
|
||||
"outDir": "./dist"
|
||||
}
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
||||
//
|
||||
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||
|
Loading…
Reference in New Issue
Block a user