Skip to content

Commit

Permalink
Fixup linting and clean up yarn scripts
Browse files Browse the repository at this point in the history
Add jsdoc support
  • Loading branch information
Shaptic committed Apr 11, 2023
1 parent f2524f6 commit 32bf736
Show file tree
Hide file tree
Showing 26 changed files with 900 additions and 1,096 deletions.
6 changes: 3 additions & 3 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",
rules: {
"node/no-unpublished-require": 0
}
"node/no-unpublished-require": 0,
},
};
2 changes: 1 addition & 1 deletion .jsdoc.json → config/.jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"exclude": "js-stellar-base/src/generated"
},
"opts": {
"destination": "./jsdoc/",
"destination": "jsdoc/",
"recurse": true,
"template": "node_modules/minami",
"readme": "README.md"
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions karma.conf.js → config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ module.exports = function (config) {
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 Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const config = {
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: {
Expand All @@ -24,7 +24,7 @@ const config = {
clean: true,
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",
Expand Down Expand Up @@ -58,7 +58,7 @@ 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/ }),
Expand Down
192 changes: 0 additions & 192 deletions gulpfile.js

This file was deleted.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,20 @@
"build": "cross-env NODE_ENV=development yarn _build",
"build:prod": "cross-env NODE_ENV=production yarn _build",
"build:node": "babel --extensions '.ts' --out-dir lib/ src/",
"build:browser": "webpack -c ./webpack.config.browser.js",
"build:browser": "webpack -c config/webpack.config.browser.js",
"clean": "rm -rf lib/ dist/ coverage/ .nyc_output/",
"docs": "TODO",
"docs": "jsdoc -c ./config/.jsdoc.json --verbose",
"test": "yarn test:node && yarn test:integration && yarn test:browser",
"test:node": "yarn _nyc mocha --recursive 'test/unit/**/*.js'",
"test:integration": "yarn _nyc mocha --recursive 'test/integration/**/*.js'",
"test:browser": "karma start ./karma.conf.js",
"lint": "eslint -c ./.eslintrc.js src/",
"fmt": "prettier --config prettier.config.js --ignore-path ./.prettierignore --write './**/*.js'",
"preversion": "yarn clean && yarn pretty && yarn build:prod && yarn test",
"test:browser": "karma start config/karma.conf.js",
"lint": "eslint -c .eslintrc.js src/",
"fmt": "yarn lint --fix && yarn _prettier",
"preversion": "yarn clean && yarn fmt && yarn lint && yarn build:prod && yarn test",
"prepare": "yarn build:prod",
"_build": "yarn build:node && yarn build:browser",
"_nyc": "nyc --nycrc-path ./.nycrc"
"_nyc": "nyc --nycrc-path config/.nycrc",
"_prettier": "prettier --ignore-path config/.prettierignore --write './**/*.js'"
},
"husky": {
"hooks": {
Expand All @@ -51,7 +52,6 @@
"yarn lint"
]
},
"prettier": "prettier.config.js",
"mocha": {
"reporter": "spec",
"require": [
Expand Down
11 changes: 4 additions & 7 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module.exports = {
env: {
es6: true
es6: true,
},
extends: ["airbnb-base", "prettier"],
plugins: ["prettier", "prefer-import"],
rules: {
// OFF
"import/prefer-default-export": 0,
Expand All @@ -28,15 +26,14 @@ module.exports = {
"valid-jsdoc": [
1,
{
requireReturnDescription: false
}
requireReturnDescription: false,
},
],
"prefer-const": 1,
"object-shorthand": 1,
"require-await": 1,

// ERROR
"no-unused-expressions": [2, { allowTaggedTemplates: true }]
"no-unused-expressions": [2, { allowTaggedTemplates: true }],
},
parser: "babel-eslint"
};
10 changes: 4 additions & 6 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
module.exports = {
env: {
mocha: true
mocha: true,
},
parser: "@babel/eslint-parser",
plugins: ["@babel"],
globals: {
StellarSdk: true,
axios: true,
chai: true,
sinon: true,
expect: true,
HorizonAxiosClient: true
HorizonAxiosClient: true,
},
rules: {
"no-unused-vars": 0
}
"no-unused-vars": 0,
},
};
2 changes: 1 addition & 1 deletion test/integration/apiary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 Down
4 changes: 2 additions & 2 deletions test/integration/client_headers_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 32bf736

Please sign in to comment.