Skip to content

Commit 4bd62a8

Browse files
chore: clean test imports
1 parent 906bc87 commit 4bd62a8

File tree

16 files changed

+36
-35
lines changed

16 files changed

+36
-35
lines changed

eslint.config.mjs

+1-13
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import eslintRecommended from '@eslint/js';
22
import typeScriptEslintPlugin from '@typescript-eslint/eslint-plugin';
33
import typescriptParser from '@typescript-eslint/parser';
44
import eslintConfigPrettier from 'eslint-config-prettier';
5-
import eslintImportPlugin from 'eslint-plugin-import';
65
import prettierPlugin from 'eslint-plugin-prettier';
76
import globals from 'globals';
87

9-
import { importOrderConfig } from './config/eslint/import-order.config.mjs';
108
import { typescriptRules } from './config/eslint/typescript-rules.config.mjs';
119

1210
export default [
@@ -27,24 +25,14 @@ export default [
2725
globals: {
2826
...globals.browser,
2927
...globals.node,
30-
...globals.jest,
3128
},
3229
},
3330
plugins: {
3431
'@typescript-eslint': typeScriptEslintPlugin,
35-
import: eslintImportPlugin,
3632
prettier: prettierPlugin,
3733
},
38-
settings: {
39-
'import/resolver': {
40-
typescript: {
41-
project: './tsconfig.json',
42-
},
43-
},
44-
},
4534
rules: {
46-
...typescriptRules,
47-
'import/order': importOrderConfig,
35+
...typescriptRules,
4836
},
4937
},
5038
{

lint-staged.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
// Run type-check on changes to TypeScript files
3-
'**/*.ts?(x)': () => 'yarn type-check',
3+
'**/*.ts?(x)': () => 'pnpm type-check',
44
// Run ESLint on changes to JavaScript/TypeScript files
5-
'**/*.(ts|js)?(x)': filenames => `yarn lint ${filenames.join(' ')}`,
5+
'**/*.(ts|js)?(x)': filenames => `pnpm lint ${filenames.join(' ')}`,
66
};

src/algorithms/anagrams/tests/anagrams.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { anagrams, easyAnagram } from '../anagrams';
2-
import { describe, test } from 'vitest';
32

43
describe('Anagrams Algorithm', () => {
54
test('anagrams function exists', () => {

src/algorithms/array-chunk/tests/array-chunk.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { describe, test } from 'vitest';
21
import { chunkArray, chunkSliced } from '../array-chunk';
32

43
describe('Array chunk', () => {

src/algorithms/fizzbuzz/tests/fizzbuzz.test.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import { SpyInstance, describe, test, vi } from 'vitest';
2-
31
import { fizzBuzz } from '../fizzbuzz';
42

53
describe('Fizzbuzz Algorithm', () => {
6-
let spy: SpyInstance;
4+
let spy;
75

86
beforeEach(() => {
97
spy = vi.spyOn(console, 'log').mockImplementation(() => {});

src/algorithms/integer-reverse/tests/integer-reverse.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { describe, test } from 'vitest';
2-
31
import { reverseInt } from '../integer-reversal';
42

53
describe('Integer Reversal', () => {

src/algorithms/matrix/tests/matrix.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { describe, test } from 'vitest';
2-
31
import { matrix } from '../matrix';
42

53
describe('Matrix Spiral', () => {

src/algorithms/maxchar/tests/maxchar.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { describe, test } from 'vitest';
2-
31
import { findMaxChar } from '../maxchar';
42

53
describe('Maxchar Algorithm', () => {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export const mergeAlternately = (word1: string, word2: string): string => {
2+
let result = '';
3+
const maxLength = Math.max(word1.length, word2.length);
4+
5+
for (let i = 0; i < maxLength; i++) {
6+
if (i < word1.length) {
7+
result += word1[i];
8+
}
9+
if (i < word2.length) {
10+
result += word2[i];
11+
}
12+
}
13+
14+
return result;
15+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { mergeAlternately } from '../merge-alternately';
2+
3+
describe('mergeAlternately', () => {
4+
test('equal length strings', () => {
5+
expect(mergeAlternately('abc', 'pqr')).toBe('apbqcr');
6+
});
7+
8+
test('first string shorter', () => {
9+
expect(mergeAlternately('ab', 'pqrs')).toBe('apbqrs');
10+
});
11+
12+
test('second string shorter', () => {
13+
expect(mergeAlternately('abcd', 'pq')).toBe('apbqcd');
14+
});
15+
});

src/algorithms/palindromes/tests/palindromes.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { describe, test } from 'vitest';
21
import { palindrome, palindromeWithEvery } from '../palindromes';
32

43
describe('Palindromes', () => {

src/algorithms/parentheses/tests/parentheses.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { describe, test } from 'vitest';
2-
31
import { isValidParentheses } from '../parentheses';
42

53
describe('Parentheses', () => {

src/algorithms/pyramid/tests/pyramid.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { SpyInstance, describe, test, vi } from 'vitest';
21
import { pyramid, pyramidWithRecursion } from '../pyramid';
32

43
describe('Steps Algorithm', () => {
5-
let spy: SpyInstance;
4+
let spy;
65

76
beforeEach(() => {
87
spy = vi.spyOn(console, 'log').mockImplementation(() => {});

src/algorithms/steps/tests/steps.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { SpyInstance, describe, test, vi } from 'vitest';
21
import { steps, stepsWithRecursion } from '../steps';
32

43
describe('Steps Algorithm', () => {
5-
let spy: SpyInstance;
4+
let spy;
65

76
beforeEach(() => {
87
spy = vi.spyOn(console, 'log').mockImplementation(() => {});

src/algorithms/string-reverse/tests/string-reverse.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { describe, test } from 'vitest';
21
import {
32
reverseString,
43
reverseWithLoop,

src/algorithms/vowels/tests/vowels.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { describe, test } from 'vitest';
21
import { vowels, vowelsWithRegex } from '../vowels';
32

43
describe('Finding Vowels', () => {

0 commit comments

Comments
 (0)