Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Sep 15, 2023
1 parent aa9f9d6 commit 90df6de
Show file tree
Hide file tree
Showing 40 changed files with 4,131 additions and 4,122 deletions.
12 changes: 6 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module.exports = {
env: {
es6: true,
es6: true
},
extends: ["airbnb-base", "prettier"],
plugins: ["@babel", "prettier", "prefer-import"],
parser: "@babel/eslint-parser",
extends: ['airbnb-base', 'prettier'],
plugins: ['@babel', 'prettier', 'prefer-import'],
parser: '@babel/eslint-parser',
rules: {
"node/no-unpublished-require": 0,
},
'node/no-unpublished-require': 0
}
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"_build": "yarn build:node && yarn build:test && yarn build:browser",
"_babel": "babel --extensions '.ts' --out-dir lib/ src/",
"_nyc": "nyc --nycrc-path config/.nycrc",
"_prettier": "prettier --ignore-path config/.prettierignore --write './**/*.js'"
"_prettier": "prettier --config config/prettier.config.js --ignore-path config/.prettierignore --write './**/*.js'"
},
"husky": {
"hooks": {
Expand Down
50 changes: 25 additions & 25 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
module.exports = {
env: {
es6: true,
es6: true
},
rules: {
// OFF
"import/prefer-default-export": 0,
"node/no-unsupported-features/es-syntax": 0,
"node/no-unsupported-features/es-builtins": 0,
'import/prefer-default-export': 0,
'node/no-unsupported-features/es-syntax': 0,
'node/no-unsupported-features/es-builtins': 0,
camelcase: 0,
"class-methods-use-this": 0,
"linebreak-style": 0,
"new-cap": 0,
"no-param-reassign": 0,
"no-underscore-dangle": 0,
"no-use-before-define": 0,
"prefer-destructuring": 0,
"lines-between-class-members": 0,
'class-methods-use-this': 0,
'linebreak-style': 0,
'new-cap': 0,
'no-param-reassign': 0,
'no-underscore-dangle': 0,
'no-use-before-define': 0,
'prefer-destructuring': 0,
'lines-between-class-members': 0,

// WARN
"prefer-import/prefer-import-over-require": [1],
"no-console": ["warn", { allow: ["assert"] }],
"no-debugger": 1,
"no-unused-vars": 1,
"arrow-body-style": 1,
"valid-jsdoc": [
'prefer-import/prefer-import-over-require': [1],
'no-console': ['warn', { allow: ['assert'] }],
'no-debugger': 1,
'no-unused-vars': 1,
'arrow-body-style': 1,
'valid-jsdoc': [
1,
{
requireReturnDescription: false,
},
requireReturnDescription: false
}
],
"prefer-const": 1,
"object-shorthand": 1,
"require-await": 1,
'prefer-const': 1,
'object-shorthand': 1,
'require-await': 1,

// ERROR
"no-unused-expressions": [2, { allowTaggedTemplates: true }],
},
'no-unused-expressions': [2, { allowTaggedTemplates: true }]
}
};
6 changes: 3 additions & 3 deletions src/browser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* tslint:disable:no-var-requires */

export * from "./index";
export * as StellarBase from "stellar-base";
export * from './index';
export * as StellarBase from 'stellar-base';

import axios from "axios"; // idk why axios is weird
import axios from 'axios'; // idk why axios is weird
export { axios };

export default module.exports;
56 changes: 28 additions & 28 deletions src/soroban/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
module.exports = {
env: {
es6: true,
es6: true
},
parser: "@babel/eslint-parser",
extends: ["airbnb-base", "prettier"],
plugins: ["prettier", "prefer-import"],
parser: '@babel/eslint-parser',
extends: ['airbnb-base', 'prettier'],
plugins: ['prettier', 'prefer-import'],
rules: {
// OFF
"import/prefer-default-export": 0,
"node/no-unsupported-features/es-syntax": 0,
"node/no-unsupported-features/es-builtins": 0,
'import/prefer-default-export': 0,
'node/no-unsupported-features/es-syntax': 0,
'node/no-unsupported-features/es-builtins': 0,
camelcase: 0,
"class-methods-use-this": 0,
"linebreak-style": 0,
"new-cap": 0,
"no-param-reassign": 0,
"no-underscore-dangle": 0,
"no-use-before-define": 0,
"prefer-destructuring": 0,
"lines-between-class-members": 0,
'class-methods-use-this': 0,
'linebreak-style': 0,
'new-cap': 0,
'no-param-reassign': 0,
'no-underscore-dangle': 0,
'no-use-before-define': 0,
'prefer-destructuring': 0,
'lines-between-class-members': 0,

// WARN
"prefer-import/prefer-import-over-require": [1],
"no-console": ["warn", { allow: ["assert"] }],
"no-debugger": 1,
"no-unused-vars": 1,
"arrow-body-style": 1,
"valid-jsdoc": [
'prefer-import/prefer-import-over-require': [1],
'no-console': ['warn', { allow: ['assert'] }],
'no-debugger': 1,
'no-unused-vars': 1,
'arrow-body-style': 1,
'valid-jsdoc': [
1,
{
requireReturnDescription: false,
},
requireReturnDescription: false
}
],
"prefer-const": 1,
"object-shorthand": 1,
"require-await": 1,
'prefer-const': 1,
'object-shorthand': 1,
'require-await': 1,

// ERROR
"no-unused-expressions": [2, { allowTaggedTemplates: true }],
},
'no-unused-expressions': [2, { allowTaggedTemplates: true }]
}
};
10 changes: 5 additions & 5 deletions src/soroban/axios.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import axios from "axios";
import axios from 'axios';

