Skip to content

Commit

Permalink
infra(unicorn): prefer-includes (#2463)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Oct 11, 2023
1 parent 201d6e3 commit 5395074
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ module.exports = defineConfig({
'unicorn/prefer-array-some': 'off',
'unicorn/prefer-code-point': 'off',
'unicorn/prefer-export-from': 'off',
'unicorn/prefer-includes': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-native-coercion-functions': 'off',
'unicorn/prefer-negative-index': 'off',
Expand Down
2 changes: 1 addition & 1 deletion src/modules/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ export class SimpleHelpersModule {
}

while (range != null) {
if (range[0].indexOf('-') === -1) {
if (!range[0].includes('-')) {
// handle non-ranges
if (isCaseInsensitive && isNaN(Number(range[0]))) {
rangeCodes.push(
Expand Down
2 changes: 1 addition & 1 deletion src/modules/helpers/unique.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function exec<
const result: ReturnType<TMethod> = method(...args) as ReturnType<TMethod>;

// If the result has not been previously found, add it to the found array and return the value as it's unique.
if (compare(store, result) === -1 && exclude.indexOf(result) === -1) {
if (compare(store, result) === -1 && !exclude.includes(result)) {
store[result] = result;
options.currentIterations = 0;
return result;
Expand Down
6 changes: 3 additions & 3 deletions test/all_functional.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { describe, expect, it } from 'vitest';
import type { allLocales, Faker, RandomModule } from '../src';
import { allFakers, fakerEN } from '../src';

const IGNORED_MODULES = [
const IGNORED_MODULES = new Set([
'rawDefinitions',
'definitions',
'helpers',
'_randomizer',
'_defaultRefDate',
];
]);

function isTestableModule(mod: string) {
return IGNORED_MODULES.indexOf(mod) === -1;
return !IGNORED_MODULES.has(mod);
}

function isMethodOf(mod: string) {
Expand Down

0 comments on commit 5395074

Please sign in to comment.