Skip to content

Commit

Permalink
updated config too see .vue files
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed May 22, 2024
1 parent 9da13e4 commit 32ff122
Show file tree
Hide file tree
Showing 17 changed files with 147 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v20
v22.1.0
2 changes: 1 addition & 1 deletion codex-ui/src/vue/components/radio/RadioGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defineProps<{
name?: string;
}>();
const model = defineModel();
const model = defineModel<String>();
</script>

<style lang="postcss" module>
Expand Down
79 changes: 62 additions & 17 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import CodeX from 'eslint-config-codex';
import { FlatCompat } from '@eslint/eslintrc';
import path from 'path';
import { fileURLToPath } from 'url';

// mimic CommonJS variables -- not needed if using CommonJS
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
});
import { plugin as TsPlugin, parser as TsParser } from 'typescript-eslint';
import VueParser from 'vue-eslint-parser';

/**
* @todo connect architecture config
Expand All @@ -18,22 +9,76 @@ export default [
...CodeX,
...compat.extends('.architecture.eslintrc'),
{
name: 'notex.api',
files: ['src/**/*'],
name: 'ts-notex.web',
ignores: ['codex-ui/**/*', '*.pcss', '*.otf', 'eslint.config.mjs', 'postcss.config.js'],
plugins: {
'@typescript-eslint': TsPlugin,
},

languageOptions: {
parser: TsParser,
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: './',
sourceType: 'module', // Allows for the use of imports
},
},

rules: {
'n/no-missing-import': ['off'],
'n/no-unpublished-import': ['error', {
allowModules: ['vitest', 'postgres-migrations', 'eslint-import-resolver-alias', 'eslint-config-codex'],
ignoreTypeImport: true,
}],
},
'n/no-unsupported-features/node-builtins': ['error', {
version: '>=22.1.0',
}],
'@typescript-eslint/naming-convention': ['error', {
selector: 'property',
format: ['camelCase'],
filter: {
regex: '^(?!(2xx|2[0-9][0-9]|application/json|VITE.*|HAWK.*)$).*',
match: true,
},
}],

/**
* @todo get rid of this rule ignores and solve all eslint errors occured
*/
'@typescript-eslint/no-unsafe-assignment': ['off'],
'@typescript-eslint/no-unsafe-argument': ['off'],
'@typescript-eslint/no-unsafe-return': ['off'],
'@typescript-eslint/no-unsafe-call': ['off'],
'@typescript-eslint/no-unsafe-member-access': ['off'],
'jsdoc/require-param-type': ['off'],
'jsdoc/informative-docs': ['off'],
'jsdoc/require-jsdoc': ['off'],
},
},
{
languageOptions: {
parser: VueParser,
parserOptions: {
project: 'tsconfig.json', // Автоматически находить tsconfig.json в рабочей директории
tsconfigRootDir: './',
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true,
},
extraFileExtensions: ['.vue'],
parser: TsParser,
sourceType: 'module',
},
},
rules: {
'n/no-missing-import': ['off'],
'n/no-unpublished-import': ['error', {
allowModules: ['vitest', 'postgres-migrations', 'eslint-import-resolver-alias', 'eslint-config-codex'],
ignoreTypeImport: true,
}],
'n/no-unsupported-features/node-builtins': ['error', {
version: '>=22.1.0',
}],
'jsdoc/require-param-type': ['off'],
'jsdoc/informative-docs': ['off'],
'jsdoc/require-jsdoc': ['off'],
},
},
];
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
"vue-router": "^4.2.4"
},
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.3.0",
"@hawk.so/vite-plugin": "^1.0.2",
"@types/node": "^20.10.7",
"@vitejs/plugin-vue": "^4.1.0",
"eslint": "^9.0.0",
"eslint": "^9.3.0",
"eslint-config-codex": "^2.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.5.5",
Expand All @@ -49,8 +49,8 @@
"postcss-nested": "^6.0.1",
"postcss-preset-env": "^9.0.0",
"prettier": "3.2.5",
"typescript": "^5.0.2",
"typescript-eslint": "^7.6.0",
"typescript": "^5.4.5",
"typescript-eslint": "^7.9.0",
"vite": "^4.4.9",
"vue-tsc": "^1.8.8"
},
Expand Down
1 change: 0 additions & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import postcssNested from 'postcss-nested';
import postcssPresetEnv from 'postcss-preset-env';
import postcssApply from 'postcss-apply';
Expand Down
4 changes: 2 additions & 2 deletions src/application/services/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export default function useAuth(): UseOAuthComposableState {
off(callbackId);
}

