Skip to content

Commit

Permalink
refactor: update eslint rules and husky (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov authored Jul 23, 2024
1 parent f7aac3a commit 4ad6cfa
Show file tree
Hide file tree
Showing 12 changed files with 392 additions and 383 deletions.
16 changes: 13 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
"extends": [
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error",
"@typescript-eslint/no-explicit-any": "warn"
"max-len": "off",
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"curly": 2
},
"plugins": ["@typescript-eslint", "prettier"]
"plugins": [
"@typescript-eslint",
"prettier"
]
}
4 changes: 0 additions & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
. "$(dirname -- "$0")/common.sh"

npx --no-install commitlint --edit $1
8 changes: 0 additions & 8 deletions .husky/common.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
. "$(dirname -- "$0")/common.sh"

npm run pre-commit
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run pre-push
434 changes: 217 additions & 217 deletions .yarn/releases/yarn-4.3.0.cjs → .yarn/releases/yarn-4.3.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.0.cjs
yarnPath: .yarn/releases/yarn-4.3.1.cjs
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lifi/types",
"version": "13.18.2",
"version": "14.0.0-alpha.0",
"description": "Types for the LI.FI stack",
"keywords": [
"sdk",
Expand Down Expand Up @@ -57,7 +57,7 @@
"clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo src/tsconfig.build.tsbuildinfo src/_esm src/_cjs src/_types",
"lint:fix": "eslint --ext .tsx --ext .ts ./src --fix",
"package": "npm run build && npm pack",
"postinstall": "husky install",
"postinstall": "husky",
"postpack": "pinst --enable",
"pre-commit": "lint-staged",
"pre-push": "yarn build",
Expand All @@ -79,20 +79,20 @@
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@types/fs-extra": "^11.0.4",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-prettier": "^5.2.1",
"fs-extra": "^11.2.0",
"husky": "^8.0.3",
"husky": "^9.1.1",
"lint-staged": "^15.2.7",
"pinst": "^3.0.0",
"prettier": "^3.3.2",
"prettier": "^3.3.3",
"standard-version": "^9.5.0",
"typescript": "^5.4.5"
"typescript": "^5.5.4"
},
"packageManager": "[email protected].0",
"packageManager": "[email protected].1",
"publishConfig": {
"access": "public"
},
Expand Down
23 changes: 17 additions & 6 deletions scripts/prepublishOnly.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,31 @@ function generatePackageJson() {
// Generate proxy packages for each export.
const files_ = [...files]
for (const [key, value] of Object.entries(exports_)) {
if (typeof value === 'string') continue
if (key === '.') continue
if (!value.default || !value.import)
if (typeof value === 'string') {
continue
}
if (key === '.') {
continue
}
if (!value.default || !value.import) {
throw new Error('`default` and `import` are required.')
}

outputFileSync(
`${key}/package.json`,
`{
${Object.entries(value)
.map(([k, v]) => {
const key = (() => {
if (k === 'import') return 'module'
if (k === 'default') return 'main'
if (k === 'types') return 'types'
if (k === 'import') {
return 'module'
}
if (k === 'default') {
return 'main'
}
if (k === 'types') {
return 'types'
}
throw new Error('Invalid key')
})()
return `"${key}": "${v.replace('./', '../')}"`
Expand Down
4 changes: 2 additions & 2 deletions src/chains/Chain.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CoinKey } from '../tokens/base.js'
import { ChainKey } from './base.js'
import type { CoinKey } from '../tokens/base.js'
import type { ChainKey } from './base.js'

export enum ChainType {
EVM = 'EVM',
Expand Down
4 changes: 2 additions & 2 deletions src/tokens/token.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChainId } from '../chains/base.js'
import { CoinKey } from './base.js'
import type { ChainId } from '../chains/base.js'
import type { CoinKey } from './base.js'

export interface BaseToken {
chainId: ChainId
Expand Down
Loading

0 comments on commit 4ad6cfa

Please sign in to comment.