Skip to content

Commit

Permalink
chore: setup linting (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
dated authored and faustbrian committed Mar 31, 2019
1 parent 1f84ca4 commit 886578e
Show file tree
Hide file tree
Showing 149 changed files with 2,976 additions and 1,918 deletions.
34 changes: 13 additions & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
// https://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module',
sourceType: 'module'
},
env: {
browser: true,
node: true
},
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
'plugin:vue/recommended',
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
'standard',
],
// required to lint *.vue files
plugins: ['html', 'vue'],
// add your custom rules here
globals: {
'GIT_DATE': true,
'GIT_VERSION': true
},
rules: {
// allow paren-less arrow functions
'arrow-parens': 0,
// allow async-await
'generator-star-spacing': 'off',
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'comma-dangle': ['error', 'only-multiline'],
'no-unused-vars': ['warn'],
'no-debugger': ['warn'],
'space-before-function-paren': ['off'],
// allow arrow functions for data
'no-return-assign': 'off',
'no-new': 'off',
},
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'vue/component-name-in-template-casing': ['warn', 'PascalCase', {}]
}
}
1 change: 0 additions & 1 deletion __tests__/e2e/globalModules.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

module.exports = {
// Default timeout value for 'waitFor..' commands
waitForConditionTimeout: 5000,
Expand Down
2 changes: 1 addition & 1 deletion __tests__/e2e/nightwatch.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
default: {
webdriver: {
webdriver_port: 4444,
webdriver_host: '127.0.0.1',
webdriver_host: '127.0.0.1'
},
silent: true,
globals: {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/e2e/runner.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(async function() {
(async function () {
// 1. start the dev server using production config
process.env.NODE_ENV = 'testing'

Expand Down
14 changes: 7 additions & 7 deletions __tests__/e2e/specs/block-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
.waitForElementVisible("//h1[text() = 'Block']")
},

'it should be possible to navigate to next block and back': function(browser) {
'it should be possible to navigate to next block and back': function (browser) {
browser
.waitForElementVisible("//div[contains(@class, 'semibold') and contains(@class, 'truncate')]/span[contains(text(), '3487084709104787070')]")
.click("//button[contains(., 'Next')]")
Expand All @@ -26,7 +26,7 @@ module.exports = {
.waitForElementVisible("//div[contains(@class, 'semibold') and contains(@class, 'truncate')]/span[contains(text(), '3487084709104787070')]")
},

'it should not contain a transaction table if block has no transactions': function(browser) {
'it should not contain a transaction table if block has no transactions': function (browser) {
browser
.useXpath().assert.containsText("//div[.='Transactions']/following-sibling::div[1]", '0')
browser
Expand All @@ -36,7 +36,7 @@ module.exports = {
browser.end()
},

'it should contain a transaction table if block has 1 or more transactions': function(browser) {
'it should contain a transaction table if block has 1 or more transactions': function (browser) {
browser
.url(browser.globals.devServerURL + '/#/block/12287662939647858585')
.pause(500)
Expand All @@ -46,7 +46,7 @@ module.exports = {
browser
.expect.element('div.table-component').to.be.present
browser
.elements('css selector', '.table-component__table__body tr', function(result) {
.elements('css selector', '.table-component__table__body tr', function (result) {
browser.assert.equal(1, result.value.length)
})
},
Expand All @@ -65,12 +65,12 @@ module.exports = {
browser
.waitForElementVisible('div.list-row-border-b')
.useXpath()
.getText(element, function(result) {
browser.expect.element(element).text.to.not.contain(result.value).after(20000)
.getText(element, function (result) {
browser.expect.element(element).text.to.not.contain(result.value.trim()).after(20000)
})
},

'it should be possible to click on the delegate': function(browser) {
'it should be possible to click on the delegate': function (browser) {
browser
.useXpath()
.waitForElementVisible("//div[contains(@class, 'list-row')]//a")
Expand Down
2 changes: 1 addition & 1 deletion __tests__/e2e/specs/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
.waitForElementVisible('div.hidden.sm\\:block div.table-component tbody.table-component__table__body')
.expect.element('div.hidden.sm\\:block').to.be.present
browser
.elements('css selector', 'div.hidden.sm\\:block div.table-component tbody.table-component__table__body tr', function(result) {
.elements('css selector', 'div.hidden.sm\\:block div.table-component tbody.table-component__table__body tr', function (result) {
browser.assert.equal(25, result.value.length)
})
},
Expand Down
42 changes: 21 additions & 21 deletions __tests__/e2e/specs/delegate-monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@ module.exports = {
.waitForElementVisible('.bg-theme-feature-background')
.pause(2000)
.useXpath()
browser.expect.element("//div[text() = 'Delegates']").to.be.visible
browser.expect.element("//div[text() = 'Total forged (ARK)']").to.be.visible
browser.expect.element("//div[text() = 'Last block']").to.be.visible
browser.expect.element("//div[text() = 'Forged']").to.be.visible
browser.expect.element("//div[text() = 'Delegate']").to.be.visible
browser.expect.element("//div[contains(text(), 'Delegates')]").to.be.visible
browser.expect.element("//div[contains(text(), 'Total forged (ARK)')]").to.be.visible
browser.expect.element("//div[contains(text(), 'Last block')]").to.be.visible
browser.expect.element("//div[contains(text(), 'Forged')]").to.be.visible
browser.expect.element("//div[contains(text(), 'Delegate')]").to.be.visible
},

'it should fetch the latest block automatically': function (browser) {
const element = "//div[text() = 'Last block']/following-sibling::div//a[1]/span"
const element = "//div[contains(text(), 'Last block')]/following-sibling::div//a[1]/span"

browser
.useXpath().waitForElementVisible(element)
.getText(element, function(result) {
.getText(element, function (result) {
browser.expect.element(element).text.to.not.contain(result.value).after(20000)
})
},

'it should fetch the delegates automatically': function (browser) {
const element = "//div[text() = 'In queue for forging']/preceding-sibling::div"
const element = "//div[contains(text(), 'In queue for forging')]/preceding-sibling::div"

browser
.useXpath().waitForElementVisible(element)
.getText(element, function(result) {
.getText(element, function (result) {
browser.expect.element(element).text.to.not.contain(result.value).after(20000)
})
},

'it should be possible to click on the last block': function (browser) {
browser
.useXpath()
.click("//div[text() = 'Last block']/following-sibling::div//a[1]")
.click("//div[contains(text(), 'Last block')]/following-sibling::div//a[1]")
.pause(500)
.waitForElementVisible("//h1[text() = 'Block']")
.assert.urlContains('/block/')
Expand All @@ -64,8 +64,8 @@ module.exports = {
browser
.url(devServer)
.useXpath()
.waitForElementVisible("//div[contains(@class, 'bg-theme-feature-background')]/div[3]//div[text() = 'Delegate']/following-sibling::div//a[1]")
.click("//div[contains(@class, 'bg-theme-feature-background')]/div[3]//div[text() = 'Delegate']/following-sibling::div//a[1]")
.waitForElementVisible("//div[contains(@class, 'bg-theme-feature-background')]/div[3]//div[contains(text(), 'Delegate')]/following-sibling::div//a[1]")
.click("//div[contains(@class, 'bg-theme-feature-background')]/div[3]//div[contains(text(), 'Delegate')]/following-sibling::div//a[1]")
.pause(500)
browser
.waitForElementVisible("//h1[text() = 'Wallet summary']")
Expand All @@ -79,15 +79,15 @@ module.exports = {
.useCss()
.waitForElementVisible('.bg-theme-feature-background')
browser
.elements('css selector', 'div.meter', function(result) {
.elements('css selector', 'div.meter', function (result) {
browser.assert.equal(4, result.value.length)
})
browser
.useXpath()
.expect.element("//div[text() = 'Forged block recently']").to.be.visible
browser.expect.element("//div[text() = 'Missed block']").to.be.visible
browser.expect.element("//div[text() = 'Not forging']").to.be.visible
browser.expect.element("//div[text() = 'In queue for forging']").to.be.visible
.expect.element("//div[contains(text(), 'Forged block recently')]").to.be.visible
browser.expect.element("//div[contains(text(), 'Missed block')]").to.be.visible
browser.expect.element("//div[contains(text(), 'Not forging')]").to.be.visible
browser.expect.element("//div[contains(text(), 'In queue for forging')]").to.be.visible
},

'it should be possible to sort the active delegates': function (browser) {
Expand Down Expand Up @@ -140,10 +140,10 @@ module.exports = {
'it should not show forging stats for standby delegates': function (browser) {
browser
.useXpath()
.expect.element("//div[text() = 'Forged block recently']").to.not.be.visible
browser.expect.element("//div[text() = 'Missed block']").to.not.be.visible
browser.expect.element("//div[text() = 'Not forging']").to.not.be.visible
browser.expect.element("//div[text() = 'In queue for forging']").to.not.be.visible
.expect.element("//div[contains(text(), 'Forged block recently')]").to.not.be.visible
browser.expect.element("//div[contains(text(), 'Missed block')]").to.not.be.visible
browser.expect.element("//div[contains(text(), 'Not forging')]").to.not.be.visible
browser.expect.element("//div[contains(text(), 'In queue for forging')]").to.not.be.visible
},

'it should be possible to sort the standby delegates': function (browser) {
Expand Down
Loading

0 comments on commit 886578e

Please sign in to comment.