Skip to content

Commit

Permalink
Prettier: smaller diff
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Sep 15, 2023
1 parent 90df6de commit df2526d
Show file tree
Hide file tree
Showing 38 changed files with 3,008 additions and 3,008 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ module.exports = {
env: {
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
}
};
18 changes: 9 additions & 9 deletions config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
const webpackConfig = require('./webpack.config.browser.js');
const webpackConfig = require("./webpack.config.browser.js");

delete webpackConfig.output;
delete webpackConfig.entry; // karma fills these in
webpackConfig.plugins.shift(); // drop eslinter plugin

module.exports = function (config) {
config.set({
frameworks: ['mocha', 'sinon-chai'],
browsers: ['FirefoxHeadless', 'ChromeHeadless'],
frameworks: ["mocha", "sinon-chai"],
browsers: ["FirefoxHeadless", "ChromeHeadless"],

files: [
'../dist/stellar-sdk.js', // webpack should build this first
'../test/test-browser.js',
'../test/unit/**/*.js'
"../dist/stellar-sdk.js", // webpack should build this first
"../test/test-browser.js",
"../test/unit/**/*.js"
],

preprocessors: {
'../test/**/*.js': ['webpack']
"../test/**/*.js": ["webpack"]
},

webpack: webpackConfig,
Expand All @@ -27,9 +27,9 @@ module.exports = function (config) {
colors: true,
singleRun: true,

reporters: ['dots', 'coverage'],
reporters: ["dots", "coverage"],
coverageReporter: {
type: 'text-summary',
type: "text-summary",
instrumenterOptions: {
istanbul: { noCompact: true }
}
Expand Down
10 changes: 5 additions & 5 deletions config/prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
arrowParens: 'always',
arrowParens: "always",
bracketSpacing: true,
bracketSameLine: false,
printWidth: 80,
proseWrap: 'always',
proseWrap: "always",
semi: true,
singleQuote: true,
singleQuote: false,
tabWidth: 2,
parser: 'babel',
trailingComma: 'none',
parser: "babel",
trailingComma: "none",
useTabs: false
};
40 changes: 20 additions & 20 deletions config/webpack.config.browser.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
var path = require('path');
var webpack = require('webpack');
var path = require("path");
var webpack = require("webpack");

var ESLintPlugin = require('eslint-webpack-plugin');
var TerserPlugin = require('terser-webpack-plugin');
var NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
var ESLintPlugin = require("eslint-webpack-plugin");
var TerserPlugin = require("terser-webpack-plugin");
var NodePolyfillPlugin = require("node-polyfill-webpack-plugin");

const config = {
target: 'web',
target: "web",
// https://stackoverflow.com/a/34018909
entry: {
'stellar-sdk': path.resolve(__dirname, '../src/browser.ts'),
'stellar-sdk.min': path.resolve(__dirname, '../src/browser.ts')
"stellar-sdk": path.resolve(__dirname, "../src/browser.ts"),
"stellar-sdk.min": path.resolve(__dirname, "../src/browser.ts")
},
resolve: {
fallback: {
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer')
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
buffer: require.resolve("buffer")
},
extensions: ['.ts', '.js']
extensions: [".ts", ".js"]
},
output: {
clean: true,
library: 'StellarSdk',
library: "StellarSdk",
compareBeforeEmit: true,
path: path.resolve(__dirname, '../dist')
path: path.resolve(__dirname, "../dist")
},
mode: process.env.NODE_ENV ?? 'development',
devtool: process.env.NODE_ENV === 'production' ? false : 'inline-source-map',
mode: process.env.NODE_ENV ?? "development",
devtool: process.env.NODE_ENV === "production" ? false : "inline-source-map",
module: {
rules: [
{
test: /\.m?(ts|js)$/,
exclude: /node_modules\/(?!(stellar-base|js-xdr))/,
use: {
loader: 'babel-loader',
loader: "babel-loader",
options: {
cacheDirectory: true
}
Expand All @@ -58,15 +58,15 @@ const config = {
plugins: [
// this must be first for karma to work (see line 5 of karma.conf.js)
new ESLintPlugin({
overrideConfigFile: path.resolve(__dirname, '../.eslintrc.js')
overrideConfigFile: path.resolve(__dirname, "../.eslintrc.js")
}),
// Ignore native modules (sodium-native)
new webpack.IgnorePlugin({ resourceRegExp: /sodium-native/ }),
new NodePolyfillPlugin({
includeAliases: ['http', 'https'] // others aren't needed
includeAliases: ["http", "https"] // others aren't needed
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer']
Buffer: ["buffer", "Buffer"]
})
],
watchOptions: {
Expand Down
42 changes: 21 additions & 21 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@ module.exports = {
},
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
}
],
'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 }]
}
};
48 changes: 24 additions & 24 deletions src/soroban/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@ module.exports = {
env: {
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
}
],
'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 }]
}
};
2 changes: 1 addition & 1 deletion test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ module.exports = {
HorizonAxiosClient: true
},
rules: {
'no-unused-vars': 0
"no-unused-vars": 0
}
};
34 changes: 17 additions & 17 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 Down Expand Up @@ -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 df2526d

Please sign in to comment.