Skip to content

Commit

Permalink
style: eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
batopa committed Aug 13, 2024
1 parent 859acc1 commit b56e99b
Show file tree
Hide file tree
Showing 40 changed files with 219 additions and 196 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

6 changes: 3 additions & 3 deletions docs/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module.exports = {
extends: '@nuxt/eslint-config',
rules: {
'vue/max-attributes-per-line': 'off',
'vue/multi-word-component-names': 'off'
}
}
'vue/multi-word-component-names': 'off',
},
};
16 changes: 8 additions & 8 deletions docs/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ export default defineAppConfig({
nuxt: {
label: 'Nuxt',
icon: 'simple-icons:nuxtdotjs',
href: 'https://nuxt.com'
}
href: 'https://nuxt.com',
},
},
aside: {
level: 0,
collapsed: false,
exclude: []
exclude: [],
},
main: {
padded: true,
fluid: true
fluid: true,
},
header: {
logo: true,
showLinkIcon: true,
exclude: [],
fluid: true
}
}
})
fluid: true,
},
},
});
4 changes: 2 additions & 2 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export default defineNuxtConfig({
app: {
baseURL: '/nuxt-bedita/',
},
modules: []
})
modules: [],
});
4 changes: 2 additions & 2 deletions docs/tokens.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineTheme } from 'pinceau'
import { defineTheme } from 'pinceau';

export default defineTheme({
})
});
31 changes: 31 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat';

// Run `npx @eslint/config-inspector` to inspect the resolved config interactively
export default createConfigForNuxt({
features: {
// Rules for module authors
tooling: true,
// Rules for formatting
stylistic: {
semi: true,
braceStyle: '1tbs',
},
},
dirs: {
src: [
'./playground',
],
},
})
.append(
// your custom flat config here...
{
rules: {
'vue/max-attributes-per-line': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/multi-word-component-names': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"release:minor": "npm run lint && npm run prepack && changelogen --release --minor --push && npm publish --access public",
"release:major": "npm run lint && npm run prepack && changelogen --release --major --push && npm publish --access public",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"test": "vitest run",
"test:watch": "vitest watch",
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
Expand Down
6 changes: 3 additions & 3 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export default defineNuxtConfig({
{
path: '/files/upload',
methods: ['POST'],
}
},
],
},

devtools: { enabled: true },
compatibilityDate: '2024-08-12'
})
compatibilityDate: '2024-08-12',
});
11 changes: 5 additions & 6 deletions playground/pages/api-proxy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@

<script setup lang="ts">
import type { JsonApiResourceObject } from '@atlasconsulting/bedita-sdk';
import type { ApiResponseBodyResource } from '@atlasconsulting/nuxt-bedita';
import type { ApiResponseBodyList } from '@atlasconsulting/nuxt-bedita';
import type { ApiResponseBodyResource, ApiResponseBodyList } from '@atlasconsulting/nuxt-bedita';

const title = ref('');
const editObject = ref<JsonApiResourceObject>();
Expand All @@ -63,7 +62,7 @@ const saveObj = async () => {
title: title.value,
},
},
}
},
});

title.value = '';
Expand All @@ -90,7 +89,7 @@ const editObj = async (e: Event) => {
title: formData.get('title'),
},
},
}
},
});
editObject.value = undefined;
Expand All @@ -107,7 +106,7 @@ const editObj = async (e: Event) => {
} catch (e) {
console.error(e);
}
}
};
const deleteObj = async (id: string) => {
try {
Expand Down Expand Up @@ -143,5 +142,5 @@ const uploadFile = async (event: Event) => {
} catch (e) {
console.error(e);
}
}
};
</script>
3 changes: 1 addition & 2 deletions playground/pages/forgot-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ const send = async () => {
error.value = true;
}
isLoading.value = false;
}

};
</script>
3 changes: 1 addition & 2 deletions playground/pages/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,5 @@ const authenticate = async () => {
error.value = true;
}
isLoading.value = false;
}

};
</script>
3 changes: 1 addition & 2 deletions playground/pages/optout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ const deleteAccount = async () => {
error.value = true;
}
isLoading.value = false;
}

};
</script>
2 changes: 1 addition & 1 deletion playground/pages/profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ const save = async () => {
error.value = true;
}
isLoading.value = false;
}
};
</script>
3 changes: 1 addition & 2 deletions playground/pages/reset-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ const change = async (login = false) => {
error.value = true;
}
isLoading.value = false;
}

};
</script>
3 changes: 1 addition & 2 deletions playground/pages/signup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,5 @@ const submit = async () => {
error.value = true;
}
isLoading.value = false;
}

};
</script>
58 changes: 29 additions & 29 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,39 @@ import type { EndpointConf, ProxyEndpointConf } from './runtime/types';

