Skip to content

Commit

Permalink
chore: bump eslint-config and add eslint-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
kelsos committed Jul 8, 2024
1 parent 57ed57c commit 4db75c1
Show file tree
Hide file tree
Showing 28 changed files with 437 additions and 454 deletions.
5 changes: 2 additions & 3 deletions components/account/home/PaymentsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { storeToRefs } from 'pinia';
import { get } from '@vueuse/core';
import { useMainStore } from '~/store';
import type { Ref } from 'vue';
import type {
DataTableColumn,
DataTableSortColumn,
Expand Down Expand Up @@ -42,8 +41,8 @@ const headers: DataTableColumn<Payment>[] = [
const store = useMainStore();
const { account } = storeToRefs(store);
const pagination: Ref<TablePaginationData | undefined> = ref();
const sort: Ref<DataTableSortColumn<Payment>[]> = ref([]);
const pagination = ref<TablePaginationData>();
const sort = ref<DataTableSortColumn<Payment>[]>([]);
const payments = computed(() => {
const userAccount = get(account);
Expand Down
10 changes: 5 additions & 5 deletions components/account/home/SubscriptionTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ const headers: DataTableColumn<Subscription>[] = [
const store = useMainStore();
const { subscriptions } = storeToRefs(store);
const pagination: Ref<TablePaginationData | undefined> = ref();
const sort: Ref<DataTableSortColumn<Subscription>[]> = ref([]);
const selectedSubscription: Ref<Subscription | undefined> = ref();
const showCancelDialog: Ref<boolean> = ref(false);
const cancelling: Ref<boolean> = ref(false);
const pagination = ref<TablePaginationData>();
const sort = ref<DataTableSortColumn<Subscription>[]>([]);
const selectedSubscription = ref<Subscription>();
const showCancelDialog = ref<boolean>(false);
const cancelling = ref<boolean>(false);
const pending = computed(() => get(subscriptions).filter(sub => sub.pending));
Expand Down
4 changes: 2 additions & 2 deletions components/account/home/UnverifiedEmailWarning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const { t } = useI18n();
const store = useMainStore();
const success: Ref<boolean> = ref(false);
const error: Ref<string> = ref('');
const success = ref<boolean>(false);
const error = ref<string>('');
let pendingTimeout: any;
Expand Down
10 changes: 5 additions & 5 deletions components/account/login/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const props = withDefaults(defineProps<{ modal?: boolean }>(), {
const emit = defineEmits<{ (e: 'complete'): void }>();
const { modal } = toRefs(props);
const username: Ref<string> = ref('');
const password: Ref<string> = ref('');
const loading: Ref<boolean> = ref(false);
const error: Ref<string> = ref('');
const hadError: Ref<boolean> = ref(false);
const username = ref<string>('');
const password = ref<string>('');
const loading = ref<boolean>(false);
const error = ref<string>('');
const hadError = ref<boolean>(false);
const rules = {
username: { required },
Expand Down
6 changes: 3 additions & 3 deletions components/account/password/PasswordReset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const logger = useLogger();
function setupTokenValidation() {
const route = useRoute();
const { uid, token } = route.params;
const validating: Ref<boolean> = ref(true);
const isValid: Ref<boolean> = ref(true);
const validating = ref<boolean>(true);
const isValid = ref<boolean>(true);
const validateToken = async () => {
try {
Expand Down Expand Up @@ -73,7 +73,7 @@ const $externalResults = ref({});
const route = useRoute();
const { uid, token } = route.params;
const submitting: Ref<boolean> = ref(false);
const submitting = ref<boolean>(false);
async function submit() {
set(submitting, true);
Expand Down
2 changes: 1 addition & 1 deletion components/account/signup/SignupAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const rules = {
email: { required, email },
};
const $externalResults: Ref<Record<string, string[]>> = ref({});
const $externalResults = ref<Record<string, string[]>>({});
const v$ = useVuelidate(rules, modelValue, {
$autoDirty: true,
Expand Down
4 changes: 2 additions & 2 deletions components/account/signup/SignupAddress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ const rules = {
terms: { checked: (value: boolean) => value },
};
const terms: Ref<boolean> = ref(false);
const terms = ref<boolean>(false);
const recaptcha = useRecaptcha();
const { recaptchaPassed, onError, onSuccess, onExpired, recaptchaToken }
= recaptcha;
const $externalResults: Ref<Record<string, string[]>> = ref({});
const $externalResults = ref<Record<string, string[]>>({});
const v$ = useVuelidate(
rules,
Expand Down
2 changes: 1 addition & 1 deletion components/account/signup/SignupCustomerInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const rules = {
vatId: {},
};
const $externalResults: Ref<Record<string, string[]>> = ref({});
const $externalResults = ref<Record<string, string[]>>({});
const v$ = useVuelidate(rules, modelValue, {
$autoDirty: true,
Expand Down
7 changes: 3 additions & 4 deletions components/account/signup/SignupForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { get, set } from '@vueuse/core';
import { FetchError } from 'ofetch';
import { fetchWithCsrf } from '~/utils/api';
import type { Ref } from 'vue';
import type {
SignupAccountPayload,
SignupAddressPayload,
Expand Down Expand Up @@ -37,8 +36,8 @@ const addressForm = ref<SignupAddressPayload>({
country: '',
});
const loading: Ref<boolean> = ref(false);
const externalResults: Ref<ValidationErrors> = ref({});
const loading = ref<boolean>(false);
const externalResults = ref<ValidationErrors>({});
async function signup({
recaptchaToken,
Expand Down Expand Up @@ -86,7 +85,7 @@ async function signup({
set(loading, false);
}
const step: Ref<number> = ref(1);
const step = ref<number>(1);
const steps = [
{
title: t('auth.signup.steps.step_1.title'),
Expand Down
2 changes: 1 addition & 1 deletion components/checkout/pay/CardPayment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function redirect() {
window.location.href = url.toString();
}
const btClient: Ref<Client | null> = ref(null);
const btClient = ref<Client | null>(null);
onBeforeMount(async () => {
try {
Expand Down
6 changes: 3 additions & 3 deletions components/checkout/pay/CryptoAssetSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ interface Item {
label: string;
}
const blockchainItems: ComputedRef<Item[]> = computed(() => Object.keys(get(paymentAssets)).map(item => ({
const blockchainItems = computed<Item[]>(() => Object.keys(get(paymentAssets)).map(item => ({
id: item,
label: toTitleCase(item),
})));
const selectedChain: Ref<string> = ref('');
const selectedChain = ref<string>('');
const tokenItems: ComputedRef<Item[]> = computed(() => {
const tokenItems = computed<Item[]>(() => {
const chain = get(selectedChain);
if (!chain)
return [];
Expand Down
3 changes: 1 addition & 2 deletions components/checkout/pay/CryptoRequest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
import { get, set } from '@vueuse/core';
import { useMainStore } from '~/store';
import { usePaymentCryptoStore } from '~/store/payments/crypto';
import type { Ref } from 'vue';
const { t } = useI18n();
const store = useMainStore();
const acceptRefundPolicy = ref(false);
const processing: Ref<boolean> = ref(false);
const processing = ref<boolean>(false);
const { plan } = usePlanParams();
const { paymentMethodId } = usePaymentMethodParam();
Expand Down
2 changes: 1 addition & 1 deletion components/checkout/pay/PaypalPayment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const { paymentMethodId } = usePaymentMethodParam();
const { addPaypal, createPaypalNonce } = usePaymentPaypalStore();
const { token, plan, loading, pending, success } = toRefs(props);
const error: Ref<ErrorMessage | null> = ref(null);
const error = ref<ErrorMessage | null>(null);
const accepted = ref(false);
const mustAcceptRefund = ref(false);
const paying = ref(false);
Expand Down
4 changes: 2 additions & 2 deletions components/checkout/pay/SavedCardDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ const vaults = setupVaults();
const { t } = useI18n();
const submitPayload: Ref<{ nonce: string; bin: string }> = ref({
const submitPayload = ref<{ nonce: string; bin: string }>({
nonce: '',
bin: '',
});
const payloadError: Ref<string> = ref('');
const payloadError = ref<string>('');
onMounted(async () => {
try {
Expand Down
7 changes: 3 additions & 4 deletions components/checkout/payment-method/PaymentMethodSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { storeToRefs } from 'pinia';
import { useMainStore } from '~/store';
import { PaymentMethod } from '~/types/payment';
import { assert } from '~/utils/assert';
import type { ComputedRef, Ref } from 'vue';
import type { RuiIcons } from '@rotki/ui-library';
const props = defineProps<{ identifier?: string }>();
Expand All @@ -28,8 +27,8 @@ const { identifier } = toRefs(props);
const { authenticated } = storeToRefs(store);
const loginRequired = ref(false);
const method: Ref<PaymentMethod | undefined> = ref(get(paymentMethodId));
const processing: Ref<boolean> = ref(false);
const method = ref<PaymentMethod>(get(paymentMethodId));
const processing = ref<boolean>(false);
const paymentMethods: PaymentMethodItem[] = [
{
Expand All @@ -55,7 +54,7 @@ const paymentMethods: PaymentMethodItem[] = [
},
];
const selected: ComputedRef<PaymentMethodItem | undefined> = computed(() =>
const selected = computed<PaymentMethodItem | undefined>(() =>
get(paymentMethods).find(m => get(method) === m.id),
);
Expand Down
3 changes: 1 addition & 2 deletions components/checkout/plan/ChangePlanDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { get, set, toRefs } from '@vueuse/core';
import { storeToRefs } from 'pinia';
import { useMainStore } from '~/store';
import { getPlanName } from '~/utils/plans';
import type { ComputedRef } from 'vue';
import type { Plan } from '~/types';
const props = withDefaults(
Expand All @@ -30,7 +29,7 @@ const { plans } = storeToRefs(store);
const { crypto, visible, warning } = toRefs(props);
const confirmed = ref(false);
const availablePlans: ComputedRef<Plan[]> = computed(() => get(plans) ?? []);
const availablePlans = computed<Plan[]>(() => get(plans) ?? []);
const cancel = () => emit('cancel');
Expand Down
7 changes: 3 additions & 4 deletions components/checkout/plan/PlanSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { storeToRefs } from 'pinia';
import { get, set } from '@vueuse/core';
import { useMainStore } from '~/store';
import type { ComputedRef, Ref } from 'vue';
import type { Plan } from '~/types';
const { t } = useI18n();
Expand All @@ -11,10 +10,10 @@ const { plan: savedPlan } = usePlanParams();
const { account, authenticated, plans } = storeToRefs(useMainStore());
const identifier: Ref<number> = ref(get(savedPlan));
const processing: Ref<boolean> = ref(false);
const identifier = ref<number>(get(savedPlan));
const processing = ref<boolean>(false);
const selected: ComputedRef<Plan | undefined> = computed(
const selected = computed<Plan | undefined>(
() => get(plans)?.find(plan => plan.months === get(identifier)),
);
Expand Down
2 changes: 1 addition & 1 deletion components/header/PageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function logout() {
await navigateTo('/login');
}
const menuOpened: Ref<boolean> = ref(false);
const menuOpened = ref<boolean>(false);
const route = useRoute();
Expand Down
8 changes: 4 additions & 4 deletions components/integration/IntegrationDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ enum TabCategory {
EXCHANGES = 'exchanges',
PROTOCOLS = 'protocols',
}
const search: Ref<string> = ref('');
const search = ref<string>('');
const searchDebounced = refDebounced(search, 200);
const tab: Ref<TabCategory> = ref(TabCategory.ALL);
const tab = ref<TabCategory>(TabCategory.ALL);
const { t } = useI18n();
Expand Down Expand Up @@ -53,8 +53,8 @@ const data = computed(() => {
};
});
const isAllSelected: ComputedRef<boolean> = computed(() => get(tab) === 'all');
const total: ComputedRef<number> = computed(() => Object.values(get(data)).reduce((accumulator, item) => accumulator + item.data.length, 0));
const isAllSelected = computed<boolean>(() => get(tab) === 'all');
const total = computed<number>(() => Object.values(get(data)).reduce((accumulator, item) => accumulator + item.data.length, 0));
const [DefineNotFound, ReuseNotFound] = createReusableTemplate<{
keyword: string;
Expand Down
4 changes: 2 additions & 2 deletions components/jobs/JobDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const props = defineProps<{
const { data } = toRefs(props);
const separatedData: ComputedRef<{
const separatedData = computed<{
default: JobMarkdownContent;
blockquote: JobMarkdownContent;
}> = computed(() => {
}>(() => {
const regularItems = [];
const blockquoteItems = [];
Expand Down
2 changes: 1 addition & 1 deletion components/jobs/JobTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const props = defineProps<{
const { tag } = toRefs(props);
const icon: ComputedRef<RuiIcons | undefined> = computed(() => {
const icon = computed<RuiIcons | undefined>(() => {
const value = get(tag);
const map: Record<string, RuiIcons> = {
'full-time': 'timer-2-line',
Expand Down
5 changes: 2 additions & 3 deletions composables/countries.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { Ref } from 'vue';
import type { ApiResponse } from '~/types';

export interface Country {
Expand All @@ -7,8 +6,8 @@ export interface Country {
}

export function useCountries() {
const countries: Ref<Country[]> = ref([]);
const countriesLoadError: Ref<string> = ref('');
const countries = ref<Country[]>([]);
const countriesLoadError = ref<string>('');

const loadCountries = async () => {
try {
Expand Down
13 changes: 6 additions & 7 deletions composables/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {
MarkdownParsedContent,
QueryBuilderWhere,
} from '@nuxt/content/dist/runtime/types';
import type { ComputedRef, Ref } from 'vue';

export interface JobMarkdownContent extends MarkdownParsedContent {
link?: string;
Expand All @@ -27,18 +26,18 @@ export interface TestimonialMarkdownContent extends MarkdownParsedContent {
* Loads jobs and markdown content based on given path
*/
export function useMarkdownContent() {
const jobs: Ref<JobMarkdownContent[]> = ref([]);
const testimonials: Ref<TestimonialMarkdownContent[]> = ref([]);
const openJobs: ComputedRef<JobMarkdownContent[]> = computed(() =>
const jobs = ref<JobMarkdownContent[]>([]);
const testimonials = ref<TestimonialMarkdownContent[]>([]);
const openJobs = computed<JobMarkdownContent[]>(() =>
get(jobs).filter(job => job.open),
);
const groupedOpenJobsByCategory: ComputedRef<
const groupedOpenJobsByCategory = computed<
Record<string, readonly JobMarkdownContent[]>
> = computed(() =>
>(() =>
Object.fromEntries(groupBy(get(openJobs), item => item.category ?? '')),
);

const firstJob: ComputedRef<JobMarkdownContent | null> = computed(
const firstJob = computed<JobMarkdownContent | null>(
() => get(openJobs)[0] ?? null,
);

Expand Down
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export default rotki({
},
stylistic: true,
formatters: true,
rotki: {
overrides: {
'@rotki/consistent-ref-type-annotation': ['warn', { allowInference: true }],
},
},
}, {
files: ['**/*.ts'],
rules: {
Expand Down
Loading

0 comments on commit 4db75c1

Please sign in to comment.