Skip to content

Commit

Permalink
chore: upgrade lintroll
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Aug 29, 2024
1 parent 6aa9e1a commit 6d497e1
Show file tree
Hide file tree
Showing 14 changed files with 535 additions and 438 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"default": "./dist/index.mjs"
}
},
"packageManager": "[email protected]",
"scripts": {
"lint": "lintroll --cache --node --ignore-pattern tests/fixtures .",
"build": "pkgroll --minify --target node12.20",
Expand All @@ -59,13 +60,12 @@
"fs-fixture": "^2.4.0",
"is-fs-case-sensitive": "^1.0.0",
"jsonc-parser": "^3.2.1",
"lintroll": "^1.6.1",
"lintroll": "^1.8.1",
"manten": "^1.3.0",
"pkgroll": "^2.4.2",
"slash": "^5.1.0",
"tsx": "^4.19.0",
"type-fest": "^4.20.1",
"typescript": "~5.5.4"
},
"packageManager": "[email protected]"
}
}
929 changes: 513 additions & 416 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/files-matcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import slash from 'slash';
import type { TsConfigJson } from 'type-fest';
import { isFsCaseSensitive } from 'is-fs-case-sensitive';
Expand Down Expand Up @@ -56,7 +56,7 @@ const getDefaultExcludeSpec = (
return excludesSpec;
};

const escapeForRegexp = (string: string) => string.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&');
const escapeForRegexp = (string: string) => string.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);

const dependencyDirectories = ['node_modules', 'bower_components', 'jspm_packages'] as const;
const implicitExcludePathRegexPattern = `(?!(${dependencyDirectories.join('|')})(/|$))`;
Expand Down Expand Up @@ -129,13 +129,13 @@ export const createFilesMatcher = (
const projectFilePathPattern = escapeForRegexp(projectFilePath)

// Replace **/
.replaceAll('\\*\\*/', '(.+/)?')
.replaceAll(String.raw`\*\*/`, '(.+/)?')

// Replace *
.replaceAll('\\*', `${anyCharacter}*`)
.replaceAll(String.raw`\*`, `${anyCharacter}*`)

// Replace ?
.replaceAll('\\?', anyCharacter);
.replaceAll(String.raw`\?`, anyCharacter);

return new RegExp(
`^${projectFilePathPattern}($|/)`,
Expand All @@ -157,7 +157,7 @@ export const createFilesMatcher = (
const projectFilePathPattern = escapeForRegexp(projectFilePath)

// Replace /**
.replaceAll('/\\*\\*', `(/${implicitExcludePathRegexPattern}${noPeriodOrSlash}${anyCharacter}*)*?`)
.replaceAll(String.raw`/\*\*`, `(/${implicitExcludePathRegexPattern}${noPeriodOrSlash}${anyCharacter}*)*?`)

// Replace *
.replaceAll(/(\/)?\\\*/g, (_, hasSlash) => {
Expand Down
2 changes: 1 addition & 1 deletion src/parse-tsconfig/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import slash from 'slash';
import type { TsConfigJson, TsConfigJsonResolved, Cache } from '../types.js';
import { normalizePath } from '../utils/normalize-path.js';
Expand Down
4 changes: 2 additions & 2 deletions src/parse-tsconfig/resolve-extends-path.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import Module from 'module';
import path from 'node:path';
import Module from 'node:module';
import { resolveExports } from 'resolve-pkg-maps';
import type { PackageJson } from 'type-fest';
import { findUp } from '../utils/find-up.js';
Expand Down
2 changes: 1 addition & 1 deletion src/paths-matcher/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import slash from 'slash';
import type { TsConfigResult } from '../types.js';
import { isRelativePathPattern } from '../utils/is-relative-path-pattern.js';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/find-up.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import type { Cache } from '../types.js';
import { exists } from './fs-cached.js';

Expand Down
2 changes: 1 addition & 1 deletion src/utils/fs-cached.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from 'fs';
import fs from 'node:fs';
import type { Cache } from '../types.js';

type Fs = typeof fs;
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/create-files-matcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import { expect, testSuite } from 'manten';
import slash from 'slash';
import { createFixture } from 'fs-fixture';
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/get-tsconfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import { testSuite, expect } from 'manten';
import { createFixture } from 'fs-fixture';
import slash from 'slash';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import { testSuite, expect } from 'manten';
import { createFixture } from 'fs-fixture';
import { execaNode } from 'execa';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import { testSuite, expect } from 'manten';
import { createFixture } from 'fs-fixture';
import { createTsconfigJson, getTscTsconfig, createPackageJson } from '../../../../utils.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path';
import path from 'node:path';
import { testSuite, expect } from 'manten';
import { createFixture } from 'fs-fixture';
import { createTsconfigJson, getTscTsconfig } from '../../../../utils.js';
Expand Down
4 changes: 2 additions & 2 deletions tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'path';
import { promises as fs } from 'fs';
import path from 'node:path';
import { promises as fs } from 'node:fs';
import { execa } from 'execa';
import type { TsConfigJson, PackageJson } from 'type-fest';

Expand Down

0 comments on commit 6d497e1

Please sign in to comment.