Skip to content

Commit

Permalink
Fix linter and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mrruby committed Mar 11, 2024
1 parent 3d30fe6 commit 8ea4b8f
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 87 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ build
.env.*
!.env.example

holo-key-manager-js-client/lib

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
Expand Down
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"**/*.{js,ts,svelte,json}": ["eslint --fix", "prettier --write ."]
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ build
!.env.example
package.json

holo-key-manager-js-client/lib

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
Expand Down
3 changes: 0 additions & 3 deletions holo-key-manager-extension/.lintstagedrc

This file was deleted.

4 changes: 4 additions & 0 deletions holo-key-manager-extension/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [
{
Expand Down
12 changes: 0 additions & 12 deletions holo-key-manager-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,17 @@
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check 'src/**/*.{js,ts,svelte,json}' && eslint --fix 'src/**/*.{js,ts,svelte}'",
"format": "prettier --write 'src/**/*.{js,ts,svelte,json}'",
"prepare": "cd .. && husky install"
},
"devDependencies": {
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "2.0.2",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@tsconfig/node-lts": "^20.1.1",
"@types/chrome": "^0.0.254",
"@types/file-saver": "^2.0.7",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"archiver": "^7.0.1",
"autoprefixer": "^10.4.18",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-svelte": "^2.35.1",
"husky": "^8.0.3",
"lint-staged": "^15.2.2",
"postcss": "^8.4.35",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.2",
"prettier-plugin-tailwindcss": "^0.5.11",
"svelte-check": "^3.6.6",
Expand Down
9 changes: 8 additions & 1 deletion holo-key-manager-extension/scripts/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ const focusWindow = (sendResponse: (response?: Message) => void) => {

const createWindow = () => {
chrome.windows.create(
{ url: 'sign.html', type: 'popup', height: 500, width: 375, top: 100, left: 1100 },
{
url: 'sign.html',
type: 'popup',
height: 500,
width: 375,
top: 100,
left: 1100
},
(newWindow) => {
if (!newWindow) return;
windowId = newWindow.id;
Expand Down
5 changes: 4 additions & 1 deletion holo-key-manager-extension/src/lib/helpers/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { storageService } from '$sharedServices';
import { HashSaltSchema } from '$sharedTypes';

export const getPassword = async () => {
const data = await storageService.getWithoutCallback({ key: PASSWORD, area: LOCAL });
const data = await storageService.getWithoutCallback({
key: PASSWORD,
area: LOCAL
});
return HashSaltSchema.safeParse(data);
};
5 changes: 4 additions & 1 deletion holo-key-manager-extension/src/lib/queries/password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ export function createSignInMutation(queryClient: QueryClient) {
if (!parsedResult.success || !(await verifyPassword(password, parsedResult.data)))
throw new Error('Invalid password or data');

const deviceKey = await storageService.getWithoutCallback({ key: DEVICE_KEY, area: LOCAL });
const deviceKey = await storageService.getWithoutCallback({
key: DEVICE_KEY,
area: LOCAL
});
const parsedDeviceKey = EncryptedDeviceKeySchema.safeParse(deviceKey);
if (!parsedDeviceKey.success) throw new Error('Invalid device key');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line
// @ts-nocheck
import * as hcSeedBundle from 'hcSeedBundle';

Expand Down
2 changes: 1 addition & 1 deletion holo-key-manager-js-client/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as createHoloKeyManager } from "./src";
export { default as createHoloKeyManager } from './src';
4 changes: 2 additions & 2 deletions holo-key-manager-js-client/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type IHoloKeyManager = {
signUp(): Promise<void>;
signIn(): Promise<void>;
signUp(): Promise<void>;
signIn(): Promise<void>;
};
export type { IHoloKeyManager };
24 changes: 12 additions & 12 deletions holo-key-manager-js-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"declaration": true,
"types": [],
"paths": {
"@sharedTypes": ["../shared/types"],
"@sharedTypes/*": ["../shared/types/*"]
}
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules/**/*"]
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "lib",
"declaration": true,
"types": [],
"paths": {
"@sharedTypes": ["../shared/types"],
"@sharedTypes/*": ["../shared/types/*"]
}
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules/**/*"]
}
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@
"holo-key-manager-extension"
],
"scripts": {
"buildExtension": "cd holo-key-manager-extension && pnpm build && cd ..",
"lint": "prettier --check '**/*.{js,ts,svelte,json}' && eslint --fix '**/*.{js,ts,svelte}'",
"format": "prettier --write '**/*.{js,ts,svelte,json}'"
"format": "prettier --write '**/*.{js,ts,svelte,json}'",
"prepare": "husky install"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-svelte": "^2.35.1",
"husky": "^8.0.3",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5"
}
}
72 changes: 33 additions & 39 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions shared/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../tsconfig.base.json",
"include": ["**/*.ts"]
"extends": "../tsconfig.base.json",
"include": ["**/*.ts"]
}
24 changes: 12 additions & 12 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"compilerOptions": {
"lib": ["esnext", "DOM", "DOM.Iterable"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "bundler",
"verbatimModuleSyntax": true,
"module": "esnext",
"target": "esnext",
"types": ["chrome"]
}
"compilerOptions": {
"lib": ["esnext", "DOM", "DOM.Iterable"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "bundler",
"verbatimModuleSyntax": true,
"module": "esnext",
"target": "esnext",
"types": ["chrome"]
}
}

0 comments on commit 8ea4b8f

Please sign in to comment.