Skip to content

Commit

Permalink
feat: add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
pavanjoshi914 committed Aug 10, 2023
1 parent 518d4d6 commit 07e0ffc
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
30 changes: 30 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020
},
"plugins": ["@typescript-eslint"],
"env": {
"node": true
},
"rules": {
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description"
}
],
"@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }],
"no-console": ["error", { "allow": ["info", "warn", "error"] }],
"no-constant-binary-expression": "error"
},
"globals": {
"window": true
}
}
6 changes: 4 additions & 2 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
export default {
"src/**/*.{js,ts}": [
"prettier --write",
"eslint --fix --max-warnings 0",
"prettier --write"
],
"examples/**/*.{js,mjs,jsx}": [
"prettier --write",
"prettier --write"
],

"package.json": ["prettier --write"],
"src/**/*.ts": () => "tsc --noEmit",
};

11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
},
"scripts": {
"prebuild": "yarn run clean",
"format": "prettier --check '**/*.(md|json)' 'src/**/*.(js|ts|jsx|tsx)'",
"lint": "yarn lint:js && yarn tsc:compile && yarn format:fix",
"lint:js": "eslint src --ext .js,.ts --max-warnings 0",
"lint:js:fix": "eslint src --ext .js,.ts --fix",
"tsc:compile": "tsc --noEmit",
"format": "prettier --check '**/*.(md|json)' 'src/**/*.(js|ts)' 'example/**/*.(js|jsx)'",
"format:fix": "prettier --loglevel silent --write '**/*.(md|json)' 'src/**/*.(js|ts)' 'example/**/*.(js|jsx)'",
"prepack": "yarn run build",
"test": "jest",
"clean": "rm -rf dist",
Expand All @@ -43,8 +48,12 @@
"@types/crypto-js": "^4.1.1",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.0",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"@webbtc/webln-types": "^1.0.11",
"browserify": "^17.0.0",
"eslint": "^8.46.0",
"eslint-config-prettier": "^9.0.0",
"express": "^4.18.2",
"husky": "^8.0.3",
"jest": "^29.5.0",
Expand Down

0 comments on commit 07e0ffc

Please sign in to comment.