add pyright to the project (#1367)

* add pyright to project + bump prettier to latest

* reformat to match the latest prettier rules
This commit is contained in:
Pavol Rusnak 2023-01-23 09:29:17 +00:00 committed by GitHub
parent 9693e5932b
commit a089188664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 82 additions and 49 deletions

View File

@ -9,6 +9,9 @@ check: mypy checkprettier checkisort checkblack
prettier: $(shell find lnbits -name "*.js" -o -name ".html")
./node_modules/.bin/prettier --write lnbits/static/js/*.js lnbits/core/static/js/*.js lnbits/extensions/*/templates/*/*.html ./lnbits/core/templates/core/*.html lnbits/templates/*.html lnbits/extensions/*/static/js/*.js lnbits/extensions/*/static/components/*/*.js lnbits/extensions/*/static/components/*/*.html
pyright:
./node_modules/.bin/pyright
black:
poetry run black .

View File

@ -108,9 +108,8 @@
},
methods: {
showNotif: function (userMessage) {
var colour = this.colours[
Math.floor(Math.random() * this.colours.length)
]
var colour =
this.colours[Math.floor(Math.random() * this.colours.length)]
this.$q.notify({
color: colour,
icon: 'chat_bubble_outline',

View File

@ -224,21 +224,17 @@ gertyname }}{% endraw %}{% endblock %}{% block page %} {% raw %}
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'fun_satoshi_quotes') {
this.fun_satoshi_quotes['quote'] = this.gerty[
i
].screen.areas[0][0].value
this.fun_satoshi_quotes['date'] = this.gerty[
i
].screen.areas[0][1].value
this.fun_satoshi_quotes['quote'] =
this.gerty[i].screen.areas[0][0].value
this.fun_satoshi_quotes['date'] =
this.gerty[i].screen.areas[0][1].value
this.gertyname = this.gerty[i].settings.name
}
if (this.gerty[i].screen.group == 'fun_exchange_market_rate') {
this.fun_exchange_market_rate['unit'] = this.gerty[
i
].screen.areas[0][0].value
this.fun_exchange_market_rate['amount'] = this.gerty[
i
].screen.areas[0][1].value
this.fun_exchange_market_rate['unit'] =
this.gerty[i].screen.areas[0][0].value
this.fun_exchange_market_rate['amount'] =
this.gerty[i].screen.areas[0][1].value
this.gertyname = this.gerty[i].settings.name
}
}

View File

@ -616,8 +616,8 @@
self.toggleStates.onchain
self.formDialog.data.display_preferences.onchain_difficulty_retarget_date =
self.toggleStates.onchain
self.formDialog.data.display_preferences.onchain_difficulty_blocks_remaining = !self
.toggleStates.onchain
self.formDialog.data.display_preferences.onchain_difficulty_blocks_remaining =
!self.toggleStates.onchain
self.formDialog.data.display_preferences.onchain_difficulty_epoch_time_remaining =
self.toggleStates.onchain
self.formDialog.data.display_preferences.onchain_block_height =

View File

@ -255,7 +255,8 @@ new Vue({
},
createJukebox() {
self = this
self.jukeboxDialog.data.sp_playlists = self.jukeboxDialog.data.sp_playlists.join()
self.jukeboxDialog.data.sp_playlists =
self.jukeboxDialog.data.sp_playlists.join()
self.updateDB()
self.jukeboxDialog.show = false
self.getJukeboxes()

View File

@ -807,11 +807,12 @@
updatedData
)
.then(function (response) {
self.lnurldeviceLinks = _.reject(self.lnurldeviceLinks, function (
obj
) {
return obj.id === updatedData.id
})
self.lnurldeviceLinks = _.reject(
self.lnurldeviceLinks,
function (obj) {
return obj.id === updatedData.id
}
)
self.lnurldeviceLinks.push(maplnurldevice(response.data))
self.formDialoglnurldevice.show = false
self.clearFormDialoglnurldevice()

View File

@ -803,9 +803,8 @@
self.productDialog.data = _.clone(link._data)
if (self.productDialog.data.categories) {
self.productDialog.data.categories = self.productDialog.data.categories.split(
','
)
self.productDialog.data.categories =
self.productDialog.data.categories.split(',')
}
if (self.productDialog.data.image.startsWith('data:')) {
self.productDialog.url = false

View File

@ -809,7 +809,8 @@
this.createTheme(wallet, data)
},
sendFormDataCharge: function () {
this.formDialogCharge.data.custom_css = this.formDialogCharge.data.custom_css?.id
this.formDialogCharge.data.custom_css =
this.formDialogCharge.data.custom_css?.id
const data = this.formDialogCharge.data
const wallet = this.g.user.wallets[0].inkey
data.amount = parseInt(data.amount)

View File

@ -574,11 +574,12 @@
.inkey
)
.then(function (response) {
self.emailaddresses = _.reject(self.emailaddresses, function (
obj
) {
return obj.id == emailaddressId
})
self.emailaddresses = _.reject(
self.emailaddresses,
function (obj) {
return obj.id == emailaddressId
}
)
})
.catch(function (error) {
LNbits.utils.notifyApiError(error)

View File

@ -484,9 +484,8 @@
var link = _.findWhere(this.domains, {id: formId})
console.log(link.id)
this.domainDialog.data = _.clone(link)
this.domainDialog.data.allowed_record_types = link.allowed_record_types.split(
', '
)
this.domainDialog.data.allowed_record_types =
link.allowed_record_types.split(', ')
this.domainDialog.show = true
},
updateDomain: function (wallet, data) {

View File

@ -174,11 +174,12 @@ async function walletList(path) {
'/watchonly/api/v1/wallet/' + walletAccountId,
this.adminkey
)
this.walletAccounts = _.reject(this.walletAccounts, function (
obj
) {
return obj.id === walletAccountId
})
this.walletAccounts = _.reject(
this.walletAccounts,
function (obj) {
return obj.id === walletAccountId
}
)
await this.refreshWalletAccounts()
} catch (error) {
this.$q.notify({

39
package-lock.json generated
View File

@ -1,31 +1,54 @@
{
"name": "lnbits-legend",
"name": "lnbits",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"devDependencies": {
"prettier": "2.1.1"
"prettier": "2.8.3",
"pyright": "1.1.289"
}
},
"node_modules/prettier": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz",
"integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==",
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz",
"integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/pyright": {
"version": "1.1.289",
"resolved": "https://registry.npmjs.org/pyright/-/pyright-1.1.289.tgz",
"integrity": "sha512-fG3STxnwAt3i7bxbXUPJdYNFrcOWHLwCSEOySH2foUqtYdzWLcxDez0Kgl1X8LMQx0arMJ6HRkKghxfRD1/z6g==",
"dev": true,
"bin": {
"pyright": "index.js",
"pyright-langserver": "langserver.index.js"
},
"engines": {
"node": ">=12.0.0"
}
}
},
"dependencies": {
"prettier": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz",
"integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==",
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz",
"integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==",
"dev": true
},
"pyright": {
"version": "1.1.289",
"resolved": "https://registry.npmjs.org/pyright/-/pyright-1.1.289.tgz",
"integrity": "sha512-fG3STxnwAt3i7bxbXUPJdYNFrcOWHLwCSEOySH2foUqtYdzWLcxDez0Kgl1X8LMQx0arMJ6HRkKghxfRD1/z6g==",
"dev": true
}
}

View File

@ -1,5 +1,6 @@
{
"devDependencies": {
"prettier": "2.1.1"
"prettier": "2.8.3",
"pyright": "1.1.289"
}
}

View File

@ -86,6 +86,14 @@ lnbits = "lnbits.server:main"
[tool.isort]
profile = "black"
[tool.pyright]
include = [
"lnbits"
]
exclude = [
"lnbits/wallets/lnd_grpc_files",
]
[tool.mypy]
files = "lnbits"
exclude = """(?x)(