Skip to content

Commit

Permalink
Merge pull request #2169 from zowe/enable-deprecation-linter
Browse files Browse the repository at this point in the history
Remove use of deprecated utils functions & Enable deprecation linter
  • Loading branch information
awharn authored Jun 17, 2024
2 parents 7d4bc7c + bf8d8ad commit 38ac81f
Show file tree
Hide file tree
Showing 207 changed files with 902 additions and 741 deletions.
7 changes: 5 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module.exports = {
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"plugin:deprecation/recommended"
],
"ignorePatterns": [
"**/*.js",
Expand Down Expand Up @@ -37,7 +38,8 @@ module.exports = {
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
"sourceType": "module",
"project": ["./tsconfig.json", "./__tests__/tsconfig.json"]
},
"plugins": [
"@typescript-eslint",
Expand All @@ -47,6 +49,7 @@ module.exports = {
"rules": {
"max-len": ["warn", 150],
"no-console": "error",
"no-extra-parens": "error",
"no-multiple-empty-lines": "warn",
"no-trailing-spaces": "warn",
"@typescript-eslint/ban-types": "off",
Expand Down
7 changes: 7 additions & 0 deletions .madgerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"detectiveOptions": {
"ts": {
"skipTypeImports": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/* eslint-disable max-len */

describe("Imperative Secure Tests", () => {
require("./../../packages/imperative/__tests__/src/packages/imperative/__integration__/ConfigLoading.integration.subtest");
require("./../../packages/imperative/__tests__/src/packages/imperative/__integration__/PluginManagementFacility.integration.subtest");
require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/init/cli.imperative-test-cli.config.init.integration.subtest");
require("./../../packages/imperative/__tests__/__integration__/imperative/__tests__/__integration__/cli/config/auto-init/imperative.test.cli.config.auto-init.fruit.integration.subtest");
Expand Down
2 changes: 1 addition & 1 deletion __tests__/__packages__/cli-test-utils/src/TestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function mockHandlerParameters(params: PartialHandlerParameters): IHandle
arguments: {
$0: "zowe",
_: params.positionals || [],
...(params.arguments || {})
...params.arguments || {}
},
positionals: params.positionals || [],
profiles: params.profiles || new CommandProfiles(new Map()),
Expand Down
172 changes: 166 additions & 6 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
"installWithBuild": "npm install && npm run build",
"checkTestsCompile": "echo \"Checking that test source compiles...\" && tsc --project __tests__/tsconfig.json --noEmit",
"circularDependencyCheck": "lerna run --parallel circularDependencyCheck -- --warning --no-spinner",
"lint": "eslint \"packages/**/*.ts\" \"**/__tests__/**/*.ts\"",
"lint:packages": "eslint \"packages/**/*.ts\" --ignore-pattern \"**/__tests__/**/*.ts\"",
"lint:tests": "eslint \"**/__tests__/**/*.ts\"",
"lint": "lerna run lint --parallel --no-bail",
"lint:packages": "lerna run lint:packages --parallel --no-bail",
"lint:series": "lerna run lint --no-bail",
"lint:tests": "lerna run lint:tests --parallel --no-bail",
"test": "npm run test:unit && npm run test:integration && npm run test:system",
"test:act": "node scripts/testCliWorkflow.js",
"test:cleanResults": "rimraf __tests__/__results__",
Expand Down Expand Up @@ -55,6 +56,7 @@
"chalk": "^4.1.0",
"env-cmd": "^10.1.0",
"eslint": "^8.22.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-jest": "^27.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
"fancy-log": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ describe("Zowe daemon suite", () => {
});

// run all of our daemon-related tests
require("./cli.zowe.exe.integration");
require("./enable/cli.daemon.enable.integration");
require("./disable/cli.daemon.disable.integration");
require("./restart/cli.daemon.restart.integration");
require("./cli.zowe.exe.integration.subtest");
require("./enable/cli.daemon.enable.integration.subtest");
require("./disable/cli.daemon.disable.integration.subtest");
require("./restart/cli.daemon.restart.integration.subtest");
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe("provisioning list instance-info", () => {
instanceID = instance["object-id"];
instanceName = instance["external-name"];
Imperative.console.info(`Provisioned instance: ${instanceName}`);
if (instanceID == null) { throw Error("Cannot continue test - instance ID is undefined"); }
}, ProvisioningTestUtils.MAX_TIMEOUT_TIME);

it(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe("provisioning list instance-variables", () => {
instance = await ProvisioningTestUtils.getProvisionedInstance(REAL_SESSION, ProvisioningConstants.ZOSMF_VERSION, templateName);
instanceID = instance["object-id"];
Imperative.console.info(`Provisioned instance: ${instance["external-name"]}`);
if (instanceID == null) { throw Error("Cannot continue test - instance ID is undefined"); }
}, ProvisioningTestUtils.MAX_TIMEOUT_TIME);

it("should display instance info(expects first instance in registry to have variables)", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe("provisioning perform action", () => {
instanceID = instance["object-id"];
instanceName = instance["external-name"];
Imperative.console.info(`Provisioned instance: ${instanceName}`);
if (instanceID == null) { throw Error("Cannot continue test - instance ID is undefined"); }
}, ProvisioningTestUtils.MAX_TIMEOUT_TIME);

it("should successfully perform checkStatus action", async () => {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/__tests__/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"include": [
"**/*.test.ts",
"**/*.subtest.ts",
"**/__tests__/**/*"
],
"exclude": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe("View uss file", () => {
await ZosmfRestClient.putExpectString(REAL_SESSION, endpoint, [], data);

const shellScript = path.join(__dirname, "__scripts__", "command", "command_view_uss_file.sh");
const response = runCliScript(shellScript, testEnvironment, [ussname.substr(1, ussname.length)]);
const response = runCliScript(shellScript, testEnvironment, [ussname.substring(1, ussname.length)]);

expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
Expand All @@ -90,7 +90,7 @@ describe("View uss file", () => {
await ZosmfRestClient.putExpectString(REAL_SESSION, endpoint, [ZosmfHeaders.X_IBM_BINARY], data);

const shellScript = path.join(__dirname, "__scripts__", "command", "command_view_uss_file.sh");
const response = runCliScript(shellScript, testEnvironment, [ussname.substr(1, ussname.length), "--binary"]);
const response = runCliScript(shellScript, testEnvironment, [ussname.substring(1, ussname.length), "--binary"]);

expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
Expand All @@ -102,7 +102,7 @@ describe("View uss file", () => {
await Upload.bufferToUssFile(REAL_SESSION, ussname, Buffer.from(data), { binary: true });

const shellScript = path.join(__dirname, "__scripts__", "command", "command_view_uss_file.sh");
const response = runCliScript(shellScript, testEnvironment, [ussname.substr(1, ussname.length), "--binary"]);
const response = runCliScript(shellScript, testEnvironment, [ussname.substring(1, ussname.length), "--binary"]);
const respdata = response.stdout.toLocaleString();

expect(response.stderr.toString()).toBe("");
Expand All @@ -115,7 +115,7 @@ describe("View uss file", () => {
await ZosmfRestClient.putExpectString(REAL_SESSION, endpoint, [], data);

const shellScript = path.join(__dirname, "__scripts__", "command", "command_view_uss_file.sh");
const response = runCliScript(shellScript, testEnvironment, [ussname.substr(1, ussname.length), "--range", "0,1"]);
const response = runCliScript(shellScript, testEnvironment, [ussname.substring(1, ussname.length), "--range", "0,1"]);

expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("zos-jobs list jobs command", () => {

ACCOUNT = systemProps.tso.account;
const JOB_LENGTH = 6;
JOB_NAME = REAL_SESSION.ISession.user.substr(0, JOB_LENGTH).toUpperCase() + "SF";
JOB_NAME = REAL_SESSION.ISession.user.substring(0, JOB_LENGTH).toUpperCase() + "SF";
NON_HELD_JOBCLASS = TEST_ENVIRONMENT.systemTestProperties.zosjobs.jobclass;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("zos-jobs list spool-files-by-jobid command", () => {

ACCOUNT = defaultSystem.tso.account;
const JOB_LENGTH = 6;
JOB_NAME = REAL_SESSION.ISession.user.substr(0, JOB_LENGTH).toUpperCase() + "SF";
JOB_NAME = REAL_SESSION.ISession.user.substring(0, JOB_LENGTH).toUpperCase() + "SF";
NON_HELD_JOBCLASS = TEST_ENVIRONMENT.systemTestProperties.zosjobs.jobclass;
});

Expand Down
Loading

0 comments on commit 38ac81f

Please sign in to comment.