/* tslint:disable-next-line:no-var-requires */
export const version = require("../../package.json").version;
export const version = require('../../package.json').version;
export const AxiosClient = axios.create({
headers: {
"X-Client-Name": "js-soroban-client",
"X-Client-Version": version,
},
'X-Client-Name': 'js-soroban-client',
'X-Client-Version': version
}
});

export default AxiosClient;
6 changes: 3 additions & 3 deletions src/soroban/browser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* tslint:disable:no-var-requires */

export * from "./index";
export * as StellarBase from "stellar-base";
export * from './index';
export * as StellarBase from 'stellar-base';

import axios from "axios"; // idk why axios is weird
import axios from 'axios'; // idk why axios is weird
export { axios };

export default module.exports;
10 changes: 5 additions & 5 deletions src/soroban/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
/// <reference path="../../types/dom-monkeypatch.d.ts" />

// Expose all types
export * from "./soroban_rpc";
export * from './soroban_rpc';

// stellar-sdk classes to expose
export { Server as SorobanServer } from "./server";
export { default as AxiosClient } from "./axios";
export * from "./transaction";
export * from "./contract_spec";
export { Server as SorobanServer } from './server';
export { default as AxiosClient } from './axios';
export * from './transaction';
export * from './contract_spec';

export default module.exports;
8 changes: 4 additions & 4 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module.exports = {
env: {
mocha: true,
mocha: true
},
globals: {
StellarSdk: true,
axios: true,
chai: true,
sinon: true,
expect: true,
HorizonAxiosClient: true,
HorizonAxiosClient: true
},
rules: {
"no-unused-vars": 0,
},
'no-unused-vars': 0
}
};
36 changes: 18 additions & 18 deletions test/integration/apiary.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

// All endpoints from here are tested:
// https://docs.google.com/document/d/1pXL8kr1a2vfYSap9T67R-g72B_WWbaE1YsLMa04OgoU/edit
const _ = require("lodash");
const _ = require('lodash');
const { HorizonServer } = StellarSdk;

const MOCK_SERVER = "https://private-d133c-ammmock.apiary-mock.com";
const MOCK_SERVER = 'https://private-d133c-ammmock.apiary-mock.com';

