Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .eslintrc

This file was deleted.

60 changes: 60 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier", // disable rules that are redundant with prettier
],
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
},
ignorePatterns: ["**/node_modules/**", "**/lib/**", "**/*.js"],
rules: {
"@typescript-eslint/no-shadow": ["error", { ignoreTypeValueShadow: true }],
"@typescript-eslint/explicit-module-boundary-types": "error",
"prefer-const": ["error", { destructuring: "all" }],

"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/camelcase": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/consistent-type-assertions": "off",
"import/namespace": "off",
"import/order": "warn",
"import/no-unresolved": "off",
"import/default": "off",
},
overrides: [
{
files: ["**/*.test.ts"],
rules: {
"no-restricted-properties": [
"error",
...["describe", "it", "test"]
.map((func) => [
{
object: func,
property: "only",
message: "Do not commit .only() tests",
},
{
object: func,
property: "skip",
message:
"Do not commit .skip() tests (disable this rule if needed)",
},
])
.flat(),
],
},
},
],
};
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' }}
run: yarn syncpack:check

- run: yarn format:check
if: ${{ matrix.os == 'ubuntu-latest' }}

- run: yarn build

- run: yarn lint
if: ${{ matrix.os == 'ubuntu-latest' }}

- run: yarn format:check
if: ${{ matrix.os == 'ubuntu-latest' }}

