Skip to content

Commit

Permalink
Fixed lint errors and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmcmaster committed Aug 29, 2024
1 parent 4bc123e commit 83cbb67
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 22 deletions.
1 change: 0 additions & 1 deletion agent/src/pewpewtest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ export class PewPewTest {
}

// Create a sanitized copy which doesn't have the environment variables which may have passwords
// eslint-disable-next-line @typescript-eslint/ban-types
public sanitizedCopy (): {
started: boolean,
pewpewRunning: boolean,
Expand Down
2 changes: 1 addition & 1 deletion common/integration/s3.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe("S3Util Integration", () => {
`${UNIT_TEST_KEY_PREFIX}/${UNIT_TEST_KEY_PREFIX}/${UNIT_TEST_FILENAME}`
].map((s3Path: string) => deleteObject(s3Path).catch((error) =>
log("S3Util Integration before delete failed: " + s3Path, LogLevel.DEBUG, error))));
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// Swallow
}
});
Expand Down
2 changes: 1 addition & 1 deletion common/src/ppaastestmessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class PpaasTestMessage implements TestMessage {
case "TestMessage":
try {
parsedTestMessage = temp as TestMessage;
} catch (error: unknown) {
} catch (error: unknown) { // eslint-disable-line @typescript-eslint/no-unused-vars
throw new Error(`messageAttributes[${key}] was not an TestMessage = ${JSON.stringify(temp)}`);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion common/src/s3file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class PpaasS3File implements S3File {
try {
await access(this.localFilePath);
return true;
} catch (error: unknown) {
} catch (error: unknown) { // eslint-disable-line @typescript-eslint/no-unused-vars
return false;
}
}
Expand Down
2 changes: 0 additions & 2 deletions common/test/yamlparser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { expect } from "chai";
import path from "path";

const UNIT_TEST_FOLDER = process.env.UNIT_TEST_FOLDER || "test";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const BAD_FILEPATH = path.join(UNIT_TEST_FOLDER, "s3test.txt");
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const EMPTY_FILEPATH = path.join(UNIT_TEST_FOLDER, "empty.yaml");
const BASIC_FILEPATH = path.join(UNIT_TEST_FOLDER, "basic.yaml");
const BASIC_FILEPATH_WITH_VARS = path.join(UNIT_TEST_FOLDER, "basicwithvars.yaml");
Expand Down
2 changes: 1 addition & 1 deletion controller/components/StartTestForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const UploadTestButton = styled.button`
const notAuthorizedMessageOpenId = (username?: string | null): JSX.Element => <Info>
<Column>
<p>
{`'${username}'` || "User"} is not authorized to run tests.<br/>
{username ? `'${username}'` : "User"} is not authorized to run tests.<br/>
Please request 'Pewpew - User' permission if you need to be able to run tests.
</p>
<Warning>DO NOT request 'Non Prod' Permissions. Those are for internal authentication testing only.</Warning>
Expand Down
2 changes: 1 addition & 1 deletion controller/components/StartTestForm/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const versionInitalProps: VersionInitalProps = {
let ppaasTestId: PpaasTestId;
try {
ppaasTestId = PpaasTestId.makeTestId("Story");
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// For some reason newer versions of storybook do not have path.extname()
ppaasTestId = PpaasTestId.getFromS3Folder("Story/" + PpaasTestId.getDateString());
}
Expand Down
2 changes: 1 addition & 1 deletion controller/components/TestInfo/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { latestPewPewVersion } from "../../pages/api/util/clientutil";
let ppaasTestId: PpaasTestId;
try {
ppaasTestId = PpaasTestId.makeTestId("Story");
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// For some reason newer versions of storybook do not have path.extname()
ppaasTestId = PpaasTestId.getFromS3Folder("Story/" + PpaasTestId.getDateString());
}
Expand Down
2 changes: 1 addition & 1 deletion controller/components/TestResults/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const minMaxTime = (testResults: any) => {
let startTime2 = Infinity;
let endTime2 = -Infinity;

// eslint-disable-next-line @typescript-eslint/no-unused-vars

for (const [_, dataPoints] of testResults) {
for (const point of dataPoints) {
if (point.startTime) {
Expand Down
2 changes: 0 additions & 2 deletions controller/components/TestResults/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { HDRHistogram } from "@fs/hdr-histogram-wasm";
type CheckType = string | ((x: unknown) => boolean);
type Check = [string, CheckType];

// eslint-disable-next-line @typescript-eslint/ban-types
function isObject (o: unknown): o is object {
return typeof o === "object" && !!o;
}
Expand Down Expand Up @@ -53,7 +52,6 @@ function isObject (o: unknown): o is object {
* @returns failed check or undefined
*/
function propertyChecker (
// eslint-disable-next-line @typescript-eslint/ban-types
o: object,
requiredChecks: Check[],
unknownCheck?: CheckType,
Expand Down
2 changes: 1 addition & 1 deletion controller/components/TestResults/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ configureURL.baseS3Url = "/";
let ppaasTestId: PpaasTestId;
try {
ppaasTestId = PpaasTestId.makeTestId("Story");
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// For some reason newer versions of storybook do not have path.extname()
ppaasTestId = PpaasTestId.getFromS3Folder("Story/" + PpaasTestId.getDateString());
}
Expand Down
2 changes: 1 addition & 1 deletion controller/components/TestsList/story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const makeTestData = (status: TestStatus): TestData => {
ppaasTestId = PpaasTestId.makeTestId("Story" + counter, {
dateString: PpaasTestId.getDateString(date)
});
} catch (error) {
} catch (error) { // eslint-disable-line @typescript-eslint/no-unused-vars
// For some reason newer versions of storybook do not have path.extname()
ppaasTestId = PpaasTestId.getFromS3Folder(`Story${counter}/` + PpaasTestId.getDateString(date));
}
Expand Down
1 change: 0 additions & 1 deletion controller/integration/secrets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { expect } from "chai";
logger.config.LogFileName = "ppaas-controller";

describe("Secrets Integration", () => {
// eslint-disable-next-line require-await
before(async () => {
secretsConfig.secretsClient = undefined as any;
getGlobalSecretsConfig().encryptionKey = undefined;
Expand Down
4 changes: 2 additions & 2 deletions controller/pages/api/util/healthcheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function accessEncryptionKeyPass (): boolean {
log("accessEncryptionKeyPass", LogLevel.DEBUG, { keyPass });
return keyPass;
} catch (error) {
log("accessEncryptionKeyPass", LogLevel.WARN, { keyPass: false });
log("accessEncryptionKeyPass", LogLevel.WARN, error, { keyPass: false });
return false;
}
}
Expand All @@ -80,7 +80,7 @@ export function accessOpenIdSecretPass (): boolean {
log("accessOpenIdSecretPass", LogLevel.DEBUG, { secretPass });
return secretPass;
} catch (error) {
log("accessOpenIdSecretPass", LogLevel.WARN, { secretPass: false });
log("accessOpenIdSecretPass", LogLevel.WARN, error, { secretPass: false });
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion controller/pages/api/util/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function getS3Response ({ request, response, filename, s3Folder, re
}
if (s3Object && s3Object.Body) {
let content: GetObjectCommandOutput["Body"] | Buffer = s3Object.Body;
log("s3Object: " + s3Object, LogLevel.DEBUG, { ...s3Object, Body: content !== (undefined || null) });
log("s3Object: " + s3Object, LogLevel.DEBUG, { ...s3Object, Body: !!s3Object.Body });
// res.writeHead and res.send don't mix so we have to set each header separately
response.status(200);
response.setHeader("Content-Disposition", "inline");
Expand Down
2 changes: 1 addition & 1 deletion controller/pages/api/util/testmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export async function downloadPriorTestId (
fieldAdditionalFiles = parsedAdditionalFiles as string[];
}
} catch (error) {
log("Could not parse fieldAdditionalFiles: " + fieldAdditionalFiles, LogLevel.WARN, fieldAdditionalFiles);
log("Could not parse fieldAdditionalFiles: " + fieldAdditionalFiles, LogLevel.WARN, error, fieldAdditionalFiles);
}
}
additionalFileNames.push(...fieldAdditionalFiles);
Expand Down
2 changes: 1 addition & 1 deletion controller/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const TestStatusPage = ({
});
// Sanitized the search
const searchString = state.testIdSearch;
// eslint-disable-next-line no-useless-escape

if (!SEARCH_REGEX.test(searchString)) {
setState({
error: "Only Alphanumeric characters are allowed"
Expand Down
2 changes: 1 addition & 1 deletion controller/test/ppaasencryptenvfile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ describe("PpaasEncryptEnvironmentFile", () => {
expect(JSON.stringify(sanitizedCopy.getEnvironmentVariables()), "getEnvironmentVariables()").to.equal("{}");
done();
} catch (error) {
done();
done(error);
}
});

Expand Down
2 changes: 1 addition & 1 deletion controller/test/ppaasencrypts3file.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe("PpaasEncryptS3File", () => {
expect(sanitizedCopy.getFileContents(), "getFileContents()").to.equal(undefined);
done();
} catch (error) {
done();
done(error);
}
});

Expand Down
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default [{
"controller/storybook-static",
"controller/.storybook",
"controller/**/**.js",
"controller/next-env.d.t",
"eslint.config.mjs"
],
}, ...compat.extends(
Expand Down

0 comments on commit 83cbb67

Please sign in to comment.