Skip to content

Commit

Permalink
chore: add relative link lint for lint:md-links (#2218)
Browse files Browse the repository at this point in the history
* Added linting for relative markdown links

* Ignore new lint rule

* Removed redundant README

* Added missing LICENSE files

* Consistent file extension usage

* Fixed broken relative links

* Spacing steps

* Testing new linting arrangement

* Moved validate:test back to tests

* Separate tests from linting

* Changeset

* Ignore temperamental dead-links

* Merge branch 'master' into ps/fix/linting-markdown-links

* Fixed issues with relative links

* Ignore thebitcoinmanual

* Update .knip.json

Co-authored-by: Chad Nehemiah <[email protected]>

* Changeset

* Revert "Changeset"

This reverts commit dd41710.

---------

Co-authored-by: Chad Nehemiah <[email protected]>
  • Loading branch information
petertonysmith94 and maschad authored May 15, 2024
1 parent 30fa103 commit 6c2be7f
Show file tree
Hide file tree
Showing 29 changed files with 736 additions and 135 deletions.
4 changes: 4 additions & 0 deletions .changeset/twenty-hornets-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: add relative link lint for `lint:md-links`
47 changes: 47 additions & 0 deletions .github/workflows/code-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Lint Code"

on:
pull_request:
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
docs:
uses: FuelLabs/github-actions/.github/workflows/vp-docs.yml@master
with:
doc-folder-path: "apps/docs/src"
spellcheck-config-path: "apps/docs/.spellcheck.yml"

lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Checkout
uses: actions/checkout@v3

- name: CI Setup
uses: ./.github/actions/test-setup

- name: Verify package.json integrity
run: pnpm lint:package-jsons

- name: Verify package exports integrity
run: pnpm verify:package-exports

- name: Forc Format Check
run: pnpm forc:check

# linting of some tests depends on pretest being run so that it generates the necessary files
- name: Pretest
run: pnpm pretest

- name: Lint
run: pnpm lint

- name: Lint markdown files
run: pnpm lint:md-links
22 changes: 0 additions & 22 deletions .github/workflows/md-lint.yaml

This file was deleted.

23 changes: 1 addition & 22 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ concurrency:
cancel-in-progress: true

jobs:
docs:
uses: FuelLabs/github-actions/.github/workflows/vp-docs.yml@master
with:
doc-folder-path: "apps/docs/src"
spellcheck-config-path: "apps/docs/.spellcheck.yml"

environments:
runs-on: ubuntu-latest
# name will be node@<version> or browser
Expand All @@ -40,22 +34,6 @@ jobs:
with:
node-version: ${{ matrix.env.version || 20 }}

- name: Verify package.json integrity
run: pnpm lint:package-jsons

- name: Verify package exports integrity
run: pnpm verify:package-exports

- name: Forc Format Check
run: pnpm forc:check

# linting of some tests depends on pretest being run so that it generates the necessary files
- name: Pretest
run: pnpm pretest

- name: Lint
run: pnpm lint

- name: Validate Tests
run: pnpm test:validate

Expand Down Expand Up @@ -150,6 +128,7 @@ jobs:
comment_tag: diff
mode: recreate
create_if_not_exists: true

create-changeset:
name: Create Changeset
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"open",
"textlint",
"textlint-rule-no-dead-link",
"@elasticpath/textlint-rule-no-dead-relative-link",
"tree-kill",
"ts-generator",
"webdriverio"
Expand Down
5 changes: 4 additions & 1 deletion .textlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
"plugins": {},
"filters": {},
"rules": {
"@elasticpath/no-dead-relative-link": true,
"no-dead-link": {
"ignoreRedirects": true,
"checkRelative": false,
"ignore": [
"https://learnmeabitcoin.com/**",
"https://faucet-beta-5.fuel.network/"
"https://faucet-beta-5.fuel.network/",
"https://thebitcoinmanual.com/**",
"https://forum.fuel.network/"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pnpm link --global @fuel-ts/wallet
See also:

- [Developing](#Developing)
- [Developing](#developing)

# Testing

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/src/guide/fuels-cli/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Examples:
npx fuels@{{fuels}} build
```

1. Build all Sway programs under your `workspace` using `forc` <sup>[1](#commands-for-wrapped-utiltities)</sup>
1. Generate types for them using `fuels-typegen` <sup>[2](#typegen)</sup>
1. Build all Sway programs under your `workspace` using `forc` <sup>[1](https://docs.fuel.network/docs/forc/commands/forc_build/)</sup>
1. Generate types for them using `fuels-typegen` <sup>[2](#fuels-typegen)</sup>

```console-vue
npx fuels@{{fuels}} build --deploy
Expand Down Expand Up @@ -155,7 +155,7 @@ For more info, check:

## `fuels versions`

Check for version incompatibilities between your [Fuel Toolchain](#the-fuel-toolchain) component versions, matching them against the ones supported by the Typescript SDK version that you have.
Check for version incompatibilities between your [Fuel Toolchain](https://docs.fuel.network/docs/sway/introduction/fuel_toolchain/#the-fuel-toolchain) component versions, matching them against the ones supported by the Typescript SDK version that you have.

```console-vue
npx fuels@{{fuels}} versions
Expand Down
6 changes: 3 additions & 3 deletions apps/docs/src/guide/fuels-cli/generating-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ pnpm fuels typegen -i ./abis/*-abi.json -o ./types --predicate

See also:

- [Using Generated Contract Types](./using-generated-types.md#using-generated-contract-types)
- [Using Generated Script Types](./using-generated-types.md#using-generated-script-types)
- [Using Generated Predicate Types](./using-generated-types.md#using-generated-predicate-types)
- [Using Generated Contract Types](./using-generated-types.md#contract)
- [Using Generated Script Types](./using-generated-types.md#script)
- [Using Generated Predicate Types](./using-generated-types.md#predicate)
2 changes: 1 addition & 1 deletion apps/docs/src/guide/fuels-cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ npx fuels@{{fuels}} -v

## Next Step

Use [`pnpm fuels init`](./commands#init) to create a [`fuel.config.ts`](./config-file) file.
Use [`pnpm fuels init`](./commands.md#fuels-init) to create a [`fuel.config.ts`](./config-file.md) file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Firstly, you will need a local node running on your machine. We recommend one of the following methods:

- [Testing utilities](/guide/testing/index.md#wallet-test-utilities) can assist in programmatically launching a short-lived node.
- Running [fuel-core](https://docs.fuel.network/guides/running-a-node/running-a-local-node/) directly, or via the CLI [fuels](/guide/fuels-cli/commands.md#fuels-core).
- [Testing utilities](../testing/index.md#wallet-test-utilities) can assist in programmatically launching a short-lived node.
- Running [fuel-core](https://docs.fuel.network/guides/running-a-node/running-a-local-node/) directly, or via the CLI [fuels](../fuels-cli/commands.md#fuels-core).

In the following example, we create a provider to connect to the local node and sign a message.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ We have some useful resources for the Testnet:

---

In the example below, we connect a [Provider](/guide/provider/index.md) to the latest testnet and create a new wallet from a private key.
In the example below, we connect a [Provider](../provider/index.md) to the latest testnet and create a new wallet from a private key.

> **Note:** New wallets on the Testnet will not have any assets! You can use the [Faucet](https://faucet-beta-5.fuel.network/) to fund your wallet.
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/guide/provider/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Provider

The [`Provider`](/api/Account/Provider.md) lets you connect to a Fuel node ([_*local*_](/guide/getting-started/connecting-to-a-local-node.md) or [_*external*_](/guide/getting-started/connecting-to-testnet.md)) and interact with it, encapsulating common client operations in the SDK. Those operations include querying the blockchain for network, block, and transaction-related info (and [more](/api/Account/Provider.md)), as well as sending [transactions](/guide/transactions/index.md) to the blockchain.
The [`Provider`](../../api/Account/Provider.md) lets you connect to a Fuel node ([_*local*_](../getting-started/connecting-to-a-local-node.md) or [_*external*_](../getting-started/connecting-to-testnet.md)) and interact with it, encapsulating common client operations in the SDK. Those operations include querying the blockchain for network, block, and transaction-related info (and [more](../../api/Account/Provider.md)), as well as sending [transactions](../transactions/index.md) to the blockchain.

All higher-level abstractions (e.g. [`Wallet`](/guide/wallets/index.md), [`Contract`](/guide/contracts/index.md)) that interact with the blockchain go through the `Provider`, so it's used for various actions like getting a wallet's balance, deploying contracts, querying their state, etc.
All higher-level abstractions (e.g. [`Wallet`](../wallets/index.md), [`Contract`](../contracts/index.md)) that interact with the blockchain go through the `Provider`, so it's used for various actions like getting a wallet's balance, deploying contracts, querying their state, etc.

<<< @/../../docs-snippets/src/guide/provider/provider.test.ts#provider-definition{ts:line-numbers}

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/guide/provider/querying-the-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Once you have set up a provider, you're ready to interact with the Fuel blockcha

We can connect to either a _*local*_ or an _*external*_ node:

> 1. _Running a [local node](/guide/getting-started/connecting-to-a-local-node.md)_
> 1. _Connecting to an [external node](/guide/getting-started/connecting-to-testnet.md)_
> 1. _Running a [local node](../getting-started/connecting-to-a-local-node.md)_
> 1. _Connecting to an [external node](../getting-started/connecting-to-testnet.md)_
Let's look at a few examples below.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/guide/types/address.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

In Sway, the [`Address`](../../api/Address/Address.md) type serves as a type-safe wrapper around the primitive `b256` type. The SDK takes a different approach and has its own abstraction for the [Address](../../api/Address/Address.md) type.

## [`AbstractAddress`](../../api/Interfaces/AbstractAddress.md) Class
## `AbstractAddress` Class

The SDK defines the [AbstractAddress](../../api/Interfaces/AbstractAddress.md) class, which provides a set of utility functions for easy manipulation and conversion between address formats.

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/guide/utilities/address-conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ And by using the `isB256` and `toBech32` utilities:

## Converting a Contract ID

The Contract `id` property has the [`AbstractAddress`](../types/address#abstractaddress-class) type. Therefore, it can be converted using the [`Address`](../../api/Address/Address.md) class functions such as `toAddress` and `toB256`:
The Contract `id` property has the [`AbstractAddress`](../types/address.md#abstractaddress-class) type. Therefore, it can be converted using the [`Address`](../../api/Address/Address.md) class functions such as `toAddress` and `toB256`:

<<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-2{ts:line-numbers}

## Converting a Wallet Address

Similarly, the Wallet `address` property is also of type [`AbstractAddress`](../types/address#abstractaddress-class) and can therefore use the same [`Address`](../../api/Address/Address.md) class functions for conversion:
Similarly, the Wallet `address` property is also of type [`AbstractAddress`](../types/address.md#abstractaddress-class) and can therefore use the same [`Address`](../../api/Address/Address.md) class functions for conversion:

<<< @/../../docs-snippets/src/guide/types/conversion.test.ts#conversion-3{ts:line-numbers}

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/guide/wallets/checking-balances.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Each UTXO corresponds to a unique coin and has an associated amount. This model

## Getting a Wallet's Balance

To check the balance of a specific asset, you can use [`getBalance`](../../api/Account/Account.html#getbalance) method. This function aggregates the amounts of all unspent coins of the given asset in your wallet.
To check the balance of a specific asset, you can use [`getBalance`](../../api/Account/Account.md#getbalance) method. This function aggregates the amounts of all unspent coins of the given asset in your wallet.

<<< @/../../docs-snippets/src/guide/wallets/checking-balances.test.ts#checking-balances-1{ts:line-numbers}

To retrieve the balances of all assets in your wallet, use the [`getBalances`](../../api/Account/Account.html#getbalances) method, it returns an array of [`CoinQuantity`](../../api/Account/#coinquantity). This is useful for getting a comprehensive view of your holdings.
To retrieve the balances of all assets in your wallet, use the [`getBalances`](../../api/Account/Account.md#getbalances) method, it returns an array of [`CoinQuantity`](../../api/Account/index.md#coinquantity). This is useful for getting a comprehensive view of your holdings.

<<< @/../../docs-snippets/src/guide/wallets/checking-balances.test.ts#checking-balances-2{ts:line-numbers}
8 changes: 4 additions & 4 deletions apps/docs/src/guide/wallets/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Wallets can be used for many important things, for instance:

The SDK has multiple classes related to a Wallet instance:

- [Wallet](../../api/Account/Wallet): Works simply like a wrapper providing methods to create and instantiating `WalletUnlocked` and `WalletLocked` instances.
- [Wallet](../../api/Account/Wallet.md): Works simply like a wrapper providing methods to create and instantiating `WalletUnlocked` and `WalletLocked` instances.

- [WalletLocked](../../api/Account/WalletLocked): Provides the functionalities for a locked wallet.
- [WalletLocked](../../api/Account/WalletLocked.md): Provides the functionalities for a locked wallet.

- [WalletUnlocked](../../api/Account/WalletUnlocked): Provides the functionalities for an unlocked wallet.
- [WalletUnlocked](../../api/Account/WalletUnlocked.md): Provides the functionalities for an unlocked wallet.

- [Account](../../api/Account/Account): Provides an abstraction with basic functionalities for wallets or accounts to interact with the network. It is essential to notice that both `WalletLocked` and `WalletUnlocked` extend from the `Account` class.
- [Account](../../api/Account/Account.md): Provides an abstraction with basic functionalities for wallets or accounts to interact with the network. It is essential to notice that both `WalletLocked` and `WalletUnlocked` extend from the `Account` class.

Let's explore these different approaches in the following sub-chapters.

Expand Down
8 changes: 4 additions & 4 deletions apps/docs/src/guide/wallets/instantiating-wallets.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Wallets can be instantiated in multiple ways within the SDK.

## Generating new wallets

To generate a new, unlocked wallet, use the [`generate`](../../api/Account/Wallet.html#generate) method. This method creates a new [`WalletUnlocked`](../../api/Account/WalletUnlocked) instance, which is immediately ready for use.
To generate a new, unlocked wallet, use the [`generate`](../../api/Account/Wallet.md#generate) method. This method creates a new [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) instance, which is immediately ready for use.

<<< @/../../docs-snippets/src/guide/wallets/instantiating-wallets.test.ts#instantiating-wallets-1{ts:line-numbers}

## Instantiating Unlocked Wallets

Creating [`WalletUnlocked`](../../api/Account/WalletUnlocked) instances of your existing wallets is easy and can be done in several ways:
Creating [`WalletUnlocked`](../../api/Account/WalletUnlocked.md) instances of your existing wallets is easy and can be done in several ways:

From a private key:

Expand Down Expand Up @@ -38,13 +38,13 @@ It's possible to instantiate a `WalletUnlocked` from a `WalletLocked`:

## Instantiating Locked Wallets

You can also instantiate [`WalletLocked`](../../api/Account/WalletLocked) instances using just the wallet address:
You can also instantiate [`WalletLocked`](../../api/Account/WalletLocked.md) instances using just the wallet address:

<<< @/../../docs-snippets/src/guide/wallets/instantiating-wallets.test.ts#instantiating-wallets-8{ts:line-numbers}

## Connecting to a Provider

While wallets can be used independently of a [`Provider`](../../api/Account/Provider), operations requiring blockchain interaction will need one.
While wallets can be used independently of a [`Provider`](../../api/Account/Provider.md), operations requiring blockchain interaction will need one.

Connecting an existing wallet to a Provider:

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/guide/wallets/wallet-transferring.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ You can transfer assets to a deployed contract instance by using its `id`:

<<< @/../../docs-snippets/src/guide/wallets/wallet-transferring.test.ts#wallet-transferring-4{ts:line-numbers}

Alternatively, you can simply use the contract's string address in the [`Bech32`](../types/bech32) format:
Alternatively, you can simply use the contract's string address in the [`Bech32`](../types/bech32.md) format:

<<< @/../../docs-snippets/src/guide/wallets/wallet-transferring.test.ts#wallet-transferring-5{ts:line-numbers}

# Balances

Before transferring assets, ensure your wallet has sufficient funds. Attempting a transfer without enough funds will result in an error: `not enough coins to fit the target`.

You can see how to check your balance at the [`checking-balances`](./checking-balances) page.
You can see how to check your balance at the [`checking-balances`](./checking-balances.md) page.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"@changesets/get-github-info": "^0.5.2",
"@changesets/read": "^0.6.0",
"@changesets/types": "^6.0.0",
"@elasticpath/textlint-rule-no-dead-relative-link": "^1.1.1",
"@fuel-ts/forc": "workspace:*",
"@fuel-ts/fuel-core": "workspace:*",
"@fuel-ts/utils": "workspace:*",
Expand Down
8 changes: 5 additions & 3 deletions packages/abi-typegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ See the full ABI-spec [here](https://github.com/FuelLabs/fuel-specs/blob/master/
# Table of contents

- [Documentation](#documentation)
- [Usage](#usage)
- [Installation](#installation)
- [Installation](#installation)
- [Help](#help)
- [Generating Types](#generating-types)
- [Programmatic API](#programmatic-api)
- [Full SDK Installation](#full-sdk-installation)
- [Type's Conversion Table](#types-conversion-table)
- [Contributing](#contributing)
Expand Down Expand Up @@ -92,7 +94,7 @@ We just need to call it with the `typegen` command, and the rest feels the same.
npx fuels typegen -i ./out/debug/*-abi.json -o ./src/contracts
```

# Type's Conversion Table
## Type's Conversion Table

The table below describes how Sway types are converted from/to Typescript.

Expand Down
Loading

0 comments on commit 6c2be7f

Please sign in to comment.