Skip to content

Commit

Permalink
fix linting issues and added yml
Browse files Browse the repository at this point in the history
Signed-off-by: Himani1519 <[email protected]>
  • Loading branch information
Himani1519 committed Nov 8, 2023
1 parent c221053 commit ac50fab
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 19 deletions.
42 changes: 42 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
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: {
'import/no-unresolved': 'off',
'@typescript-eslint/no-var-requires': 'off',
'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
6 changes: 3 additions & 3 deletions bin/init/plugins-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
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';
Expand Down
21 changes: 14 additions & 7 deletions lib/upgradeInstance.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
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.
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.
*/

const fs = require('fs');
const path = require('path');
const semver = require('semver');
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
11 changes: 5 additions & 6 deletions lib/zluxArgs.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,12 +9,12 @@
*/

'use strict';
const ProxyServer = require('zlux-server-framework');
// const ProxyServer = require('zlux-server-framework');
const argParser = require('zlux-server-framework/utils/argumentParser');
const jsonUtils = require('zlux-server-framework/lib/jsonUtils');
// 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 mkdirp = require('mkdirp');
const cluster = require('cluster');

const MVD_ARGS = [
Expand Down Expand Up @@ -54,7 +52,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
2 changes: 0 additions & 2 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 Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
},
"scripts": {
"build": "exit 0",
"test": "echo \"Warning: no test specified\" && exit 0"
"test": "echo \"Warning: no test specified\" && exit 0",
"lint": "eslint ."
},
"dependencies": {
"zlux-server-framework": "file:../zlux-server-framework",
Expand Down

0 comments on commit ac50fab

Please sign in to comment.