From 20a65f6b123c9107faed065c9f0401c669661647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20Vujovi=C4=87?= Date: Mon, 10 Oct 2022 22:29:47 +0200 Subject: [PATCH 1/2] feat: Add Babel config programmaticaly --- cli/cli.js | 6 ++++++ examples/babel.config.json | 8 -------- tests/babel.config.json | 8 -------- 3 files changed, 6 insertions(+), 16 deletions(-) delete mode 100644 examples/babel.config.json delete mode 100644 tests/babel.config.json diff --git a/cli/cli.js b/cli/cli.js index 1ac53f70..6858da04 100755 --- a/cli/cli.js +++ b/cli/cli.js @@ -98,6 +98,12 @@ async function createJsFileWithRullup(sourceFileWithPath, rollupTarget) { babel({ babelHelpers: "bundled", extensions: [".ts", ".js", ".jsx", ".es6", ".es", ".mjs"], + presets: ["@babel/preset-typescript"], + plugins: [ + "near-sdk-js/lib/build-tools/include-bytes.js", + "near-sdk-js/lib/build-tools/near-bindgen-exporter.js", + ["@babel/plugin-proposal-decorators", { version: "legacy" }], + ], }), ], }); diff --git a/examples/babel.config.json b/examples/babel.config.json deleted file mode 100644 index e1d15560..00000000 --- a/examples/babel.config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - "near-sdk-js/lib/build-tools/include-bytes", - "near-sdk-js/lib/build-tools/near-bindgen-exporter", - ["@babel/plugin-proposal-decorators", { "version": "legacy" }] - ], - "presets": ["@babel/preset-typescript"] -} diff --git a/tests/babel.config.json b/tests/babel.config.json deleted file mode 100644 index e1d15560..00000000 --- a/tests/babel.config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - "near-sdk-js/lib/build-tools/include-bytes", - "near-sdk-js/lib/build-tools/near-bindgen-exporter", - ["@babel/plugin-proposal-decorators", { "version": "legacy" }] - ], - "presets": ["@babel/preset-typescript"] -} From 7e0e909ae1313a7c2c8aa36efff008825253b2f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20Vujovi=C4=87?= Date: Mon, 10 Oct 2022 22:33:15 +0200 Subject: [PATCH 2/2] chore: Fix ESLint warnings Ignore explicit any in near-bindgen Remove unused import and export unused class --- examples/src/nested-collections.ts | 3 +-- src/near-bindgen.ts | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/src/nested-collections.ts b/examples/src/nested-collections.ts index 03e0b2a6..47f63278 100644 --- a/examples/src/nested-collections.ts +++ b/examples/src/nested-collections.ts @@ -1,8 +1,7 @@ import { NearBindgen, near, call, view, UnorderedMap } from "near-sdk-js"; -import { log } from "./log"; @NearBindgen({}) -class Contract { +export class Contract { outerMap: UnorderedMap>; groups: UnorderedMap>>; diff --git a/src/near-bindgen.ts b/src/near-bindgen.ts index 250ceb31..fab5df0e 100644 --- a/src/near-bindgen.ts +++ b/src/near-bindgen.ts @@ -103,6 +103,7 @@ export function NearBindgen(options: { requireInit?: boolean; serializer?(value: unknown): string; deserializer?(value: string): unknown; + // eslint-disable-next-line @typescript-eslint/no-explicit-any }): any; export function NearBindgen({ requireInit = false,