// Module options TypeScript interface definition
export interface ModuleOptions {
apiBaseUrl: string,
apiKey: string,
apiBaseUrl: string;
apiKey: string;
auth: {
global?: boolean,
required?: boolean,
unauthenticatedRedirect?: string,
publicRoutes?: string[],
rolesGuard?: Record<string, string[]>,
sessionUserProps?: string[],
},
endpoints?: EndpointConf[],
proxyEndpoints?: ProxyEndpointConf[],
global?: boolean;
required?: boolean;
unauthenticatedRedirect?: string;
publicRoutes?: string[];
rolesGuard?: Record<string, string[]>;
sessionUserProps?: string[];
};
endpoints?: EndpointConf[];
proxyEndpoints?: ProxyEndpointConf[];
recaptcha: {
enabled: boolean,
siteKey?: string,
secretKey?: string,
hideBadge?: boolean,
useRecaptchaNet?: boolean,
},
replaceTranslations?: boolean,
resetPasswordPath?: string,
enabled: boolean;
siteKey?: string;
secretKey?: string;
hideBadge?: boolean;
useRecaptchaNet?: boolean;
};
replaceTranslations?: boolean;
resetPasswordPath?: string;
session: {
name: string,
secret: string,
},
name: string;
secret: string;
};
}

export default defineNuxtModule<ModuleOptions>({
meta: {
name: '@atlasconsulting/nuxt-bedita',
configKey: 'bedita',
compatibility: {
nuxt: '^3.0.0'
nuxt: '^3.0.0',
},
},

Expand Down Expand Up @@ -76,16 +76,16 @@ export default defineNuxtModule<ModuleOptions>({
},
},

setup (options, nuxt) {
setup(options, nuxt) {
logger.start('Setting up nuxt-bedita...');

options.auth.publicRoutes?.push(options.auth.unauthenticatedRedirect as string);

const runtimeConfig = nuxt.options.runtimeConfig
const runtimeConfig = nuxt.options.runtimeConfig;
runtimeConfig.bedita = defu(runtimeConfig.bedita || {}, {
apiBaseUrl: options.apiBaseUrl,
apiKey: options.apiKey,
proxyEndpoints: options.proxyEndpoints || [ { path: '*', methods: ['GET'] } ],
proxyEndpoints: options.proxyEndpoints || [{ path: '*', methods: ['GET'] }],
recaptchaSecretKey: options.recaptcha.secretKey,
replaceTranslations: options.replaceTranslations,
resetPasswordPath: options.resetPasswordPath,
Expand All @@ -106,7 +106,7 @@ export default defineNuxtModule<ModuleOptions>({
siteKey: options.recaptcha.siteKey,
hideBadge: options.recaptcha.hideBadge,
useRecaptchaNet: options.recaptcha.useRecaptchaNet,
}
},
});

logger.info(`Recaptcha ${options.recaptcha.enabled ? 'enabled' : 'disabled'}`);
Expand Down Expand Up @@ -183,7 +183,7 @@ export default defineNuxtModule<ModuleOptions>({
{
route: '/api/bedita/auth/optout',
handler: resolver.resolve('./runtime/server/api/bedita/auth/optout.post'),
}
},
);
}

Expand Down Expand Up @@ -279,5 +279,5 @@ export default defineNuxtModule<ModuleOptions>({
});

logger.success('nuxt-bedita ready');
}
},
});
12 changes: 6 additions & 6 deletions src/runtime/composables/useBeditaAuth.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useBeditaRecaptcha } from '../composables/useBeditaRecaptcha';
import { useUserState } from '../states/user';
import { computed, type ComputedRef, useRoute, type Ref } from '#imports';
import type { UserAuth, UserDataStore } from '../types';
import { filterUserDataToStore } from '../utils/user-data-store';
import { RecaptchaActions } from '../utils/recaptcha-helpers';
import { computed, type ComputedRef, useRoute, type Ref } from '#imports';

export const useBeditaAuth = () => {
const user: Ref<UserDataStore | null> = useUserState();
Expand All @@ -19,7 +19,7 @@ export const useBeditaAuth = () => {
body: {
username,
password,
recaptcha_token
recaptcha_token,
},
});

Expand All @@ -40,7 +40,7 @@ export const useBeditaAuth = () => {
method: 'POST',
body: {
contact,
recaptcha_token
recaptcha_token,
},
});
};
Expand All @@ -55,7 +55,7 @@ export const useBeditaAuth = () => {
uuid: uuid || route.query?.uuid,
password,
login,
recaptcha_token
recaptcha_token,
},
});

Expand All @@ -74,7 +74,7 @@ export const useBeditaAuth = () => {
body: {
username,
password,
recaptcha_token
recaptcha_token,
},
});
};
Expand All @@ -100,4 +100,4 @@ export const useBeditaAuth = () => {
optOut,
updateUser,
};
}
};
Loading

0 comments on commit b56e99b

Please sign in to comment.