Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 11, 2024
1 parent af5d139 commit a85078e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
16 changes: 14 additions & 2 deletions ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ const normalizeOptions = (options = {}) => ({
export const isIgnoredByIgnoreFiles = async (patterns, options) => {
const {cwd, suppressErrors, deep, ignore} = normalizeOptions(options);

const paths = await fastGlob(patterns, {cwd, suppressErrors, deep, ignore, ...ignoreFilesGlobOptions});
const paths = await fastGlob(patterns, {
cwd,
suppressErrors,
deep,
ignore,
...ignoreFilesGlobOptions,
});

const files = await Promise.all(
paths.map(async filePath => ({
Expand All @@ -83,7 +89,13 @@ export const isIgnoredByIgnoreFiles = async (patterns, options) => {
export const isIgnoredByIgnoreFilesSync = (patterns, options) => {
const {cwd, suppressErrors, deep, ignore} = normalizeOptions(options);

const paths = fastGlob.sync(patterns, {cwd, suppressErrors, deep, ignore, ...ignoreFilesGlobOptions});
const paths = fastGlob.sync(patterns, {
cwd,
suppressErrors,
deep,
ignore,
...ignoreFilesGlobOptions,
});

const files = paths.map(filePath => ({
filePath,
Expand Down
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type FastGlob from 'fast-glob';
import {type Options as FastGlobOptions, type Entry} from 'fast-glob';
import type FastGlob from 'fast-glob'; // eslint-disable-line import/no-duplicates
import {type Options as FastGlobOptions, type Entry} from 'fast-glob'; // eslint-disable-line import/no-duplicates

export type GlobEntry = Entry;

Expand Down
2 changes: 1 addition & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ expectType<NodeJS.ReadableStream>(globbyStream('*.tmp', {ignore: ['**/b.tmp']}))

// `NodeJS.ReadableStream` is not generic, unfortunately,
// so it seems `(string | Buffer)[]` is the best we can get here
expectType<Array<string | Buffer>>(streamResult);
expectType<Array<string | Buffer>>(streamResult); // eslint-disable-line @typescript-eslint/ban-types
})();

// GenerateGlobTasks
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"git"
],
"dependencies": {
"@sindresorhus/merge-streams": "^1.0.0",
"@sindresorhus/merge-streams": "^2.1.0",
"fast-glob": "^3.3.2",
"ignore": "^5.2.4",
"path-type": "^5.0.0",
Expand All @@ -77,8 +77,8 @@
"benchmark": "2.1.4",
"glob-stream": "^8.0.0",
"tempy": "^3.1.0",
"tsd": "^0.29.0",
"xo": "^0.56.0"
"tsd": "^0.30.4",
"xo": "^0.57.0"
},
"xo": {
"ignores": [
Expand Down
12 changes: 6 additions & 6 deletions tests/ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import {
getPathValues,
} from './utilities.js';

const runIsIgnoredByIgnoreFiles = async (t, patterns, options, fn) => {
const runIsIgnoredByIgnoreFiles = async (t, patterns, options, function_) => {
const promisePredicate = await isIgnoredByIgnoreFiles(patterns, options);
const syncPredicate = isIgnoredByIgnoreFilesSync(patterns, options);

const promiseResult = fn(promisePredicate);
const syncResult = fn(syncPredicate);
const promiseResult = function_(promisePredicate);
const syncResult = function_(syncPredicate);

t[Array.isArray(promiseResult) ? 'deepEqual' : 'is'](
promiseResult,
Expand All @@ -29,12 +29,12 @@ const runIsIgnoredByIgnoreFiles = async (t, patterns, options, fn) => {
return promiseResult;
};

const runIsGitIgnored = async (t, options, fn) => {
const runIsGitIgnored = async (t, options, function_) => {
const promisePredicate = await isGitIgnored(options);
const syncPredicate = isGitIgnoredSync(options);

const promiseResult = fn(promisePredicate);
const syncResult = fn(syncPredicate);
const promiseResult = function_(promisePredicate);
const syncResult = function_(syncPredicate);

t[Array.isArray(promiseResult) ? 'deepEqual' : 'is'](
promiseResult,
Expand Down

0 comments on commit a85078e

Please sign in to comment.