Skip to content

Commit

Permalink
lint: add type check (#511)
Browse files Browse the repository at this point in the history
* lint: add type check

* fix ci test

* Fix massa-web3 build

---------

Co-authored-by: Senji888 <[email protected]>
  • Loading branch information
Thykof and Ben-Rey authored Jan 9, 2024
1 parent fa88131 commit 89ebd03
Show file tree
Hide file tree
Showing 10 changed files with 2,257 additions and 1,109 deletions.
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const config: Config.InitialOptions = {
'^.+\\.jsx?$': 'babel-jest',
},
moduleNameMapper: {
'^@massa-web3/(.*)$': '<rootDir>/packages/massa-web3/src/$1',
'^@web3-utils/(.*)$': '<rootDir>/packages/web3-utils/src/$1',
'^@massalabs/massa-web3/(.*)$': '<rootDir>/packages/massa-web3/src/$1',
'^@massalabs/web3-utils/(.*)$': '<rootDir>/packages/web3-utils/src/$1',
},
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
Expand Down
3,322 changes: 2,221 additions & 1,101 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"test:cov": "npm run test:cov --ws --if-present",
"test:all": "npm run test:all --ws --if-present",
"build": "npm run build --ws --if-present",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint": "eslint . && npm run check-types --ws",
"lint:fix": "eslint . --fix && npm run check-types --ws",
"prettier": "prettier --check .",
"prettier:fix": "prettier --write .",
"fmt": "npm run prettier:fix && npm run lint:fix",
Expand All @@ -20,6 +20,7 @@
"@types/jest": "^29.5.5",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"bignumber.js": "^9.1.1",
"assemblyscript": "^0.27.22",
"eslint": "^8.51.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-standard": "^17.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "assemblyscript/std/assembly.json",
"include": [
"**/*.ts"
],
"typedocOptions": {
"exclude": "assembly/**/__tests__",
"excludePrivate": true,
"excludeProtected": true,
"excludeExternals": true,
"includeVersion": true,
"skipErrorChecking": true
}
}
10 changes: 10 additions & 0 deletions packages/massa-web3/examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../../tsconfig.base.json",
"include": [
"./smartContracts/**/*.ts",
"./wallet/**/*.ts"
],
"exclude": [
"./smartContracts/contract/**/*.ts"
]
}
1 change: 1 addition & 0 deletions packages/massa-web3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test:cov": "jest --coverage --silent --detectOpenHandles --forceExit",
"test-smart-contract-example": "ts-node ./examples/smartContracts/index.ts",
"test-wallet": "ts-node ./examples/wallet/index.ts",
"check-types": "tsc --noEmit",
"doc": "typedoc src/index.ts --name massa-web3 --out docs/documentation/html --tsconfig tsconfig.json"
},
"author": "Massa Labs <[email protected]>",
Expand Down
3 changes: 2 additions & 1 deletion packages/massa-web3/tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"exclude": [
"node_modules",
"**/*.spec.ts"
"**/*.spec.ts",
"./examples/**/*"
]
}
2 changes: 1 addition & 1 deletion packages/massa-web3/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"outDir": "./dist"
},
"include": [
"./src/**/*.ts",
"./src/**/*.ts"
],
"exclude": [
"node_modules",
Expand Down
1 change: 1 addition & 0 deletions packages/web3-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"test": "jest --passWithNoTests",
"test:all": "npm run test",
"test:cov": "jest --coverage --silent --passWithNoTests",
"check-types": "tsc --noEmit",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"prettier": "prettier --check .",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
],
"baseUrl": ".",
"paths": {
"@massa-web3/*": [
"@massalabs/massa-web3/*": [
"packages/massa-web3/src/*"
],
"@web3-utils/*": [
"@massalabs/web3-utils/*": [
"packages/web3-utils/src/*"
]
}
Expand Down

0 comments on commit 89ebd03

Please sign in to comment.