From 2d5c61ebcadc20cdab27acf008ee8c552a1317f7 Mon Sep 17 00:00:00 2001 From: Neil Campbell Date: Fri, 14 Feb 2025 15:44:30 +0800 Subject: [PATCH] chore: add explicit member accessibility rule and update dependency versions (#17) --- examples/production/eslint.config.mjs | 17 ++++++++--------- examples/production/package.json | 8 ++++---- .../hello_world/contract.algo.ts | 2 +- examples/production/vitest.config.mts | 2 +- examples/starter/package.json | 6 +++--- .../hello_world/contract.algo.ts | 2 +- .../contract.algo.ts.j2 | 2 +- template_content/package.json.jinja | 8 ++++---- .../{{ contract_name }}/contract.algo.ts.jinja | 2 +- ...if use_linter %}eslint.config.mjs{% endif %} | 7 +++++-- ...if use_vitest %}vitest.config.mts{% endif %} | 2 +- 11 files changed, 30 insertions(+), 28 deletions(-) diff --git a/examples/production/eslint.config.mjs b/examples/production/eslint.config.mjs index d0667e1..17227c7 100644 --- a/examples/production/eslint.config.mjs +++ b/examples/production/eslint.config.mjs @@ -2,14 +2,13 @@ import eslint from '@eslint/js' import tseslint from 'typescript-eslint' import globals from 'globals' -export default tseslint.config( - { - languageOptions: { - globals: { - ...globals.node, - }, +export default tseslint.config(eslint.configs.recommended, tseslint.configs.recommended, { + languageOptions: { + globals: { + ...globals.node, }, }, - eslint.configs.recommended, - tseslint.configs.recommended, -) + rules: { + '@typescript-eslint/explicit-member-accessibility': 'warn', + }, +}) diff --git a/examples/production/package.json b/examples/production/package.json index aef630f..c67599c 100644 --- a/examples/production/package.json +++ b/examples/production/package.json @@ -20,13 +20,13 @@ "npm": ">=9.0" }, "dependencies": { - "@algorandfoundation/algorand-typescript": "^1.0.0-beta.6" + "@algorandfoundation/algorand-typescript": "^1.0.0-beta.16" }, "devDependencies": { "@algorandfoundation/algokit-client-generator": "^4.0.6", - "@algorandfoundation/algokit-utils": "^8.0.3", + "@algorandfoundation/algokit-utils": "^8.1.0", "@algorandfoundation/algokit-utils-debug": "^1.0.3", - "@algorandfoundation/puya-ts": "^1.0.0-beta.10", + "@algorandfoundation/puya-ts": "^1.0.0-beta.23", "@rollup/plugin-typescript": "^12.1.2", "@tsconfig/node20": "^20.1.4", "algosdk": "^3.0.0", @@ -37,7 +37,7 @@ "typescript-eslint": "^8.19.1", "prettier": "^3.4.2", "ts-node-dev": "^2.0.0", - "@algorandfoundation/algorand-typescript-testing": "^1.0.0-beta.8", + "@algorandfoundation/algorand-typescript-testing": "^1.0.0-beta.19", "vitest": "^2.1.8", "@vitest/coverage-v8": "^2.1.8", "typescript": "^5.7.3" diff --git a/examples/production/smart_contracts/hello_world/contract.algo.ts b/examples/production/smart_contracts/hello_world/contract.algo.ts index efd4c04..1d0c613 100644 --- a/examples/production/smart_contracts/hello_world/contract.algo.ts +++ b/examples/production/smart_contracts/hello_world/contract.algo.ts @@ -1,7 +1,7 @@ import { Contract } from '@algorandfoundation/algorand-typescript' export class HelloWorld extends Contract { - hello(name: string): string { + public hello(name: string): string { return `${this.getHello()} ${name}` } diff --git a/examples/production/vitest.config.mts b/examples/production/vitest.config.mts index 6a42c69..023dc0d 100644 --- a/examples/production/vitest.config.mts +++ b/examples/production/vitest.config.mts @@ -1,4 +1,4 @@ -import { puyaTsTransformer } from '@algorandfoundation/algorand-typescript-testing/test-transformer' +import { puyaTsTransformer } from '@algorandfoundation/algorand-typescript-testing/vitest-transformer' import typescript from '@rollup/plugin-typescript' import { defineConfig } from 'vitest/config' diff --git a/examples/starter/package.json b/examples/starter/package.json index a444b1b..f14ee69 100644 --- a/examples/starter/package.json +++ b/examples/starter/package.json @@ -14,13 +14,13 @@ "npm": ">=9.0" }, "dependencies": { - "@algorandfoundation/algorand-typescript": "^1.0.0-beta.6" + "@algorandfoundation/algorand-typescript": "^1.0.0-beta.16" }, "devDependencies": { "@algorandfoundation/algokit-client-generator": "^4.0.6", - "@algorandfoundation/algokit-utils": "^8.0.3", + "@algorandfoundation/algokit-utils": "^8.1.0", "@algorandfoundation/algokit-utils-debug": "^1.0.3", - "@algorandfoundation/puya-ts": "^1.0.0-beta.10", + "@algorandfoundation/puya-ts": "^1.0.0-beta.23", "@rollup/plugin-typescript": "^12.1.2", "@tsconfig/node20": "^20.1.4", "algosdk": "^3.0.0", diff --git a/examples/starter/smart_contracts/hello_world/contract.algo.ts b/examples/starter/smart_contracts/hello_world/contract.algo.ts index efd4c04..1d0c613 100644 --- a/examples/starter/smart_contracts/hello_world/contract.algo.ts +++ b/examples/starter/smart_contracts/hello_world/contract.algo.ts @@ -1,7 +1,7 @@ import { Contract } from '@algorandfoundation/algorand-typescript' export class HelloWorld extends Contract { - hello(name: string): string { + public hello(name: string): string { return `${this.getHello()} ${name}` } diff --git a/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/contract.algo.ts.j2 b/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/contract.algo.ts.j2 index 1494b9c..df34e0e 100644 --- a/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/contract.algo.ts.j2 +++ b/template_content/.algokit/generators/create_contract/smart_contracts/{% raw %}{{ contract_name }}{% endraw %}/contract.algo.ts.j2 @@ -1,7 +1,7 @@ import { Contract } from '@algorandfoundation/algorand-typescript' export class {{ contract_name.split('_')|map('capitalize')|join }} extends Contract { - hello(name: string): string { + public hello(name: string): string { return `${this.getHello()} ${name}` } diff --git a/template_content/package.json.jinja b/template_content/package.json.jinja index 0bac2da..f743eae 100644 --- a/template_content/package.json.jinja +++ b/template_content/package.json.jinja @@ -28,13 +28,13 @@ "npm": ">=9.0" }, "dependencies": { - "@algorandfoundation/algorand-typescript": "^1.0.0-beta.6" + "@algorandfoundation/algorand-typescript": "^1.0.0-beta.16" }, "devDependencies": { "@algorandfoundation/algokit-client-generator": "^4.0.6", - "@algorandfoundation/algokit-utils": "^8.0.3", + "@algorandfoundation/algokit-utils": "^8.1.0", "@algorandfoundation/algokit-utils-debug": "^1.0.3", - "@algorandfoundation/puya-ts": "^1.0.0-beta.10", + "@algorandfoundation/puya-ts": "^1.0.0-beta.23", "@rollup/plugin-typescript": "^12.1.2", "@tsconfig/node20": "^20.1.4", "algosdk": "^3.0.0", @@ -52,7 +52,7 @@ {%- endif %} "ts-node-dev": "^2.0.0", {%- if use_vitest %} - "@algorandfoundation/algorand-typescript-testing": "^1.0.0-beta.8", + "@algorandfoundation/algorand-typescript-testing": "^1.0.0-beta.19", "vitest": "^2.1.8", "@vitest/coverage-v8": "^2.1.8", {%- endif %} diff --git a/template_content/smart_contracts/{{ contract_name }}/contract.algo.ts.jinja b/template_content/smart_contracts/{{ contract_name }}/contract.algo.ts.jinja index 1494b9c..df34e0e 100644 --- a/template_content/smart_contracts/{{ contract_name }}/contract.algo.ts.jinja +++ b/template_content/smart_contracts/{{ contract_name }}/contract.algo.ts.jinja @@ -1,7 +1,7 @@ import { Contract } from '@algorandfoundation/algorand-typescript' export class {{ contract_name.split('_')|map('capitalize')|join }} extends Contract { - hello(name: string): string { + public hello(name: string): string { return `${this.getHello()} ${name}` } diff --git a/template_content/{% if use_linter %}eslint.config.mjs{% endif %} b/template_content/{% if use_linter %}eslint.config.mjs{% endif %} index 0ba051a..4d2428a 100644 --- a/template_content/{% if use_linter %}eslint.config.mjs{% endif %} +++ b/template_content/{% if use_linter %}eslint.config.mjs{% endif %} @@ -3,13 +3,16 @@ import tseslint from 'typescript-eslint' import globals from 'globals' export default tseslint.config( + eslint.configs.recommended, + tseslint.configs.recommended, { languageOptions: { globals: { ...globals.node, }, }, + rules: { + '@typescript-eslint/explicit-member-accessibility': 'warn', + }, }, - eslint.configs.recommended, - tseslint.configs.recommended, ); diff --git a/template_content/{% if use_vitest %}vitest.config.mts{% endif %} b/template_content/{% if use_vitest %}vitest.config.mts{% endif %} index d243f8b..abb2d2a 100644 --- a/template_content/{% if use_vitest %}vitest.config.mts{% endif %} +++ b/template_content/{% if use_vitest %}vitest.config.mts{% endif %} @@ -1,4 +1,4 @@ -import { puyaTsTransformer } from '@algorandfoundation/algorand-typescript-testing/test-transformer' +import { puyaTsTransformer } from '@algorandfoundation/algorand-typescript-testing/vitest-transformer' import typescript from '@rollup/plugin-typescript' import { defineConfig } from 'vitest/config'