Skip to content

Commit

Permalink
tiny refactors & typo fixes (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
erhant authored Jan 15, 2024
1 parent 220ab9b commit 84ead50
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 108 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
]
},
"ignorePatterns": ["build", "node_modules", "ptau", "circuits", "inputs", "dist", ".vscode", ".github"],
"overrides": [
{
"files": ["**/*.ts", "**/*.tsx"],
Expand Down
5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

52 changes: 0 additions & 52 deletions CHANGELOG.md

This file was deleted.

18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
"node": ">=12.0.0"
},
"files": [
"dist",
"dist/",
"LICENSE",
"README.md",
"package.json"
"README.md"
],
"bin": "dist/bin/index.js",
"main": "dist/index.js",
Expand All @@ -27,20 +26,20 @@
"scripts": {
"build": "npx tsc -p tsconfig.build.json",
"prebuild": "rimraf dist/",
"prepublish": "yarn build",
"cli": "yarn build && node ./dist/bin",
"test": "npx mocha",
"pretest": "rimraf build/",
"check": "npx tsc --noEmit",
"style": "yarn format && yarn lint",
"lint": "npx eslint '**/*.ts'",
"format": "npx prettier --check ./**/*.ts"
"lint": "npx eslint '**/*.ts' && echo 'All good!'",
"format": "npx prettier --check ./src/**/*.ts ./tests/**/*.ts"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/mocha-each": "^2.0.0",
"@types/node": "^18.11.18",
"@types/snarkjs": "^0.7.7",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"eslint": "^8.54.0",
Expand All @@ -60,6 +59,13 @@
"loglevel": "^1.8.1",
"snarkjs": "^0.7.0"
},
"prettier": {
"bracketSpacing": false,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "avoid",
"printWidth": 120
},
"keywords": [
"circom",
"zero knowledge",
Expand Down
11 changes: 8 additions & 3 deletions src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function cli(): Promise<number> {
const titleLog = (title: string) => circomkit.log(`===| ${title} |===`, 'title');

// execute command
const command = process.argv[2] as keyof Circomkit | 'init' | 'config';
const command = process.argv[2] as keyof Circomkit | 'init' | 'config' | 'help';
switch (command) {
case 'compile': {
titleLog('Compiling the circuit');
Expand Down Expand Up @@ -59,7 +59,7 @@ async function cli(): Promise<number> {
titleLog('Circuit information');
const info = await circomkit.info(process.argv[3]);
circomkit.log(`Prime Field: ${info.primeName}`);
circomkit.log(`Number of of Wires: ${info.variables}`);
circomkit.log(`Number of Wires: ${info.variables}`);
circomkit.log(`Number of Constraints: ${info.constraints}`);
circomkit.log(`Number of Private Inputs: ${info.privateInputs}`);
circomkit.log(`Number of Public Inputs: ${info.publicInputs}`);
Expand Down Expand Up @@ -153,8 +153,13 @@ async function cli(): Promise<number> {
break;
}

case 'help':
// help should return with a normal exit code, no need to pass-through to `default` case
console.log(usageString);
break;

default:
// command satisfies never; // CLI cases are not that well-typed yet
// command satisfies never; // TODO: CLI cases are not that well-typed yet
console.log(usageString);
return 1;
}
Expand Down
21 changes: 0 additions & 21 deletions tsconfig.base.json

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.base.json",
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
Expand Down
19 changes: 18 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
{
"extends": "./tsconfig.base.json",
// Google's TS Config
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"declaration": true,
"forceConsistentCasingInFileNames": true,
"lib": ["ES2020"],
"module": "commonjs",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"esModuleInterop": true,
"pretty": true,
"sourceMap": true,
"strict": true,
"target": "ES2020"
},
"include": ["src/types/**/*.*", "src/**/*.*", "tests/**/*.ts"],
"exclude": ["node_modules", "build", "dist", "ptau"]
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339"
integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==

"@types/snarkjs@^0.7.7":
version "0.7.7"
resolved "https://registry.yarnpkg.com/@types/snarkjs/-/snarkjs-0.7.7.tgz#2613bd56466497d4e4df0000c59f06b8bc2cfcea"
integrity sha512-t/fYLdqUDM7W/XP+CKh4kvo9SS2ejtqHJz/2LQf/UsrrCsDYRjQ85DQFdvIJ6FvJjUvtEEPpTSCPk9gDDjcBWQ==

"@typescript-eslint/eslint-plugin@^6.13.1":
version "6.13.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.1.tgz#f98bd887bf95551203c917e734d113bf8d527a0c"
Expand Down

0 comments on commit 84ead50

Please sign in to comment.