Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated Linting on Pre-Push #22

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/package
.env
.env.*
!.env.example
.prettier*

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
44 changes: 44 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:es-x/no-new-in-es2022",
"eslint-config-prettier"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "eslint-plugin-prettier"],
"ignorePatterns": ["*.cjs", "lib/*", "node_modules/**"],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
},
"env": {
"browser": true,
"es2017": true,
"node": true
},
"overrides": [],
"rules": {
"indent": ["error", 4],
"prettier/prettier": "warn",
"no-console": "warn",
"sort-imports": [
"warn",
{
"ignoreCase": true,
"ignoreDeclarationSort": true
}
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/no-this-alias": "warn",
"no-inner-declarations": "off",
"es-x/no-class-fields": "off",
"es-x/no-export-ns-from": "off"
}
}
21 changes: 21 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

engine=npm
yarn --version &> /dev/null
if [ $? -eq 0 ]; then
engine=yarn
fi

if [[ -n $(git status -s) ]]; then
echo "Working directory is not empty, commit or stash changes before pushing."
ericpassmore marked this conversation as resolved.
Show resolved Hide resolved
echo "Use option `--no-verify` to skip this check"
exit 1
fi
"$engine" install --check-files
"$engine" format
"$engine" lint --fix
if [[ -n $(git status -s) ]]; then
git add -A
git commit -m "Husky: Committing result of prettier"
fi
13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DS_Store
node_modules
/build
/package
.env
.env.*
!.env.example
.prettier*

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"useTabs": false,
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 100,
"bracketSpacing": true,
"overrides": []
}
72 changes: 42 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
{
"name": "@enf/eos-evm-miner",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "tsc",
"start": "node ./dist/index.js",
"mine": "npm run build && npm start",
"dev": "ts-node-dev ./src/index.ts",
"test": "mocha --require ts-node/register --recursive ./test/**/*.ts"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^18.16.2",
"chai": "^4.3.7",
"mocha": "^10.2.0",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"typescript": "^5.0.4"
},
"dependencies": {
"colors": "^1.4.0",
"dotenv": "^16.0.3",
"eosjs": "^22.1.0",
"ethereumjs-util": "^7.1.5",
"isomorphic-fetch": "^3.0.0",
"jayson": "^4.0.0",
"winston": "^3.8.2"
}
"name": "@enf/eos-evm-miner",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "tsc",
"start": "node ./dist/index.js",
"mine": "npm run build && npm start",
"dev": "ts-node-dev ./src/index.ts",
"test": "mocha --require ts-node/register --recursive ./test/**/*.ts",
"format": "prettier . --write .",
"lint": "prettier . --check . && eslint .",
"prepare": "husky install"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^18.16.2",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"chai": "^4.3.7",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin": "^1.0.1",
"eslint-plugin-es-x": "^7.2.0",
"eslint-plugin-prettier": "^5.0.0",
"husky": "^8.0.3",
"mocha": "^10.2.0",
"prettier": "^3.0.1",
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"typescript": "^5.0.4"
},
"dependencies": {
"colors": "^1.4.0",
"dotenv": "^16.0.3",
"eosjs": "^22.1.0",
"ethereumjs-util": "^7.1.5",
"isomorphic-fetch": "^3.0.0",
"jayson": "^4.0.0",
"winston": "^3.8.2"
}
}
Loading