Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Add lint pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
James Browning committed Feb 15, 2022
1 parent 7db3d97 commit 2c537ee
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 27 deletions.
8 changes: 3 additions & 5 deletions plutus-chain-index/e2e-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
},
plugins: [
'@typescript-eslint',
'jest',
'sort-imports-es6-autofix',
],
extends: [
'eslint:recommended',
Expand All @@ -23,21 +23,19 @@ module.exports = {
2,
"unix"
],
"no-restricted-imports": ["error", {
"patterns": ["@cardano-sdk/*/src/*"]
}],
"new-cap": 0,
"no-unused-expressions": 0,
"no-useless-constructor": 0,
"sort-keys-fix/sort-keys-fix": ["warn", "asc", { "natural": true }],
"sort-imports-es6-autofix/sort-imports-es6": "warn",
"sort-imports": ["warn", { ignoreDeclarationSort: true }],
"@typescript-eslint/no-floating-promises": ["error"],
'@typescript-eslint/explicit-module-boundary-types': 0,
"max-len": ["error", { "code": 120 }],
"@typescript-eslint/ban-types": 0,
'@typescript-eslint/no-non-null-assertion': 0,
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-unused-vars": ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
"@typescript-eslint/no-var-requires": 0,
"template-tag-spacing": 0,
'promise/avoid-new': 0,
'consistent-return': 0, // typescript checks return types
Expand Down
163 changes: 146 additions & 17 deletions plutus-chain-index/e2e-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion plutus-chain-index/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"test": "ts-mocha \"sanity-test/**/*.spec.ts\"",
"lint": "eslint ."
},
"pre-commit": [
"lint"
],
"keywords": [],
"author": "James Browning <[email protected]>",
"license": "ISC",
Expand All @@ -24,8 +27,9 @@
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"eslint-plugin-promise": "^5.1.0",
"pre-commit": "^1.2.2",
"mocha": "^9.2.0",
"supertest": "^6.2.2",
"ts-mocha": "^9.0.2",
Expand Down
3 changes: 2 additions & 1 deletion plutus-chain-index/e2e-tests/sanity-test/at-address-body.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default function atAddressBody(pageSize?: number, txOutRef_id?: string, txOutRef_idx?: number, pubkeyhash?: string) {
export default function atAddressBody(pageSize?: number, txOutRef_id?: string,
txOutRef_idx?: number, pubkeyhash?: string) {
return {
...(pageSize || txOutRef_id) && {
pageQuery: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe("GET /collect-garbage", async () => {
before(async () => {
response = await request.get("/collect-garbage");
expect(response.status).to.equal(200);
/* eslint-disable @typescript-eslint/no-unused-vars */
resBody = response.body;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe("POST /from-hash/datum", () => {
.type("application/json")
.send(`"${env.not_relevant_datum_hash}"`)
expect(response.status).to.equal(404);
/* eslint-disable @typescript-eslint/no-unused-vars */
resBody = response.body;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("POST /from-hash/stake-validator", () => {
.type("application/json")
.send(`"${env.minting_policy_hash}"`)
expect(response.status).to.equal(200);
/* eslint-disable @typescript-eslint/no-unused-vars */
resBody = response.body;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ describe("POST /is-utxo", () => {
before(async () => {
response = await request
.post("/is-utxo")
.send({ "txOutRefId": { "getTxId": env.relevant_txOutRef_id }, "txOutRefIdx": env.relevant_txOutRef_idx });
.send({
"txOutRefId": { "getTxId": env.relevant_txOutRef_id },
"txOutRefIdx": env.relevant_txOutRef_idx
});
expect(response.status).to.equal(200);
resBody = response.body;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ describe("POST /txo-at-address", () => {
before(async () => {
response = await request
.post("/txo-at-address")
.send(atAddressBody(10, env.relevant_txOutRef_id, env.relevant_txOutRef_idx, env.relevant_txOut_pubkeyhash));
.send(atAddressBody(10, env.relevant_txOutRef_id,
env.relevant_txOutRef_idx, env.relevant_txOut_pubkeyhash));
expect(response.status).to.equal(200);
resBody = response.body;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ describe("POST /utxo-at-address", () => {
before(async () => {
response = await request
.post("/utxo-at-address")
.send(atAddressBody(10, env.relevant_txOutRef_id, env.lastPage_txOutRef_idx, env.relevant_txOut_pubkeyhash));
.send(atAddressBody(10, env.relevant_txOutRef_id,
env.lastPage_txOutRef_idx, env.relevant_txOut_pubkeyhash));
expect(response.status).to.equal(200);
resBody = response.body;
});
Expand Down

0 comments on commit 2c537ee

Please sign in to comment.