Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add custom eslint rule
Sebastian Martinez committed 4 years ago
commit 55bf46729b2e3dede86f0273604eb50622bf9def
parent 582ca41e5eae5be30612f14db79e0735791f15da
6 files changed +21 -5
modified .eslintrc.json
@@ -16,7 +16,8 @@
  },
  "plugins": [
    "svelte3",
-
    "@typescript-eslint"
+
    "@typescript-eslint",
+
    "radicle"
  ],
  "overrides": [
    {
@@ -25,6 +26,7 @@
    }
  ],
  "rules": {
+
    "radicle/space-after-unary": ["error"],
    "indent": ["error", 2, { "SwitchCase": 1 }],
    "semi": "off",
    "curly": ["error", "multi-line", "consistent"],
modified package-lock.json
@@ -45,6 +45,7 @@
        "@typescript-eslint/parser": "^4.26.1",
        "cypress": "^9.3.1",
        "eslint": "^7.28.0",
+
        "eslint-plugin-radicle": "^0.2.0",
        "eslint-plugin-svelte3": "^3.2.0",
        "radicle-svelte-unit-test": "^1.0.0",
        "svelte-check": "^2.4.1",
@@ -6114,6 +6115,12 @@
        "url": "https://opencollective.com/eslint"
      }
    },
+
    "node_modules/eslint-plugin-radicle": {
+
      "version": "0.2.0",
+
      "resolved": "https://registry.npmjs.org/eslint-plugin-radicle/-/eslint-plugin-radicle-0.2.0.tgz",
+
      "integrity": "sha512-R5NxPUPkHAheLUg5bPufuNGNPOxvJVndFpqCSp+TPoHoyAcDQCiXGbH2CnBabDr67T9Lrj3p+cIDkl0VTRtSLw==",
+
      "dev": true
+
    },
    "node_modules/eslint-plugin-svelte3": {
      "version": "3.4.0",
      "resolved": "https://registry.npmjs.org/eslint-plugin-svelte3/-/eslint-plugin-svelte3-3.4.0.tgz",
@@ -16168,6 +16175,12 @@
        }
      }
    },
+
    "eslint-plugin-radicle": {
+
      "version": "0.2.0",
+
      "resolved": "https://registry.npmjs.org/eslint-plugin-radicle/-/eslint-plugin-radicle-0.2.0.tgz",
+
      "integrity": "sha512-R5NxPUPkHAheLUg5bPufuNGNPOxvJVndFpqCSp+TPoHoyAcDQCiXGbH2CnBabDr67T9Lrj3p+cIDkl0VTRtSLw==",
+
      "dev": true
+
    },
    "eslint-plugin-svelte3": {
      "version": "3.4.0",
      "resolved": "https://registry.npmjs.org/eslint-plugin-svelte3/-/eslint-plugin-svelte3-3.4.0.tgz",
modified package.json
@@ -22,6 +22,7 @@
    "@typescript-eslint/parser": "^4.26.1",
    "cypress": "^9.3.1",
    "eslint": "^7.28.0",
+
    "eslint-plugin-radicle": "^0.2.0",
    "eslint-plugin-svelte3": "^3.2.0",
    "radicle-svelte-unit-test": "^1.0.0",
    "svelte-check": "^2.4.1",
modified src/WalletConnectSigner.ts
@@ -23,7 +23,7 @@ export class WalletConnectSigner extends ethers.Signer {

  async getAddress(): Promise<string> {
    const accountAddress = this.walletConnect.accounts[0];
-
    if (!accountAddress) {
+
    if (! accountAddress) {
      throw new Error(
        "The connected wallet has no accounts or there is a connection problem"
      );
modified src/base/faucet/Index.svelte
@@ -28,7 +28,7 @@

  async function isAbleToWithdraw(amount: string): Promise<[boolean, string?]> {
    try {
-
      if (!$session) { return [false]; }
+
      if (! $session) { return [false]; }
      if (!amount || amount === "0") { return [false, "Not able to withdraw zero tokens"]; }
      if (toWei(amount).gt(maxWithdrawAmount)) return [false, `Reduce amount, max withdrawal is ${formatEther(maxWithdrawAmount)}`];
      let currentTime = new Date().getTime();
modified src/utils.ts
@@ -161,7 +161,7 @@ export function parseEnsLabel(name: string, config: Config): string {
export function clickOutside(node: HTMLElement, onEventFunction: () => void): any {
  const handleClick = (event: any) => {
    const path = event.composedPath();
-
    if (!path.includes(node)) {
+
    if (! path.includes(node)) {
      onEventFunction();
    }
  };
@@ -419,7 +419,7 @@ export async function getTokens(address: string, config: Config): Promise<Array<
  const balances = userBalances.tokenBalances.filter((token: any) => {
    // alchemy_getTokenBalances sometimes returns 0x and this does not work well with ethers.BigNumber
    if (token.tokenBalance !== "0x") {
-
      if (!BigNumber.from(token.tokenBalance).isZero()) {
+
      if (! BigNumber.from(token.tokenBalance).isZero()) {
        return token;
      }
    }