Skip to content

Commit 3458fa1

Browse files
committed
fix: improve equality checks in jumpSearch and enhance ESLint configuration
1 parent a07ff99 commit 3458fa1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

algorithms/search/jump-search/jumpSearch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export function jumpSearch(arr: number[], x: number): number | undefined {
1111
}
1212
while (arr[prev] < x) {
1313
prev++;
14-
if (prev == Math.min(step, n)) {
14+
if (prev === Math.min(step, n)) {
1515
return undefined;
1616
}
1717
}
18-
if (arr[prev] == x) {
18+
if (arr[prev] === x) {
1919
return prev;
2020
}
2121
return undefined;

eslint.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const parser = require("@typescript-eslint/parser");
2+
const typescriptPlugin = require("@typescript-eslint/eslint-plugin");
23

34
module.exports = [
45
{
@@ -8,16 +9,20 @@ module.exports = [
89
parserOptions: {
910
sourceType: "module",
1011
project: "./tsconfig.json",
12+
tsconfigRootDir: __dirname,
1113
},
1214
},
1315
plugins: {
14-
"@typescript-eslint": require("@typescript-eslint/eslint-plugin"),
16+
"@typescript-eslint": typescriptPlugin,
1517
},
1618
rules: {
1719
"no-extra-semi": "off",
1820
"no-irregular-whitespace": ["error", { skipTemplates: true }],
1921
"@typescript-eslint/no-unused-vars": "error",
2022
"@typescript-eslint/no-useless-constructor": "error",
23+
"@typescript-eslint/no-floating-promises": "error",
24+
"@typescript-eslint/await-thenable": "error",
25+
"eqeqeq": ["error", "always", { null: "ignore" }],
2126
},
2227
},
2328
];

0 commit comments

Comments
 (0)