Browse Source

Lint

pull/937/head
Sergei Birukov 2 years ago
parent
commit
27ec63d3e3
  1. 2
      src/.eslintrc.json
  2. 1
      src/config.js
  3. 3
      webui/.eslintrc.cjs
  4. 3
      webui/package.json
  5. 2
      webui/postcss.config.js
  6. 8
      webui/src/composables/useBytes.js
  7. 16
      webui/vite.config.js

2
src/.eslintrc.json

@ -1,7 +1,7 @@
{
"extends": "athom",
"ignorePatterns": [
"**/vendor/*.js"
"node_modules/**/*"
],
"rules": {
"consistent-return": "off",

1
src/config.js

@ -1,7 +1,6 @@
'use strict';
const { release } = require('./package.json');
require('dotenv').config(); // development
module.exports.RELEASE = release;
module.exports.PORT = process.env.PORT || '51821';

3
webui/.eslintrc.cjs

@ -5,6 +5,7 @@ module.exports = {
es2021: true,
},
extends: ['eslint:recommended', 'plugin:vue/vue3-recommended', 'prettier'],
ignorePatterns: ['dist/**/*', 'node_modules/**/*'],
parser: 'vue-eslint-parser',
// parserOptions: {
// parser: '@typescript-eslint/parser',
@ -15,7 +16,5 @@ module.exports = {
'vue/no-v-html': 'off',
'vue/multi-word-component-names': 'off',
'prettier/prettier': ['error'],
'vue/no-undef-components': ['error'],
'vue/no-undef-properties': ['error'],
},
};

3
webui/package.json

@ -7,7 +7,8 @@
"dev": "vite --host",
"build": "vite build",
"build:watch": "vite build --watch",
"preview": "vite preview"
"preview": "vite preview",
"lint": "eslint ."
},
"dependencies": {
"apexcharts": "^3.48.0",

2
webui/postcss.config.js

@ -3,4 +3,4 @@ export default {
tailwindcss: {},
autoprefixer: {},
},
}
};

8
webui/src/composables/useBytes.js

@ -2,13 +2,9 @@ export function useBytes() {
const bytes = (bytes, decimals, kib, maxunit) => {
kib = kib || false;
if (bytes === 0) return '0 B';
if (Number.isNaN(parseFloat(bytes)) && !Number.isFinite(bytes))
return 'NaN';
if (Number.isNaN(parseFloat(bytes)) && !Number.isFinite(bytes)) return 'NaN';
const k = kib ? 1024 : 1000;
const dm =
decimals != null && !Number.isNaN(decimals) && decimals >= 0
? decimals
: 2;
const dm = decimals != null && !Number.isNaN(decimals) && decimals >= 0 ? decimals : 2;
const sizes = kib
? ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB', 'BiB']
: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB', 'BB'];

16
webui/vite.config.js

@ -1,17 +1,15 @@
import { fileURLToPath, URL } from 'node:url'
import { fileURLToPath, URL } from 'node:url';
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
],
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
build: {
outDir: 'dist',
@ -23,4 +21,4 @@ export default defineConfig({
// }
// }
},
})
});

Loading…
Cancel
Save