* Made consistent lint command (#495)

* Removed global install of lint modules
* Fixed Lint Issues

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added lint script forapplication javascript

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

updated lint command  for chaincode javascript

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

updated lint script

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

remove installing dependencies

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added lint script to js projects

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added more lint scripts

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added more lint scripts

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added missing npm lint command

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added missing eslint npm module

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

Fix missing npm lint command

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added missing eslint npm module to auction-simple javascctipt app

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added eslint npm module

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added eslint dependency

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added eslint dependency

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

added eslint dependency

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

Single command for ts js lint

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>

Fix or condition in lint.sh

Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
This commit is contained in:
sapthasurendran 2021-10-06 18:03:29 +05:30 committed by GitHub
parent ee959a2eb0
commit 56a1bf3e19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 53 additions and 15 deletions

View file

@ -6,11 +6,18 @@
"node": ">=12",
"npm": ">=5"
},
"scripts": {
"lint": "eslint *.js",
"pretest": "npm run lint"
},
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"dependencies": {
"fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
}
}

View file

@ -8,7 +8,7 @@
"npm": ">=5"
},
"scripts": {
"lint": "eslint .",
"lint": "eslint *.js */**.js",
"pretest": "npm run lint",
"test": "nyc mocha --recursive",
"start": "fabric-chaincode-node start"

View file

@ -2,9 +2,9 @@
* SPDX-License-Identifier: Apache-2.0
*/
// Deterministic JSON.stringify()
import {Context, Contract, Info, Returns, Transaction} from 'fabric-contract-api';
import * as stringify from 'json-stringify-deterministic';
import * as sortKeysRecursive from 'sort-keys-recursive';
import {Context, Contract, Info, Returns, Transaction} from 'fabric-contract-api';
import {Asset} from './asset';
@Info({title: 'AssetTransfer', description: 'Smart contract for trading assets'})

View file

@ -9,8 +9,14 @@
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": {
"fabric-ca-client": "^2.2.2",
"fabric-network": "^2.2.2"
},
"devDependencies": {
"eslint": "^7.32.0"
}
}

View file

@ -9,8 +9,14 @@
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": {
"fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
}
}

View file

@ -8,12 +8,16 @@
"npm": ">=5.3.0"
},
"scripts": {
"start": "fabric-chaincode-node start"
"start": "fabric-chaincode-node start",
"lint": "eslint *.js */**.js"
},
"engine-strict": true,
"license": "Apache-2.0",
"dependencies": {
"fabric-contract-api": "^2.0.0",
"fabric-shim": "^2.0.0"
},
"devDependencies": {
"eslint": "^7.32.0"
}
}

View file

@ -9,8 +9,14 @@
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": {
"fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
}
}

View file

@ -9,8 +9,14 @@
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": {
"fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
}
}

View file

@ -9,6 +9,10 @@
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": {
"fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4"

View file

@ -9,8 +9,14 @@
"engineStrict": true,
"author": "Hyperledger",
"license": "Apache-2.0",
"scripts": {
"lint": "eslint *.js"
},
"dependencies": {
"fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4"
},
"devDependencies": {
"eslint": "^7.32.0"
}
}

View file

@ -85,8 +85,6 @@ jobs:
inputs:
versionSpec: $(NODE_VER)
displayName: Install Node.js
- script: npm install -g typescript eslint tslint
displayName: Install Javascript Linting Deps
- script: ./ci/scripts/lint.sh
displayName: Lint Code

View file

@ -29,13 +29,11 @@ for dir in $dirs; do
print "The following files contain import errors, please run 'goimports -l -w <path>' to fix these issues:"
echo "${output}"
fi
elif [[ "$dir" =~ "-javascript" ]]; then
print "Running ESLint"
if [[ "$dir" =~ "chaincode" ]]; then
eslint *.js */**.js
else
eslint *.js
fi
elif [[ "$dir" =~ "-javascript" || "$dir" =~ "-typescript" ]]; then
print "Installing node modules"
npm install
print "Running Lint"
npm run lint
elif [[ "$dir" =~ "-java" ]]; then
if [[ -f "pom.xml" ]]; then
print "Running Maven Build"
@ -44,9 +42,6 @@ for dir in $dirs; do
print "Running Gradle Build"
./gradlew build
fi
elif [[ "$dir" =~ "-typescript" ]]; then
print "Running TSLint"
tslint --project .
fi
popd
fi