mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
* 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:
parent
ee959a2eb0
commit
56a1bf3e19
12 changed files with 53 additions and 15 deletions
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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'})
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue