mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 23:06:14 -04:00
refactor: fixed sonarcloud issues
This commit is contained in:
parent
2a54b80de6
commit
a866ac6070
5 changed files with 6 additions and 67 deletions
|
@ -1,5 +1,5 @@
|
||||||
import {readdirSync, readFileSync} from 'fs'
|
import {readdirSync, readFileSync} from 'fs'
|
||||||
import path, {join} from 'path'
|
import {join, resolve} from 'path'
|
||||||
import {Module} from '@nuxt/types'
|
import {Module} from '@nuxt/types'
|
||||||
import {NuxtRouteConfig} from '@nuxt/types/config/router'
|
import {NuxtRouteConfig} from '@nuxt/types/config/router'
|
||||||
import YAML from 'yaml'
|
import YAML from 'yaml'
|
||||||
|
@ -9,7 +9,7 @@ const toolDirName = 'tools'
|
||||||
const rootDir = join(__dirname, '..', '..')
|
const rootDir = join(__dirname, '..', '..')
|
||||||
const toolsDir = join(rootDir, toolDirName)
|
const toolsDir = join(rootDir, toolDirName)
|
||||||
|
|
||||||
interface toolConfigModuleOptions {
|
interface ToolConfigModuleOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTools() {
|
function getTools() {
|
||||||
|
@ -36,7 +36,7 @@ function getTools() {
|
||||||
return toolList
|
return toolList
|
||||||
}
|
}
|
||||||
|
|
||||||
const toolConfigModule: Module<toolConfigModuleOptions> = function () {
|
const toolConfigModule: Module<ToolConfigModuleOptions> = function () {
|
||||||
const {nuxt, extendBuild, addPlugin} = this
|
const {nuxt, extendBuild, addPlugin} = this
|
||||||
const toolList = getTools()
|
const toolList = getTools()
|
||||||
const toolListFlat = Object.values(toolList).flat()
|
const toolListFlat = Object.values(toolList).flat()
|
||||||
|
@ -71,7 +71,7 @@ const toolConfigModule: Module<toolConfigModuleOptions> = function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
addPlugin({
|
addPlugin({
|
||||||
src: path.resolve(__dirname, 'plugin.ts'),
|
src: resolve(__dirname, 'plugin.ts'),
|
||||||
fileName: 'tool-config/plugin.ts',
|
fileName: 'tool-config/plugin.ts',
|
||||||
options: {
|
options: {
|
||||||
toolList,
|
toolList,
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
import {Component, Prop, Vue} from 'nuxt-property-decorator'
|
import {Component, Prop, Vue} from 'nuxt-property-decorator'
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default class Index extends Vue {
|
export default class Error extends Vue {
|
||||||
@Prop({default: () => null}) error!: { statusCode: number, message: string } | null;
|
@Prop({default: () => null}) error!: { statusCode: number, message: string } | null;
|
||||||
layout = 'empty'
|
layout = 'empty'
|
||||||
|
|
||||||
|
|
|
@ -116,64 +116,6 @@ export default class BaseConverter extends Tool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// import {copyToClipboard, isInt} from "../../utils/helpers";
|
|
||||||
//
|
|
||||||
// const convertBase = (value, fromBase, toBase) => {
|
|
||||||
// const range = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/'.split('');
|
|
||||||
// const fromRange = range.slice(0, fromBase);
|
|
||||||
// const toRange = range.slice(0, toBase);
|
|
||||||
// let decValue = value.split('').reverse().reduce((carry, digit, index) => {
|
|
||||||
// if (fromRange.indexOf(digit) === -1) throw new Error('Invalid digit `' + digit + '` for base ' + fromBase + '.');
|
|
||||||
// return carry += fromRange.indexOf(digit) * (Math.pow(fromBase, index));
|
|
||||||
// }, 0);
|
|
||||||
// let newValue = '';
|
|
||||||
// while (decValue > 0) {
|
|
||||||
// newValue = toRange[decValue % toBase] + newValue;
|
|
||||||
// decValue = (decValue - (decValue % toBase)) / toBase;
|
|
||||||
// }
|
|
||||||
// return newValue || '0';
|
|
||||||
// }
|
|
||||||
// export default {
|
|
||||||
// name: "BaseConverter",
|
|
||||||
// data() {
|
|
||||||
// return {
|
|
||||||
// inputError: '',
|
|
||||||
// inputNumber: '42',
|
|
||||||
// inputBase: 10,
|
|
||||||
// outputBase: 16,
|
|
||||||
// baseRules: [
|
|
||||||
// v => isInt(v) || 'Base should be an integer',
|
|
||||||
// v => !!v || 'Required',
|
|
||||||
// v => v > 1 || 'Base should be > 1',
|
|
||||||
// v => v <= 64 || 'Base should be <= 64'
|
|
||||||
// ],
|
|
||||||
// isMounted: false
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// mounted() {
|
|
||||||
// this.isMounted = true;
|
|
||||||
// },
|
|
||||||
// methods: {
|
|
||||||
// copy() {
|
|
||||||
// copyToClipboard(this.outputNumber);
|
|
||||||
// this.$toast.success('Copied to clipboard.')
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// computed: {
|
|
||||||
// outputNumber() {
|
|
||||||
// if (this.isMounted && this.$refs.inputBase.validate() && this.$refs.outputBase.validate()) {
|
|
||||||
// try {
|
|
||||||
// return convertBase(this.inputNumber, this.inputBase, this.outputBase)
|
|
||||||
// } catch (e) {
|
|
||||||
// return e.message;
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// return ''
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|
|
@ -51,9 +51,6 @@ import {formatBytes} from '~/utils/convert'
|
||||||
export default class TextStats extends Tool {
|
export default class TextStats extends Tool {
|
||||||
text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'
|
text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'
|
||||||
|
|
||||||
created() {
|
|
||||||
}
|
|
||||||
|
|
||||||
get textLength() {
|
get textLength() {
|
||||||
return this.text.length
|
return this.text.length
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ import Tool from '~/components/Tool.vue'
|
||||||
@Component({
|
@Component({
|
||||||
mixins: [CopyableMixin]
|
mixins: [CopyableMixin]
|
||||||
})
|
})
|
||||||
export default class RandomPortGenerator extends Tool {
|
export default class UrlEncoderDecoder extends Tool {
|
||||||
decoded = 'Hello world :)'
|
decoded = 'Hello world :)'
|
||||||
rules = {
|
rules = {
|
||||||
decoder: [
|
decoder: [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue