diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000000000..b4f1cac41 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Auto-fix linting +d2a058fe6cfbab6f82d0d977d1b2d8bd9f494df1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c700c60d4..e55db32ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,21 +1,55 @@ repos: - repo: local hooks: - - id: lint-sol + # Core + - id: core-lint-sol name: "lint core sol" - entry: /usr/bin/env bash -c "cd core/ && npm run lint:sol" - files: '\.sol$' + entry: /usr/bin/env bash -c "npm --prefix ./core/ run lint:sol" + files: ^core/ + types: [solidity] language: script description: "Checks solidity code according to the package's linter configuration" - - id: lint-js + - id: core-lint-js name: "lint core ts/js" - entry: /usr/bin/env bash -c "cd core/ && npm run lint:js" - files: '\.(ts|js)$' + entry: /usr/bin/env bash -c "npm --prefix ./core/ run lint:js" + files: ^core/ + types_or: [ts, javascript] language: script description: "Checks TS/JS code according to the package's linter configuration" - - id: lint-config + - id: core-lint-config name: "lint core json/yaml" - entry: /usr/bin/env bash -c "cd core/ && npm run lint:config" - files: '\.(json|yaml)$' + entry: /usr/bin/env bash -c "npm --prefix ./core/ run lint:config" + files: ^core/ + types_or: [json, yaml] + language: script + description: "Checks JSON/YAML code according to the package's linter configuration" + # dApp + - id: dapp-lint-js + name: "lint dapp ts/js" + entry: /usr/bin/env bash -c "npm --prefix ./dapp/ run lint:js" + files: ^dapp/ + types_or: [ts, tsx, javascript, jsx] + language: script + description: "Checks TS/JS code according to the package's linter configuration" + - id: dapp-lint-config + name: "lint dapp json/yaml" + entry: /usr/bin/env bash -c "npm --prefix ./dapp/ run lint:config" + files: ^dapp/ + types_or: [json, yaml] + language: script + description: "Checks JSON/YAML code according to the package's linter configuration" + # Website + - id: website-lint-js + name: "lint website ts/js" + entry: /usr/bin/env bash -c "npm --prefix ./website/ run lint:js" + files: ^website/ + types_or: [ts, tsx, javascript, jsx] + language: script + description: "Checks TS/JS code according to the package's linter configuration" + - id: website-lint-config + name: "lint website json/yaml" + entry: /usr/bin/env bash -c "npm --prefix ./website/ run lint:config" + files: ^website/ + types_or: [json, yaml] language: script description: "Checks JSON/YAML code according to the package's linter configuration" diff --git a/README.md b/README.md index 431a793c6..de2f62834 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,15 @@ To setup the hooks follow the steps: ```sh pre-commit install ``` + +#### Testing + +To test the pre-commit hooks configuration you can invoke them with one of the +commands: +```sh +# Execute hooks for all files: +pre-commit run --all-files + +# Execute hooks for specific files (e.g. Acre.sol): +pre-commit run --files ./core/contracts/Acre.sol +``` diff --git a/core/.git-blame-ignore-revs b/core/.git-blame-ignore-revs deleted file mode 100644 index e69de29bb..000000000 diff --git a/dapp/manifest-ledger-live-app.json b/dapp/manifest-ledger-live-app.json index 21c1afe4b..a60014901 100644 --- a/dapp/manifest-ledger-live-app.json +++ b/dapp/manifest-ledger-live-app.json @@ -1,34 +1,34 @@ { - "id": "acre", - "name": "ACRE", - "url": "http://localhost:5173/", - "homepageUrl": "http://localhost:5173/", - "icon": "http://localhost:5173/acre.svg", - "platform": "all", - "apiVersion": "2.0.0", - "manifestVersion": "1", - "branch": "stable", - "categories": [ - "buy" - ], - "currencies": [ - "bitcoin", - "bitcoin_testnet", - "ethereum", - "ethereum_goerli" - ], - "content": { - "shortDescription": { - "en": "Bitcoin Liquid Staking" - }, - "description": { - "en": "Bitcoin Liquid Staking" - } + "id": "acre", + "name": "ACRE", + "url": "http://localhost:5173/", + "homepageUrl": "http://localhost:5173/", + "icon": "http://localhost:5173/acre.svg", + "platform": "all", + "apiVersion": "2.0.0", + "manifestVersion": "1", + "branch": "stable", + "categories": [ + "buy" + ], + "currencies": [ + "bitcoin", + "bitcoin_testnet", + "ethereum", + "ethereum_goerli" + ], + "content": { + "shortDescription": { + "en": "Bitcoin Liquid Staking" }, - "permissions": [ - "account.request" - ], - "domains": [ - "http://*" - ] + "description": { + "en": "Bitcoin Liquid Staking" + } + }, + "permissions": [ + "account.request" + ], + "domains": [ + "http://*" + ] }