Skip to content

Commit

Permalink
Run prettier on the whole codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Sep 11, 2023
1 parent c88b625 commit 86a345f
Show file tree
Hide file tree
Showing 22 changed files with 3,414 additions and 3,415 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 @@ -42,7 +42,7 @@
"_build": "yarn build:node && 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 }]
}
};
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,19 +3,19 @@

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

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 StellarSdk.Server(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 @@ -31,7 +31,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 @@ -55,7 +55,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 @@ -77,7 +77,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 @@ -92,13 +92,13 @@ describe("tests the /liquidity_pools endpoint", function () {
});
});

describe("tests the /accounts endpoint", function () {
describe('tests the /accounts endpoint', function () {
const server = new StellarSdk.Server(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 @@ -115,13 +115,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 @@ -139,9 +139,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 @@ -157,7 +157,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
24 changes: 12 additions & 12 deletions test/integration/client_headers_test.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
const http = require("http");
const url = require("url");
const http = require('http');
const url = require('url');
const port = 3100;

const versionPattern = /^[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+(\.[0-9])?)?$/;

describe("integration tests: client headers", function (done) {
if (typeof window !== "undefined") {
describe('integration tests: client headers', function (done) {
if (typeof window !== 'undefined') {
done();
return;
}

it("sends client via headers", function (done) {
it('sends client via headers', function (done) {
let server;

const requestHandler = (request, response) => {
expect(request.headers["x-client-name"]).to.be.equal("js-stellar-sdk");
expect(request.headers["x-client-version"]).to.match(versionPattern);
expect(request.headers['x-client-name']).to.be.equal('js-stellar-sdk');
expect(request.headers['x-client-version']).to.match(versionPattern);
response.end();
server.close(() => done());
};
Expand All @@ -33,15 +33,15 @@ describe("integration tests: client headers", function (done) {
});
});

it("sends client data via get params when streaming", function (done) {
it('sends client data via get params when streaming', function (done) {
let server;
let closeStream;

const requestHandler = (request, response) => {
// eslint-disable-next-line node/no-deprecated-api
let query = url.parse(request.url, true).query;
expect(query["X-Client-Name"]).to.be.equal("js-stellar-sdk");
expect(query["X-Client-Version"]).to.match(versionPattern);
expect(query['X-Client-Name']).to.be.equal('js-stellar-sdk');
expect(query['X-Client-Version']).to.match(versionPattern);
response.end();
server.close(() => {
closeStream();
Expand All @@ -57,13 +57,13 @@ describe("integration tests: client headers", function (done) {
}

closeStream = new StellarSdk.Server(`http://localhost:${port}`, {
allowHttp: true,
allowHttp: true
})
.operations()
.stream({
onerror: (err) => {
done(err);
},
}
});
});
});
Expand Down
Loading

0 comments on commit 86a345f

Please sign in to comment.