Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fix linting #286

Closed
wants to merge 3 commits into from
Closed
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
40 changes: 40 additions & 0 deletions .eslintrc.js
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', '**/lib'],
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,
],
},
}
3 changes: 1 addition & 2 deletions .github/workflows/build-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,4 @@ jobs:
pax-name: zlux-core

- name: '[Prep 7] deploy'
uses: zowe-actions/zlux-builds/core/[email protected]/main

uses: zowe-actions/zlux-builds/core/[email protected]/main
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
16 changes: 8 additions & 8 deletions bin/init/plugins-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
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';
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';
import type { xplatform } from 'xplatform';
import type { fs } from '../../../../../../bin/libs/fs';
import type { common } from '../../../../../../bin/libs/common';
import type { componentlib } from '../../../../../../bin/libs/component';
import type { PathAPI as pathoid } from '../../../../../../bin/libs/pathoid';

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';
import path from 'path';
import type { argParser } from '../../zlux-server-framework/utils/argumentParser';
import type { mergeUtils } from '../../zlux-server-framework/utils/mergeUtils';
import type { yamlConfig } from '../../zlux-server-framework/utils/yamlConfig';
import type { 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 ncp from 'ncp';
import { execSync } from 'child_process';
import 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 * as fs from 'fs';
import * as path from 'path';
import * as mkdirp from 'mkdirp';

const ZLUX_ROOT_DIR = path.join(__dirname, '..');
const DEFAULT_PLUGINS_DIR = path.join(ZLUX_ROOT_DIR, 'defaults', 'plugins');
Expand Down
16 changes: 11 additions & 5 deletions lib/upgradeInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

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';
import * as path from 'path';
import * as semver from 'semver';
import type { argParser } from '../../zlux-server-framework/utils/argumentParser';
import type { 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 +142,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 +180,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 +239,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';
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 type { argParser } from '../../zlux-server-framework/utils/argumentParser';
//const jsonUtils = require('zlux-server-framework/lib/jsonUtils');
import type { mergeUtils } from '../../zlux-server-framework/utils/mergeUtils';
import type { 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 type { clusterManager } from '../../zlux-server-framework/lib/clusterManager';
import { configJSON, configLocation } from './zluxArgs';

clusterManager.start(configJSON, configLocation);

Expand Down
6 changes: 2 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,9 @@
*/

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

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