Unverified Commit ac3631a6 authored by Andrei Eres's avatar Andrei Eres Committed by GitHub
Browse files

Add linting unused (#117)

parent c58e10a5
Pipeline #189848 passed with stages
in 1 minute and 31 seconds
......@@ -11,9 +11,10 @@
"build:source": "webpack --mode production",
"build:zip": "web-ext build --source-dir ./build --artifacts-dir ./ --overwrite-dest",
"lint:typing": "tsc --noEmit",
"lint:unused": "ts-prune --error",
"lint:ts": "eslint ./src",
"lint:css": "stylelint ./src/**/*.css",
"lint": "yarn lint:typing && yarn lint:ts && yarn lint:css",
"lint": "yarn lint:typing && yarn lint:unused && yarn lint:ts && yarn lint:css",
"fix": "prettier ./src -w"
},
"dependencies": {
......@@ -24,7 +25,6 @@
"@polkadot/extension-inject": "^0.43.1",
"@polkadot/react-identicon": "^2.0.1",
"@polkadot/react-qr": "^2.0.1",
"autoprefixer": "^10.4.4",
"nanostores": "^0.5.12",
"react": "^18.0.0",
"react-dom": "^18.0.0",
......@@ -43,6 +43,7 @@
"@types/react-dom": "^18.0.1",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"autoprefixer": "^10.4.4",
"babel-loader": "^8.2.5",
"buffer": "^6.0.3",
"copy-webpack-plugin": "^10.2.4",
......@@ -63,6 +64,7 @@
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended": "^7.0.0",
"tailwindcss": "^3.0.24",
"ts-prune": "^0.10.3",
"typescript": "^4.6.3",
"url-loader": "^4.1.1",
"web-ext": "^6.8.0",
......
......@@ -8,7 +8,7 @@ export const PKG_NAME = process.env.PKG_NAME ?? ''
export const PKG_VERSION = process.env.PKG_VERSION ?? ''
export const ROOT_ID = 'root'
export const EXT_NAME = 'Parity Signer Companion'
export const EXT_PREFIX = process.env.EXTENSION_PREFIX ?? ''
const EXT_PREFIX = process.env.EXTENSION_PREFIX ?? ''
export const PORT_CONTENT = `${EXT_PREFIX}content`
export const PORT_EXTENSION = `${EXT_PREFIX}extension`
export const MESSAGE_ORIGIN_PAGE = `${EXT_PREFIX}page`
......
......@@ -5,9 +5,3 @@ export function isRawPayload(
): payload is SignerPayloadRaw {
return !!(payload as SignerPayloadRaw).data
}
export function isJsonPayload(
payload: SignerPayloadJSON | SignerPayloadRaw
): payload is SignerPayloadJSON {
return !!(payload as SignerPayloadJSON).genesisHash
}
import { AccountJson } from '@polkadot/extension-base/background/types'
import { SubjectInfo } from '@polkadot/ui-keyring/observable/types'
export function transformExtensionAccounts(
accounts: SubjectInfo
): AccountJson[] {
return Object.values(accounts).map(
({ json: { address, meta }, type }): AccountJson => ({
address,
...meta,
type,
})
)
}
import { canDerive } from '@polkadot/extension-base/utils'
import { InjectedAccount } from '@polkadot/extension-inject/types'
import { SubjectInfo } from '@polkadot/ui-keyring/observable/types'
export function transformTabsAccounts(
accounts: SubjectInfo,
anyType = false
): InjectedAccount[] {
return Object.values(accounts)
.filter(({ json }) => !json.meta.isHidden)
.filter(({ type }) => (anyType ? true : canDerive(type)))
.sort(
(a, b) => (a.json.meta.whenCreated || 0) - (b.json.meta.whenCreated || 0)
)
.map(
({
json: {
address,
meta: { genesisHash, name },
},
type,
}): InjectedAccount => ({
address,
genesisHash,
name,
type,
})
)
}
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment