Skip to content

Commit

Permalink
fix linting error
Browse files Browse the repository at this point in the history
Signed-off-by: Himani1519 <[email protected]>
  • Loading branch information
Himani1519 committed Nov 7, 2023
1 parent c221053 commit 64f2ad5
Show file tree
Hide file tree
Showing 11 changed files with 4,871 additions and 83 deletions.
40 changes: 40 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
This program and the accompanying materials are
made available under the terms of the Eclipse Public License v2.0 which accompanies
this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
*/

module.exports = {
env: {
browser: true,
es6: true,
node: true
},
ignorePatterns: ['.github/**/*.yml', '**/.build', '**/build', '**/dist', '**/node_modules', '**/release'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript'
],
parser: '@typescript-eslint/parser',
plugins: ['header'],
rules: {
'header/header': [
2,
'block',
[
'\n This program and the accompanying materials are' +
'\n made available under the terms of the Eclipse Public License v2.0 which accompanies' +
'\n this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html' +
'\n \n SPDX-License-Identifier: EPL-2.0\n \n Copyright Contributors to the Zowe Project.\n'
],
2,
],
},
}
26 changes: 26 additions & 0 deletions .github/workflows/test-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint TypeScript

on:
push:
branches:
- v2.x/staging
pull_request:
types: [opened, reopened, synchronize]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install Dependencies
run: npm ci

- name: Lint TypeScript
run: npm run lint
8 changes: 5 additions & 3 deletions bin/init/plugins-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
This program and the accompanying materials are
made available under the terms of the Eclipse Public License v2.0 which accompanies
this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
*/

import * as os from 'os';
import * as zos from 'zos';
// import * as zos from 'zos';
import * as std from 'std';
/* eslint-disable import/no-unresolved */
import * as xplatform from 'xplatform';
import * as fs from '../../../../../../bin/libs/fs';
import * as common from '../../../../../../bin/libs/common';
import * as componentlib from '../../../../../../bin/libs/component';
import { PathAPI as pathoid } from '../../../../../../bin/libs/pathoid';
/* eslint-disable import/no-unresolved */

common.printFormattedDebug("ZWED", "plugins-init", `Started plugins-init.js, platform=${os.platform}`);

Expand Down
20 changes: 10 additions & 10 deletions lib/initInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
Copyright Contributors to the Zowe Project.
*/

const fs = require('fs');
const path = require('path');
const argParser = require('../../zlux-server-framework/utils/argumentParser');
const mergeUtils = require('../../zlux-server-framework/utils/mergeUtils');
const yamlConfig = require('../../zlux-server-framework/utils/yamlConfig');
const initUtils = require('./initUtils');
import fs from 'fs';

Check failure on line 11 in lib/initInstance.js

View workflow job for this annotation

GitHub Actions / lint

incorrect header
import path from 'path';
import argParser from '../../zlux-server-framework/utils/argumentParser';

Check failure on line 13 in lib/initInstance.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '../../zlux-server-framework/utils/argumentParser'
import mergeUtils from '../../zlux-server-framework/utils/mergeUtils';

Check failure on line 14 in lib/initInstance.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '../../zlux-server-framework/utils/mergeUtils'
import { yamlConfig } from '../../zlux-server-framework/utils/yamlConfig';

Check failure on line 15 in lib/initInstance.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '../../zlux-server-framework/utils/yamlConfig'
import {initUtils } from './initUtils';
//const upgradeInstance = require('./upgradeInstance');
const os = require('os');
const ncp = require('ncp').ncp;
const { execSync } = require('child_process');
const mkdirp = require('mkdirp');
import * as os from 'os';
import * as ncp from 'ncp';
import { execSync } from 'child_process';
import * as mkdirp from 'mkdirp';


const haInstanceId = yamlConfig.getCurrentHaInstanceId();
Expand Down
6 changes: 3 additions & 3 deletions lib/initUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
Copyright Contributors to the Zowe Project.
*/

const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
import fs from 'fs';

Check failure on line 11 in lib/initUtils.js

View workflow job for this annotation

GitHub Actions / lint

incorrect header
import path from 'path';
import mkdirp from 'mkdirp';

const ZLUX_ROOT_DIR = path.join(__dirname, '..');
const DEFAULT_PLUGINS_DIR = path.join(ZLUX_ROOT_DIR, 'defaults', 'plugins');
Expand Down
17 changes: 12 additions & 5 deletions lib/upgradeInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
Copyright Contributors to the Zowe Project.
*/
const fs = require('fs');
const path = require('path');
const semver = require('semver');
const argParser = require('zlux-server-framework/utils/argumentParser');
const initUtils = require('./initUtils');

import * as fs from 'fs';

Check failure on line 11 in lib/upgradeInstance.js

View workflow job for this annotation

GitHub Actions / lint

incorrect header
import * as path from 'path';
import * as semver from 'semver';
import { argParser } from '../../zlux-server-framework/utils/argumentParser';