callbackId = on(async (event) => {
callbackId = on((event) => {
if ('accessToken' in event.data && 'refreshToken' in event.data) {
await authService.acceptSession(event.data.accessToken, event.data.refreshToken);
authService.acceptSession(event.data.accessToken, event.data.refreshToken);

off(callbackId as number);
}
Expand Down
2 changes: 1 addition & 1 deletion src/application/services/useMarketplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function (): UseMarketplaceComposable {
*/
watch(
userEditorTools,
async (newValue) => {
(newValue) => {
/**
* Check if user tools are not loaded yet
*/
Expand Down
8 changes: 4 additions & 4 deletions src/application/services/useNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ interface UseNoteComposableState {
/**
* Returns list of tools used in note
*/
resolveToolsByContent: (content: NoteContent) => Promise<NoteTool[]>;
resolveToolsByContent: (content: NoteContent) => NoteTool[];

/**
* Load note by custom hostname
Expand Down Expand Up @@ -168,7 +168,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt
* Returns list of tools used in the note
* @param content - content of the note
*/
async function resolveToolsByContent(content: NoteContent): Promise<NoteTool[]> {
function resolveToolsByContent(content: NoteContent): NoteTool[] {
const { tools } = useTools(noteTools);
const resolvedNoteTools = new Map();

Expand Down Expand Up @@ -197,7 +197,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt
resolvedNoteTools.set(tool.id, tool);
});

return Array.from(resolvedNoteTools.values());
return Array.from(resolvedNoteTools.values()) as NoteTool[];
}

/**
Expand All @@ -213,7 +213,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt
/**
* Resolve tools that are used in note
*/
const specifiedNoteTools = await resolveToolsByContent(content);
const specifiedNoteTools = resolveToolsByContent(content);

if (currentId.value === null) {
/**
Expand Down
8 changes: 5 additions & 3 deletions src/domain/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default class AuthService {
if (this.repository.hasSession()) {
this.repository
.restoreSession()
.then(async (session) => {
await this.acceptSession(session.accessToken, session.refreshToken);
.then((session) => {
this.acceptSession(session.accessToken, session.refreshToken);
})
.catch(async (error) => {
if (error instanceof UnauthorizedError && error.message === 'Session is not valid') {
Expand All @@ -51,13 +51,15 @@ export default class AuthService {
* @param accessToken - token got from backend. Used to access protected resources
* @param refreshToken - token got from backend. Used to refresh access token
*/
public async acceptSession(accessToken: string, refreshToken: string): Promise<void> {
public acceptSession(accessToken: string, refreshToken: string): void {
this.eventBus.dispatchEvent(
new AuthCompletedEvent({
accessToken,
refreshToken,
})
);

return;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/domain/user.repository.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default interface UserRepositoryInterface {
/**
* Removes user data from the storage
*/
removeUser: () => Promise<void>;
removeUser: () => void;

/**
* Loads and store editor tools from user extensions
Expand Down
6 changes: 3 additions & 3 deletions src/infrastructure/storage/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class NoteStorage {
* @param publicId - Note publicId
* @returns - Note data
*/
public async getNoteById(publicId: string): Promise<Note | null> {
public getNoteById(publicId: string): Note | null {
console.log('Get note by publicId', publicId);

return null;
Expand All @@ -20,7 +20,7 @@ export default class NoteStorage {
* @param hostname - Custom hostname
* @returns - Note data
*/
public async getNoteByHostname(hostname: string): Promise<Note | null> {
public getNoteByHostname(hostname: string): Note | null {
console.log('Get note by hostname', hostname);

return null;
Expand All @@ -30,7 +30,7 @@ export default class NoteStorage {
* Insert note
* @param note - note to insert
*/
public async insertNote(note: Note): Promise<void> {
public insertNote(note: Note): void {
console.log('Insert note', note);

return;
Expand Down
4 changes: 3 additions & 1 deletion src/infrastructure/user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export default class UserRepository extends Repository<UserStore, UserStoreData>
/**
* Removes user data from the storage
*/
public async removeUser(): Promise<void> {
public removeUser(): void {
this.store.removeUser();

return;
}

/**
Expand Down
8 changes: 5 additions & 3 deletions src/presentation/pages/NoteSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@
<Button
type="primary"
@click="regenerateHash"
>{{ t('noteSettings.revokeHash') }}</Button
>
{{ t('noteSettings.revokeHash') }}
</Button>
<Team
:note-id="id"
:team="noteSettings.team"
/>
<br />
<br>
<Button
type="destructive"
@click="deleteNote"
>{{ t('noteSettings.deleteNote') }}</Button
>
{{ t('noteSettings.deleteNote') }}
</Button>
</div>
<div v-else>
Loading...
Expand Down
16 changes: 16 additions & 0 deletions tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"include": [
"src/**/*.ts",
"src/**/*.vue",
"vite.config.ts",
"eslint.config.mjs",
"postcss.config.js",
],
"exclude": [
"node_modules",
"codex-ui",
"eslint.config.mjs",
"postcss.config.js",
]
}
9 changes: 8 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@
}
},
"include": [
"src",
"src/**/*.ts",
"src/**/*.vue",
"vite.config.ts",
".eslint.config.mjs"
],
"exclude": [
"node_modules",
"codex-ui",
"eslint.config.mjs",
"postcss.config.js",
]
}
1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import hawkVitePlugin from '@hawk.so/vite-plugin';
import process from 'process';

export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
Expand Down
Loading

0 comments on commit 32ff122

Please sign in to comment.