setup prettier, eslint, husky

This commit is contained in:
Sayantan Karmakar 2022-04-02 21:09:14 +05:30
parent 7810f6aa51
commit ff307e0222
6 changed files with 1689 additions and 19 deletions

17
ts/.eslintrc Normal file
View File

@ -0,0 +1,17 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"airbnb",
"plugin:prettier/recommended",
"prettier/@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"prettier/prettier": "error",
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error"
}
}

2
ts/.husky/pre-commit Normal file
View File

@ -0,0 +1,2 @@
cd ts
yarn lint-staged

5
ts/.prettierrc Normal file
View File

@ -0,0 +1,5 @@
{
"semi": true,
"singleQuote": false,
"trailingComma": "all"
}

View File

@ -12,13 +12,33 @@
],
"scripts": {
"build": "rm -rf dist/; tsc",
"test": "jest"
"test": "jest",
"prepare": "cd .. && husky install ts/.husky"
},
"lint-staged": {
"src/**/*.ts": [
"eslint --fix",
"git add"
]
},
"devDependencies": {
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"eslint": "^8.12.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^7.0.0",
"jest": "^27.5.1",
"lint-staged": "^12.3.7",
"prettier": "^2.6.1",
"ts-jest": "^27.1.4",
"ts-jest-resolver": "^2.0.0",
"typescript": "^4.6.3"
},
"dependencies": {
"@solana/web3.js": "^1.37.0"
}
}

14
ts/src/dex.ts Normal file
View File

@ -0,0 +1,14 @@
import { PublicKey } from "@solana/web3.js";
export class Dex {
public address: PublicKey;
constructor(address: PublicKey) {
this.address = address;
}
public hello_world(x: number): string {
var c = x + 10;
return `hello ${c}`;
}
}

File diff suppressed because it is too large Load Diff