Formatting/Linting

This commit is contained in:
Nicolai Ort 2021-08-16 18:27:09 +02:00
parent c4e1b5e445
commit 08520ac616
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
12 changed files with 422 additions and 415 deletions

View File

@ -1,2 +1,3 @@
# LinkyLinky Extension # LinkyLinky Extension
> The companion extension for LinkyLinky > The companion extension for LinkyLinky

View File

@ -4,9 +4,7 @@
"version": "0.0.1", "version": "0.0.1",
"description": "A simple url shortener", "description": "A simple url shortener",
"short_name": "LinkyLinky", "short_name": "LinkyLinky",
"permissions": [ "permissions": ["activeTab"],
"activeTab"
],
"browser_action": { "browser_action": {
"default_popup": "build/index.html" "default_popup": "build/index.html"
} }

View File

@ -1,9 +1,9 @@
const tailwindcss = require("tailwindcss"); const tailwindcss = require('tailwindcss');
const autoprefixer = require("autoprefixer"); const autoprefixer = require('autoprefixer');
const cssnano = require("cssnano"); const cssnano = require('cssnano');
const mode = process.env.NODE_ENV; const mode = process.env.NODE_ENV;
const dev = mode === "development"; const dev = mode === 'development';
const config = { const config = {
plugins: [ plugins: [
@ -11,10 +11,11 @@ const config = {
tailwindcss(), tailwindcss(),
//But others, like autoprefixer, need to run after, //But others, like autoprefixer, need to run after,
autoprefixer(), autoprefixer(),
!dev && cssnano({ !dev &&
preset: "default", cssnano({
preset: 'default'
}) })
], ]
}; };
module.exports = config; module.exports = config;

View File

@ -1,4 +1,4 @@
@tailwind base; @tailwind base;
/* Write your global styles here, in PostCSS syntax */ /* Write your global styles here, in PostCSS syntax */
@tailwind components; @tailwind components;
@tailwind utilities @tailwind utilities;

View File

@ -1,30 +1,38 @@
import axios from 'axios'; import axios from 'axios';
const config = { const config = {
username: "niggl", username: 'niggl',
password: "niggl" password: '9VEBc596T7tiPB7mNJukfeH9LfGzrrJN'
} };
export default class Apiclient { export default class Apiclient {
static async getUrls() { static async getUrls() {
return (await axios.get("https://kauft.es/api?showVisits=true", { return (
await axios.get('https://kauft.es/api?showVisits=true', {
auth: config auth: config
})).data })
).data;
} }
static async getUrlDetails(shortcode) { static async getUrlDetails(shortcode) {
return (await axios.get(`https://kauft.es/api/${shortcode}`, { return (
await axios.get(`https://kauft.es/api/${shortcode}`, {
auth: config auth: config
})).data })
).data;
} }
static async getUrlVisits(shortcode) { static async getUrlVisits(shortcode) {
return (await axios.get(`https://kauft.es/api/${shortcode}/visits`, { return (
await axios.get(`https://kauft.es/api/${shortcode}/visits`, {
auth: config auth: config
})).data })
).data;
} }
static async deleteUrl(shortcode) { static async deleteUrl(shortcode) {
return (await axios.delete(`https://kauft.es/api/${shortcode}`, { return (
await axios.delete(`https://kauft.es/api/${shortcode}`, {
auth: config auth: config
})).status })
).status;
} }
} }

View File

@ -2,11 +2,10 @@
export let title = 'Title'; export let title = 'Title';
export let count = 0; export let count = 0;
</script> </script>
<div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-900"> <div class="flex items-center p-4 bg-white rounded-lg shadow-xs dark:bg-gray-900">
<div <div class="p-3 mr-4 text-red-500 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-500">
class="p-3 mr-4 text-red-500 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-500" <slot />
>
<slot></slot>
</div> </div>
<div> <div>
<p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">{title}</p> <p class="mb-2 text-sm font-medium text-gray-600 dark:text-gray-400">{title}</p>

View File

@ -6,7 +6,7 @@
}); });
function deleteUrl(shortcode) { function deleteUrl(shortcode) {
Apiclient.deleteUrl(shortcode).then((res) => { Apiclient.deleteUrl(shortcode).then(() => {
urls = urls.filter((url) => url.shortcode != shortcode); urls = urls.filter((url) => url.shortcode != shortcode);
}); });
} }

View File

@ -1,4 +1,4 @@
import preprocess from "svelte-preprocess"; import preprocess from 'svelte-preprocess';
import staticAdapter from '@sveltejs/adapter-static'; import staticAdapter from '@sveltejs/adapter-static';
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
@ -12,9 +12,11 @@ const config = {
} }
}, },
preprocess: [preprocess({ preprocess: [
"postcss": true preprocess({
})] postcss: true
})
]
}; };
export default config; export default config;

View File

@ -1,13 +1,11 @@
const config = { const config = {
mode: "jit", mode: 'jit',
darkMode: 'media', darkMode: 'media',
purge: [ purge: ['./src/**/*.{html,js,svelte,ts}'],
"./src/**/*.{html,js,svelte,ts}",
],
theme: { theme: {
extend: {}, extend: {}
}, },
plugins: [], plugins: []
}; };
module.exports = config; module.exports = config;