Check failure on line 14 in lib/upgradeInstance.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '../../zlux-server-framework/utils/argumentParser'
import { initUtils } from './initUtils';

function logPluginFailure(pluginId) {
console.warn('ZWED0157E - Could not register default plugin %s into app-server', pluginId);
Expand Down Expand Up @@ -142,10 +143,13 @@ const versions = [
const pluginPath = path.join(toLocation, 'plugins', file);
const pluginJson = JSON.parse(fs.readFileSync(pluginPath, 'utf8'));
let index, componentIndex, componentsIndex, relativeIndex;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
index = componentsIndex = pluginJson.pluginLocation.indexOf('components/app-server');
if (index == -1) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
index = relativeIndex = pluginJson.pluginLocation.startsWith('../../') ? 6 : -1;
if (index == -1 && isContainer) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
index = componentIndex = pluginJson.pluginLocation.startsWith('/component/share/') ? 17 : -1;
}
}
Expand Down Expand Up @@ -177,6 +181,7 @@ const versions = [
},
{
v: '1.21.0',
// eslint-disable-next-line @typescript-eslint/no-unused-vars
upgrade: function(toLocation, serverConfig, envConfig, instanceItems) {
if (serverConfig.agent && !serverConfig.agent.mediationLayer) {
serverConfig.agent.mediationLayer = {
Expand Down Expand Up @@ -235,8 +240,10 @@ module.exports.doUpgrade = function doUpgrade(fromVersion, toLocation, serverCon
console.log('app-server config upgraded to version='+upgradedTo);
}
if (configNeedsUpdate) {
// eslint-disable-next-line no-unsafe-finally
return {upgradedTo, serverConfig};
} else {
// eslint-disable-next-line no-unsafe-finally
return {upgradedTo};
}
}
Expand Down
17 changes: 9 additions & 8 deletions lib/zluxArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
*/

'use strict';

Check failure on line 13 in lib/zluxArgs.js

View workflow job for this annotation

GitHub Actions / lint

missing header
const ProxyServer = require('zlux-server-framework');
const argParser = require('zlux-server-framework/utils/argumentParser');
const jsonUtils = require('zlux-server-framework/lib/jsonUtils');
const mergeUtils = require('zlux-server-framework/utils/mergeUtils');
const yamlConfig = require('zlux-server-framework/utils/yamlConfig');
const mkdirp = require('mkdirp');
const cluster = require('cluster');
//const ProxyServer = require('zlux-server-framework');
import { argParser } from '../../zlux-server-framework/utils/argumentParser';

Check failure on line 15 in lib/zluxArgs.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '../../zlux-server-framework/utils/argumentParser'
//const jsonUtils = require('zlux-server-framework/lib/jsonUtils');
import { mergeUtils } from '../../zlux-server-framework/utils/mergeUtils';

Check failure on line 17 in lib/zluxArgs.js

View workflow job for this annotation

GitHub Actions / lint

Unable to resolve path to module '../../zlux-server-framework/utils/mergeUtils'
import { yamlConfig } from '../../zlux-server-framework/utils/yamlConfig';
//const mkdirp = require('mkdirp');
import cluster from 'cluster';

const MVD_ARGS = [
new argParser.CLIArgument(null, 'D', argParser.constants.ARG_TYPE_JSON),
Expand Down Expand Up @@ -54,7 +54,8 @@ function getSafeToPrintEnvironment(env) {
//Env overrides config JSON, -D args override env
if(process.env.overrideFileConfig !== "false"){
if (cluster.isMaster) {
const safeEnvironment = getSafeToPrintEnvironment(process.env);
// const safeEnvironment =
getSafeToPrintEnvironment(process.env);
console.log('\nZWED5014I - Processing CLI arguments:\n'+commandArgs);
}
const envConfig = argParser.environmentVarsToObject("ZWED_");
Expand Down
4 changes: 2 additions & 2 deletions lib/zluxCluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/
'use strict';

const clusterManager = require('zlux-server-framework/lib/clusterManager').clusterManager;
const {configJSON, configLocation} = require('./zluxArgs')();
import { clusterManager } from '../../zlux-server-framework/lib/clusterManager';
import { configJSON, configLocation } from './zluxArgs';

clusterManager.start(configJSON, configLocation);

Expand Down
8 changes: 4 additions & 4 deletions lib/zluxServer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


/*
This program and the accompanying materials are
made available under the terms of the Eclipse Public License v2.0 which accompanies
Expand All @@ -11,9 +9,11 @@
*/

'use strict';
const ProxyServer = require('zlux-server-framework');
import { ProxyServer } from '../../zlux-server-framework';
// const ProxyServer = require('zlux-server-framework');

const {configJSON, configLocation} = require('./zluxArgs')();
import { zluxArgs } from './zluxArgs';
const { configJSON, configLocation } = zluxArgs();
const proxyServer = new ProxyServer(configJSON, configLocation);
proxyServer.start().then(() => {
console.log("ZWED5019I - Started")
Expand Down
Loading

0 comments on commit 64f2ad5

Please sign in to comment.