...
 
......@@ -10,11 +10,15 @@ module.exports = {
'html',
'@tivac/svelte'
],
'extends': [
settings: {
'html/html-extensions': ['.html', '.svelte'],
},
extends: [
'eslint:recommended',
'plugin:@tivac/svelte/svelte',
],
'rules': {
rules: {
'indent': ['error', 4],
'linebreak-style': ['error', 'unix'],
'quotes': ['error', 'single'],
......@@ -22,5 +26,31 @@ module.exports = {
'comma-dangle': ['error', 'always-multiline'],
'no-console': ['off'],
'no-extra-semi': ['off'],
'@tivac/svelte/property-ordering': [
'error', {
order: [
'namespace',
'tag',
'components',
'props',
'events',
'immutable',
'data',
'store',
'computed',
'actions',
'transitions',
'helpers',
'oncreate',
'onstate',
'onupdate',
'ondestroy',
'preload',
'methods',
'setup',
]
}
]
},
};
\ No newline at end of file
......@@ -46,7 +46,7 @@ export default {
},
oncreate() {
const {directions, turnDuration} = this.get();
const {directions} = this.get();
this.set({
active: true,
directionsList: Object.keys(directions),
......@@ -72,7 +72,7 @@ export default {
timeout: setTimeout(
() => this.onRoundLost(this),
this.get().turnDuration
)
),
});
},
......@@ -131,9 +131,9 @@ export default {
} else {
this.onRoundLost();
}
}
}
}
},
},
};
</script>
<style>
......
......@@ -15,7 +15,6 @@
</div>
<script>
/* globals scUtils */
import Battle from './Battle.svelte';
import {inc} from '../inc.js';
......@@ -38,13 +37,13 @@ export default {
msg: '',
msgTimeout: null,
}
};
},
computed: {
health({hp}) {
return '🛡️️'.repeat(hp);
}
},
},
oncreate() {
......@@ -71,7 +70,7 @@ export default {
this.set({
msgTimeout: setTimeout(() => {
this.clearMessage();
}, 1500)
}, 1500),
});
},
......@@ -92,9 +91,9 @@ export default {
onHit() {
this.showMessage(this.get().hitSource());
}
}
}
},
},
};
</script>
<style>
......
......@@ -19,7 +19,7 @@ export default {
'right',
'active',
],
}
};
</script>
<style>
......
......@@ -23,10 +23,10 @@ export default {
computed: {
transform({scale}) {
return `scale(${scale})`
}
}
}
return `scale(${scale})`;
},
},
};
</script>
<style>
......
......@@ -25,8 +25,8 @@ export default {
},
transform({cx, cy, size}) {
return `rotate(-60, ${cx}, ${cy}) translate(${size} 0) scale(-1, 1)`
}
}
}
return `rotate(-60, ${cx}, ${cy}) translate(${size} 0) scale(-1, 1)`;
},
},
};
</script>
\ No newline at end of file
......@@ -3,7 +3,6 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox={viewBox}
width={width}
class:error
on:mousemove="onMouseMove(event)"
>
<defs>
......@@ -44,7 +43,7 @@
on:click="onCenterPieceClicked()"
>{centerPieceText}</CenterPiece>
<g class="constLine">
<g class="constLine" class:error>
{#each addedLines as line}
<line x1={line[0][0]} y1={line[0][1]} x2={line[1][0]} y2={line[1][1]} />
{/each}
......@@ -97,7 +96,7 @@ export default {
tempLine: null,
error: false,
}
};
},
computed: {
......@@ -151,7 +150,7 @@ export default {
const q = addedLines.length / 6;
return 2.5 * q;
}
}
},
},
oncreate() {
......@@ -222,7 +221,7 @@ export default {
event.offsetY * scale,
];
this.set({tempLine})
this.set({tempLine});
}
},
......@@ -257,9 +256,9 @@ export default {
});
setTimeout(() => this.clearAddedLines(), 2000);
}
}
}
},
},
};
</script>
<style>
......@@ -281,7 +280,7 @@ export default {
filter: url(#glow);
}
.error .constLine {
.error.constLine {
stroke: #af7268;
transition: stroke 300ms linear;
}
......
......@@ -29,11 +29,11 @@ export default {
return {
rune,
offset: `${Math.floor(offset * i)}%`, // not sure why, but this looks better
}
})
}
}
}
};
});
},
},
};
</script>
<style>
......
......@@ -14,9 +14,9 @@ export default {
props: [
'cx',
'cy',
'index'
]
}
'index',
],
};
</script>
<style>
......
export function inc(fieldName, inc = 1) {
this.set({
[fieldName]: this.get()[fieldName] + inc,
})
});
}
\ No newline at end of file
......@@ -1844,6 +1844,16 @@
"acorn": "^6.1.1"
}
},
"rollup-plugin-eslint": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-eslint/-/rollup-plugin-eslint-5.1.0.tgz",
"integrity": "sha512-jmjqDC42HQsevgBuGQuDb9xhkei4IRkwufAbd6pe5Cbd969p/CjO3SPIwVeINSxXrzrGh9VG72EKtYVFwybxpQ==",
"dev": true,
"requires": {
"eslint": "^5.1.0",
"rollup-pluginutils": "^2.3.0"
}
},
"rollup-plugin-node-resolve": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.2.2.tgz",
......
......@@ -7,6 +7,7 @@
"scripts": {
"svelte-dev": "rollup -c -w",
"svelte-prod": "rollup -c --environment BUILD:production",
"lint:fix": "eslint . --fix --ext .js,.svelte --ignore-path .gitignore --format unix",
"clean": "rm -rf ./build && mkdir build && mkdir build\\sound",
"precompile": "tweego -d src/index.html > build/index.twee && cp src/*.ttf build && cp src/sound/* build/sound",
"compile": "tweego --head=src/extras.html build/index.twee > build/index.html",
......@@ -35,6 +36,7 @@
"eslint": "^5.16.0",
"eslint-plugin-html": "^5.0.3",
"rollup": "^1.9.0",
"rollup-plugin-eslint": "^5.1.0",
"rollup-plugin-node-resolve": "^4.2.2",
"rollup-plugin-svelte": "^5.0.3",
"rollup-plugin-terser": "^4.0.4",
......
/* eslint-env node */
import svelte from 'rollup-plugin-svelte';
import resolve from 'rollup-plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import { eslint } from 'rollup-plugin-eslint';
const isProduction = process.env.BUILD === 'production';
......@@ -20,6 +22,9 @@ export default {
name: 'redMantle',
},
plugins: [
eslint({
formatter: 'unix',
}),
sveltePlugin,
resolvePlugin,
isProduction && terser({
......
This diff is collapsed.