- run: yarn test
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"request": "launch",
"program": "${workspaceRoot}/tools/debugTests.js",
"cwd": "${fileDirname}",
"args": ["--runInBand", "--watch", "${fileBasename}"],
"args": ["${fileBasename}"],
"sourceMaps": true,
"outputCapture": "std",
"console": "integratedTerminal"
Expand Down
46 changes: 46 additions & 0 deletions change/change-229f3af9-c39b-4355-be59-58895bb8bd4e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"changes": [
{
"type": "none",
"comment": "Simplify build script",
"packageName": "backfill",
"email": "elcraig@microsoft.com",
"dependentChangeType": "none"
},
{
"type": "patch",
"comment": "Move logic out of index file (no behavior change)",
"packageName": "backfill-cache",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "none",
"comment": "Simplify build script",
"packageName": "backfill-config",
"email": "elcraig@microsoft.com",
"dependentChangeType": "none"
},
{
"type": "minor",
"comment": "Improve internal structure and remove excess exports. If you were using exports besides Hasher, please file an issue.",
"packageName": "backfill-hasher",
"email": "elcraig@microsoft.com",
"dependentChangeType": "patch"
},
{
"type": "none",
"comment": "Simplify build script",
"packageName": "backfill-logger",
"email": "elcraig@microsoft.com",
"dependentChangeType": "none"
},
{
"type": "none",
"comment": "Simplify build script",
"packageName": "backfill-utils-dotenv",
"email": "elcraig@microsoft.com",
"dependentChangeType": "none"
}
]
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"**/@azure/core-util": "~1.12.0",
"**/@azure/core-xml": "~1.4.5",
"**/@azure/logger": "~1.2.0",
"**/syncpack/minimatch": "^6.0.0",
"**/cache-base/union-value/set-value": "^2.0.0"
},
"devDependencies": {
Expand Down Expand Up @@ -74,11 +75,14 @@
},
"rationale": {
"resolutions": {
"@azure/*": "Node 18 compatibility"
"@azure/*": "Node 18 compatibility",
"syncpack/minimatch": "Unpin minimatch due to security issue. Should match original major version."
}
},
"syncpack": {
"peer": false,
"prod": true,
"dev": true,
"peer": true,
"workspace": false,
"resolutions": false
}
Expand Down
5 changes: 2 additions & 3 deletions packages/backfill/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"backfill": "./bin/backfill.js"
},
"scripts": {
"build": "yarn compile",
"compile": "tsc -b",
"build": "tsc -b --pretty",
"test": "jest",
"watch": "tsc -b -w"
},
Expand All @@ -33,7 +32,7 @@
"yargs": "^16.1.1"
},
"devDependencies": {
"@types/fs-extra": "^9.0.13",
"@types/fs-extra": "^8.0.0",
"@types/jest": "^30.0.0",
"@types/node": "^14.18.36",
"@types/yargs": "^15.0.15",
Expand Down
13 changes: 9 additions & 4 deletions packages/backfill/src/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ import { makeLogger } from "backfill-logger";

import { createBuildCommand } from "../commandRunner";

const logger = makeLogger("mute");
const muteLogger = makeLogger("mute");

describe("createBuildCommand", () => {
it("runs a command successfully", async () => {
const buildCommand = createBuildCommand(["echo foo"], false, [""], logger);
const buildCommand = createBuildCommand(
["echo foo"],
false,
[""],
muteLogger
);

const buildResult = await buildCommand();

Expand All @@ -20,7 +25,7 @@ describe("createBuildCommand", () => {
});

it("resolves if no command can be found", async () => {
const buildCommand = createBuildCommand([""], false, [""], logger);
const buildCommand = createBuildCommand([""], false, [""], muteLogger);

await expect(buildCommand()).rejects.toThrow("Command not provided");
});
Expand Down Expand Up @@ -65,7 +70,7 @@ describe("createBuildCommand", () => {
["echo foo"],
true,
[path.join(fixtureLocation, "lib/**").replace(/\\/g, "/")],
logger
muteLogger
);

const index_js_ExistsBeforeBuild = await fs.pathExists(
Expand Down
2 changes: 1 addition & 1 deletion packages/backfill/src/__tests__/helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from "path";
import findUp from "find-up";

export async function findPathToBackfill() {
export async function findPathToBackfill(): Promise<string> {
const commandPath = await findUp(path.join("bin", "backfill.js"), {
cwd: __dirname,
});
Expand Down
3 changes: 1 addition & 2 deletions packages/backfill/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ export async function fetch(
cwd,
incrementalCaching
);
const fetch = await cacheStorage.fetch(hash);
return fetch;
return await cacheStorage.fetch(hash);
}

export async function put(
Expand Down
4 changes: 2 additions & 2 deletions packages/backfill/src/audit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function initializeWatcher(
logFolder: string,
outputGlob: string[],
logger: Logger
) {
): void {
// Trying to find the git root and using it as an approximation of code boundary
const repositoryRoot = getGitRepositoryRoot(packageRoot);

Expand Down Expand Up @@ -95,7 +95,7 @@ async function delay(time: number) {
});
}

export async function closeWatcher(logger: Logger) {
export async function closeWatcher(logger: Logger): Promise<void> {
// Wait for one second before closing, giving time for file changes to propagate
await delay(1000);

Expand Down
5 changes: 2 additions & 3 deletions packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
},
"main": "lib/index.js",
"scripts": {
"build": "yarn compile",
"compile": "tsc -b",
"build": "tsc -b --pretty",
"test": "jest",
"watch": "tsc -b -w"
},
Expand All @@ -26,7 +25,7 @@
"tar-fs": "^2.1.0"
},
"devDependencies": {
"@types/fs-extra": "^9.0.13",
"@types/fs-extra": "^8.0.0",
"@types/jest": "^30.0.0",
"@types/node": "^14.18.36",
"@types/tar-fs": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/NpmCacheStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class NpmCacheStorage extends CacheStorage {
return true;
}

protected async _put(hash: string, filesToCache: string[]) {
protected async _put(hash: string, filesToCache: string[]): Promise<void> {
const { npmPackageName, registryUrl, npmrcUserconfig } = this.options;

const temporaryNpmOutputFolder = path.resolve(
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/src/__tests__/LocalCacheStorage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { makeLogger } from "backfill-logger";
import { setupFixture } from "backfill-utils-test";
import { CacheStorageConfig } from "backfill-config";

import { getCacheStorageProvider } from "../index";
import { getCacheStorageProvider } from "../getCacheStorageProvider";

const setupCacheStorage = async (fixtureName: string) => {
const fixtureLocation = await setupFixture(fixtureName);
Expand Down
3 changes: 2 additions & 1 deletion packages/cache/src/__tests__/getCacheStorageProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Logger, makeLogger } from "backfill-logger";
import { getCacheStorageProvider, ICacheStorage } from "..";
import { getCacheStorageProvider } from "../getCacheStorageProvider";
import type { ICacheStorage } from "../CacheStorage";
import { AzureBlobCacheStorage } from "../AzureBlobCacheStorage";
import { LocalCacheStorage } from "../LocalCacheStorage";

Expand Down
Loading