describe("tests the /liquidity_pools endpoint", function () {
describe('tests the /liquidity_pools endpoint', function () {
const lpId =
"0569b19c75d7ecadce50501fffad6fe8ba4652455df9e1cc96dc408141124dd5";
'0569b19c75d7ecadce50501fffad6fe8ba4652455df9e1cc96dc408141124dd5';
const server = new HorizonServer(MOCK_SERVER, { allowHttp: true });

it("GET /", function (done) {
it('GET /', function (done) {
chai
.request(MOCK_SERVER)
.get("/liquidity_pools")
.get('/liquidity_pools')
.end(function (err, res) {
if (err != null) done(err);
expect(res.body).not.to.be.null;
Expand All @@ -32,7 +32,7 @@ describe("tests the /liquidity_pools endpoint", function () {
});
});

it("GET /<pool-id>", function (done) {
it('GET /<pool-id>', function (done) {
chai
.request(MOCK_SERVER)
.get(`/liquidity_pools/${lpId}`)
Expand All @@ -56,7 +56,7 @@ describe("tests the /liquidity_pools endpoint", function () {
effects: server.effects(),
operations: server.operations(),
trades: server.trades(),
transactions: server.transactions(),
transactions: server.transactions()
};

Object.keys(testCases).forEach((suffix) => {
Expand All @@ -78,7 +78,7 @@ describe("tests the /liquidity_pools endpoint", function () {
// TransactionRecord values don't map 1-to-1 to the JSON (see
// e.g. the ledger vs. ledger_attr properties), so we do a "best
// effort" validation by checking that at least the keys exist.
if (suffix === "transactions") {
if (suffix === 'transactions') {
record = Object.keys(record);
expectedRecord = Object.keys(expectedRecord);
}
Expand All @@ -93,13 +93,13 @@ describe("tests the /liquidity_pools endpoint", function () {
});
});

describe("tests the /accounts endpoint", function () {
describe('tests the /accounts endpoint', function () {
const server = new HorizonServer(MOCK_SERVER, { allowHttp: true });

it("GET /", function (done) {
it('GET /', function (done) {
chai
.request(MOCK_SERVER)
.get("/accounts")
.get('/accounts')
.end(function (err, res) {
if (err != null) return done(err);
expect(res.body).not.to.be.null;
Expand All @@ -116,13 +116,13 @@ describe("tests the /accounts endpoint", function () {
});
});

it("GET /?liquidity_pool=<pool-id>", function (done) {
it('GET /?liquidity_pool=<pool-id>', function (done) {
const lpId =
"0569b19c75d7ecadce50501fffad6fe8ba4652455df9e1cc96dc408141124dd5";
'0569b19c75d7ecadce50501fffad6fe8ba4652455df9e1cc96dc408141124dd5';

chai
.request(MOCK_SERVER)
.get("/accounts")
.get('/accounts')
.query({ liquidity_pool: lpId })
.end(function (err, res) {
if (err != null) return done(err);
Expand All @@ -140,9 +140,9 @@ describe("tests the /accounts endpoint", function () {
});
});

it("GET /<account-id>", function (done) {
it('GET /<account-id>', function (done) {
const accountId =
"GDQNY3PBOJOKYZSRMK2S7LHHGWZIUISD4QORETLMXEWXBI7KFZZMKTL3";
'GDQNY3PBOJOKYZSRMK2S7LHHGWZIUISD4QORETLMXEWXBI7KFZZMKTL3';

chai
.request(MOCK_SERVER)
Expand All @@ -158,7 +158,7 @@ describe("tests the /accounts endpoint", function () {
.then((resp) => {
// find the pool share balance(s)
const poolShares = resp.balances.filter(
(b) => b.asset_type === "liquidity_pool_shares",
(b) => b.asset_type === 'liquidity_pool_shares'
);

expect(poolShares).to.have.lengthOf(1);
Expand Down
Loading

0 comments on commit 90df6de

Please sign in to comment.