Skip to content

Commit

Permalink
up eslint packages + type check and format in pre-commit (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 authored Nov 22, 2024
1 parent b0eab8d commit 0e8d2eb
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 179 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ jobs:

- name: Run lint
run: yarn lint --max-warnings=0

- name: Run type-check
run: yarn type-check
9 changes: 9 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
pre-commit:
parallel: true
commands:
type-check:
glob: "src/**/*.ts"
run: yarn type-check
lint:
glob: "*.{js,ts,md}"
run: yarn eslint --fix {staged_files}
format:
glob: "*.{js,ts,md,json}"
run: |
yarn prettier --write {staged_files}
git add {staged_files}
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"lint": "eslint .",
"format": "prettier --write .",
"test": "echo \"Error: no test specified\" && exit 1",
"type-check": "tsc --noEmit",
"changeset:release": "yarn build && changeset publish"
},
"keywords": [
Expand All @@ -32,22 +33,22 @@
],
"license": "MIT",
"devDependencies": {
"@eslint/js": "^9.3.0",
"@eslint/js": "^9.15.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-typescript": "11.1.0",
"@types/inquirer": "9.0.3",
"@types/ncp": "2.0.5",
"@types/node": "18.16.0",
"eslint": "^9.3.0",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-prettier": "^5.2.1",
"lefthook": "^1.6.16",
"prettier": "3.3.2",
"prettier": "^3.3.3",
"rollup": "3.21.0",
"rollup-plugin-auto-external": "2.0.0",
"tslib": "2.5.0",
"typescript": "5.0.4",
"typescript-eslint": "^7.10.0"
"typescript": "^5.6.3",
"typescript-eslint": "^8.15.0"
},
"dependencies": {
"@changesets/cli": "^2.26.2",
Expand Down
2 changes: 1 addition & 1 deletion src/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
"repository": "https://github.com/scaffold-eth/create-eth-extensions",
"branch": "randao"
}
]
]
2 changes: 1 addition & 1 deletion src/utils/parse-arguments-into-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export async function parseArgumentsIntoOptions(

// if lengh is 1, we don't give user a choice and set it ourselves.
const solidityFramework =
solidityFrameworkChoices.length === 1 ? solidityFrameworkChoices[0] : args["--solidity-framework"] ?? null;
solidityFrameworkChoices.length === 1 ? solidityFrameworkChoices[0] : (args["--solidity-framework"] ?? null);

if (solidityFramework === SOLIDITY_FRAMEWORKS.FOUNDRY) {
await validateFoundryUp();
Expand Down
2 changes: 1 addition & 1 deletion src/utils/system-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { execa } from "execa";
export const validateFoundryUp = async () => {
try {
await execa("foundryup", ["-h"]);
} catch (error) {
} catch {
const message = ` ${chalk.bold.yellow("Attention: Foundryup is not installed in your system.")}
${chalk.bold.yellow("To use foundry, please install foundryup")}
${chalk.bold.yellow("Checkout: https://getfoundry.sh")}
Expand Down
6 changes: 2 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
"moduleResolution": "node",
"resolveJsonModule": true
},
"exclude": [
"node_modules"
]
}
"exclude": ["node_modules", "templates", "externalExtensions", "**/*.test.ts"]
}
Loading

0 comments on commit 0e8d2eb

Please sign in to comment.