Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
bump version and deps + proper linting with some exclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
ildella committed Sep 27, 2023
1 parent 6c0102a commit 29c52d5
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 36 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ module.exports = {
'fp',
'unicorn',
],
ignorePatterns: [
'coverage/',
],
overrides: [
{
files: ['**/src/**'],
files: [
'**/**',
],
extends: [
'node-moar-stricter',
],
rules: {
'fp/no-throw': 'off',
'fp/no-this': 'off',
'fp/no-mutation': 'off',
'unicorn/prefer-top-level-await': 'off',
// 'unicorn/no-array-reduce': 'off',
'security/detect-non-literal-fs-filename': 'off',
Expand Down
4 changes: 2 additions & 2 deletions axios/default-http-json-client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const httpJsonClient = require('./http-json-client')
const safeHttpClient = require('./safe-http-client')

module.exports = (baseURL, params = {}) => safeHttpClient(httpJsonClient, {
...params,
module.exports = (baseURL, parameters = {}) => safeHttpClient(httpJsonClient, {
...parameters,
baseURL,
})
4 changes: 2 additions & 2 deletions axios/safe-http-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const curry = require('just-curry-it')

const {parseAxiosError} = require('../errors')

const safeHttpClient = (client, params) => {
const safeHttpClient = (client, parameters) => {
// console.log({params})
const instance = client(params)
const instance = client(parameters)
instance.interceptors.response.use(
response => response,
error => {
Expand Down
6 changes: 3 additions & 3 deletions core/buffer-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const isValidUTF8 = string => {
try {
Buffer.from(string, 'utf8')
return true
} catch (error) {
} catch {
return false
}
}
Expand All @@ -11,13 +11,13 @@ const isValidBase64 = string => {
try {
const decoded = Buffer.from(string, 'base64').toString('base64')
return string === decoded
} catch (error) {
} catch {
return false
}
}

const isValidHex = string => {
const hexPattern = /^[0-9a-fA-F]+$/
const hexPattern = /^[\dA-Fa-f]+$/
return hexPattern.test(string)
}

Expand Down
1 change: 1 addition & 0 deletions fusto/websocket-stream-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = socket => (push, next) => {

socket.on('close', () => {
// console.info('socket close event')
// eslint-disable-next-line unicorn/no-null
push(null, nil)
})
}
4 changes: 2 additions & 2 deletions http/http-test-base-express.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ module.exports = app => {
},
stop: () => server.close(),
// client: () => axios.create({baseURL: `http://localhost:${server.address().port}`}),
client: params => {
client: parameters => {
const {address, port} = app.server.address()
return safeHttpClient(httpJsonClient, {
baseURL: `http://${address}:${port}`,
...params,
...parameters,
})
},
}
Expand Down
4 changes: 2 additions & 2 deletions http/http-test-base-fastify.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module.exports = app => ({
host: '0.0.0.0',
}),
stop: () => app.close(),
client: params => {
client: parameters => {
const {address, port} = app.server.address()
return safeHttpClient(httpJsonClient, {
baseURL: `http://${address}:${port}`,
...params,
...parameters,
})
},
address: () => app.server.address(),
Expand Down
7 changes: 2 additions & 5 deletions http/tracer-fastify-logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ const {local} = require('../tracer')
module.exports = ({app, logLevel}) => {
const log = local({level: logLevel})
app.log = log
app.addHook('onRequest', (request, reply, done) => {
// eslint-disable-next-line fp/no-mutation
request.log = log
done()
})
app.decorateRequest('log', log)
// app.decorate('log', log)
return log
}
2 changes: 1 addition & 1 deletion lnd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module.exports = {
lndClients: require('./lnd-clients'),
lndStreams: deprecate(require('./lnd-streams'), 'Please use /fusto/streams instead'),
lndPolarConfig: require('./lnd-polar-config'),
lndEnvConfig: require('./lnd-env-config'),
lndEnvConfig: require('./lnd-environment-config'),
}
2 changes: 1 addition & 1 deletion lnd/lnd-clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ const create = ({baseUrl, cert, macaroon}) => httpJsonClient({

module.exports = {
createWs,
createHttp: params => safeHttpClient(create, params),
createHttp: parameters => safeHttpClient(create, parameters),
}
File renamed without changes.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moar-js",
"version": "1.1.3",
"version": "1.2.0",
"description": "Simple JavaScript files I use across projects",
"author": {
"name": "Daniele Dellafiore"
Expand Down Expand Up @@ -42,12 +42,12 @@
},
"devDependencies": {
"@fastify/sensible": "5.3.0",
"axios": "1.5.0",
"axios": "1.5.1",
"eslint": "8.50.0",
"exstream.js": "0.23.0",
"fastify": "4.23.2",
"jest": "29.7.0",
"moar-js-dev": "2",
"moar-js-dev": "2.3.1",
"tracer": "1.2.0",
"ws": "8.14.2"
},
Expand Down
8 changes: 4 additions & 4 deletions tests/lnd/lnd-clients.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test('just checking...', () => {
expect(lndClients).toBeDefined()
})

test.skip('http lnd client', () => {
const {lndHttp} = lndClients()
expect(lndHttp).toBeDefined()
})
// t('http lnd client', () => {
// const {lndHttp} = lndClients()
// expect(lndHttp).toBeDefined()
// })
File renamed without changes.
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1488,14 +1488,14 @@ __metadata:
languageName: node
linkType: hard

"axios@npm:1.5.0":
version: 1.5.0
resolution: "axios@npm:1.5.0"
"axios@npm:1.5.1":
version: 1.5.1
resolution: "axios@npm:1.5.1"
dependencies:
follow-redirects: "npm:^1.15.0"
form-data: "npm:^4.0.0"
proxy-from-env: "npm:^1.1.0"
checksum: 128433020b1fe9a460121735016f377adc6109a1f62b61795b1a80704de0a70affb0d580c8abd057e28af5f343cb4fb9a17a0b2512ea7f314578bbe492851a23
checksum: 67633db5867c789a6edb6e5229884501bef89584a6718220c243fd5a64de4ea7dcdfdf4f8368a672d582db78aaa9f8d7b619d39403b669f451e1242bbd4c7ee2
languageName: node
linkType: hard

Expand Down Expand Up @@ -4374,9 +4374,9 @@ __metadata:
languageName: node
linkType: hard

"moar-js-dev@npm:2":
version: 2.2.0
resolution: "moar-js-dev@npm:2.2.0"
"moar-js-dev@npm:2.3.1":
version: 2.3.1
resolution: "moar-js-dev@npm:2.3.1"
dependencies:
depcheck: "npm:1.4.6"
eslint: "npm:8.50.0"
Expand All @@ -4392,7 +4392,7 @@ __metadata:
eslint-plugin-unicorn: "npm:48.0.1"
jest: "npm:29.7.0"
node-notifier: "npm:10.0.1"
checksum: d36235ca857a94b04466f9820dc5db19251739ff274d507192a9f69f5add6ea7a8c050e0ce0b51e42feb122a197b354eab687c5a98c32c66f499476cf38045f2
checksum: 968e8a75b5dc11fad7ebb03035887b7b9c83e10cbe2128763d9df836c33a54ce82e25950b4c0c13b46871c8a786ead252bb5c658f5fb8b065a6d52797c5c5a46
languageName: node
linkType: hard

Expand All @@ -4401,14 +4401,14 @@ __metadata:
resolution: "moar-js@workspace:."
dependencies:
"@fastify/sensible": "npm:5.3.0"
axios: "npm:1.5.0"
axios: "npm:1.5.1"
eslint: "npm:8.50.0"
exstream.js: "npm:0.23.0"
fastify: "npm:4.23.2"
jest: "npm:29.7.0"
just-curry-it: "npm:5.3.0"
just-pick: "npm:4.2.0"
moar-js-dev: "npm:2"
moar-js-dev: "npm:2.3.1"
tracer: "npm:1.2.0"
ws: "npm:8.14.2"
peerDependencies:
Expand Down

0 comments on commit 29c52d5

Please sign in to comment.