add eslint

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 483c03cebe
commit 313dee2a26
6 changed files with 55 additions and 19 deletions

13
.eslintrc.json Normal file
View File

@@ -0,0 +1,13 @@
{
"extends": "google",
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
},
"rules": {
"require-jsdoc": "off",
"arrow-parens": "off",
"object-curly-spacing": "off"
},
"plugins": ["html"]
}

View File

@@ -2,6 +2,9 @@
"name": "rrweb-player", "name": "rrweb-player",
"version": "0.1.0", "version": "0.1.0",
"devDependencies": { "devDependencies": {
"eslint": "^5.7.0",
"eslint-config-google": "^0.11.0",
"eslint-plugin-html": "^4.0.6",
"npm-run-all": "^4.1.3", "npm-run-all": "^4.1.3",
"rollup": "^0.66.2", "rollup": "^0.66.2",
"rollup-plugin-commonjs": "^9.1.8", "rollup-plugin-commonjs": "^9.1.8",

View File

@@ -8,10 +8,9 @@
<script> <script>
import Player from './Player.html'; import Player from './Player.html';
export default { export default {
components: { components: {
Player Player,
} },
} };
</script> </script>

View File

@@ -1,4 +1,4 @@
<div class="rr-player"> <div class="rr-player" { style }>
rrplayer rrplayer
</div> </div>
@@ -9,9 +9,23 @@
</style> </style>
<script> <script>
import { inlineCss } from '../util.js';
export default { export default {
data() { data() {
return {} return {
} width: 1024,
} height: 576,
};
},
computed: {
style({ width, height }) {
return inlineCss({
width: `${width}px`,
height: `${height}px`,
});
},
},
};
</script> </script>

View File

@@ -3,8 +3,8 @@ import App from './App.html';
const app = new App({ const app = new App({
target: document.body, target: document.body,
data: { data: {
name: 'world' name: 'world',
} },
}); });
export default app; export default app;

7
src/util.js Normal file
View File

@@ -0,0 +1,7 @@
export function inlineCss(cssObj) {
let style = '';
Object.keys(cssObj).forEach(key => {
style += `${key}: ${cssObj[key]};`;
});
return style;
}