Skip to content

Commit 41021af

Browse files
committed
chore: adding code quality dependencies for future repleases
1 parent 66c6e7f commit 41021af

8 files changed

Lines changed: 1599 additions & 15 deletions

File tree

.husky/pre-commit

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run prettier
5+
npm run lint
6+
npm run build
7+
npm test

.prettierrc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"arrowParens": "avoid",
3+
"bracketSameLine": false,
4+
"bracketSpacing": true,
5+
"embeddedLanguageFormatting": "auto",
6+
"htmlWhitespaceSensitivity": "strict",
7+
"insertPragma": false,
8+
"jsxSingleQuote": true,
9+
"printWidth": 80,
10+
"proseWrap": "preserve",
11+
"quoteProps": "consistent",
12+
"requirePragma": false,
13+
"semi": false,
14+
"singleAttributePerLine": true,
15+
"singleQuote": true,
16+
"tabWidth": 2,
17+
"trailingComma": "none",
18+
"useTabs": false,
19+
"vueIndentScriptAndStyle": false
20+
}

eslint.config.mjs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import js from '@eslint/js'
2+
import tseslint from 'typescript-eslint'
3+
4+
export default [
5+
{
6+
ignores: ['node_modules', 'dist', 'coverage']
7+
},
8+
js.configs.recommended,
9+
...tseslint.configs.recommended,
10+
{
11+
languageOptions: {
12+
ecmaVersion: 2020,
13+
sourceType: 'module',
14+
globals: {
15+
window: 'readonly',
16+
document: 'readonly',
17+
console: 'readonly'
18+
}
19+
},
20+
rules: {
21+
'@typescript-eslint/no-unused-vars': [
22+
'warn',
23+
{
24+
argsIgnorePattern: '^_',
25+
varsIgnorePattern: '^_'
26+
}
27+
],
28+
'@typescript-eslint/no-explicit-any': 'error'
29+
}
30+
}
31+
]

index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ describe('generateKey', () => {
118118

119119
test('should handle when crypto.getRandomValues returns 0', () => {
120120
const getRandomValuesSpy = vi.spyOn(window.crypto, 'getRandomValues')
121-
getRandomValuesSpy.mockImplementation((arr) => {
121+
getRandomValuesSpy.mockImplementation(arr => {
122122
if (arr instanceof Uint32Array) {
123123
arr[0] = 0
124124
}
@@ -134,7 +134,7 @@ describe('generateKey', () => {
134134

135135
test('should handle with maximum uint32 value', () => {
136136
const getRandomValuesSpy = vi.spyOn(window.crypto, 'getRandomValues')
137-
getRandomValuesSpy.mockImplementation((arr) => {
137+
getRandomValuesSpy.mockImplementation(arr => {
138138
if (arr instanceof Uint32Array) {
139139
arr[0] = 0xffffffff
140140
}

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ const generateKey = (max: number = 5000, min: number = 1): string => {
88
return Math.floor(finalRandomNumber * (max - min) + min).toString()
99
}
1010

11-
export { generateKey }
11+
export { generateKey }

0 commit comments

Comments
 (0)