Skip to content

Commit 2bb7deb

Browse files
committed
Eslint prettier fix
1 parent 24ac73c commit 2bb7deb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2307
-1484
lines changed

eslint.config.cjs

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,36 @@ const tsParser = require('@typescript-eslint/parser')
33
const tsPlugin = require('@typescript-eslint/eslint-plugin')
44
const importPlugin = require('eslint-plugin-import')
55
const unicorn = require('eslint-plugin-unicorn')
6+
const prettierConfig = require('eslint-config-prettier')
7+
const prettierPlugin = require('eslint-plugin-prettier')
68

79
module.exports = [
810
{
9-
ignores: ['node_modules/**', '**/dist/**'],
11+
ignores: ['node_modules/**', '**/dist/**']
1012
},
1113
// Base JS config
1214
{
1315
...js.configs.recommended,
1416
plugins: {
1517
unicorn,
1618
import: importPlugin,
19+
prettier: prettierPlugin
1720
},
1821
languageOptions: {
1922
ecmaVersion: 2020,
20-
sourceType: 'module',
23+
sourceType: 'module'
2124
},
2225
rules: {
26+
...prettierConfig.rules,
27+
'prettier/prettier': [
28+
'error',
29+
{
30+
bracketSpacing: true,
31+
semi: false,
32+
singleQuote: true,
33+
trailingComma: 'none'
34+
}
35+
],
2336
quotes: ['error', 'single', { avoidEscape: true }],
2437
camelcase: ['error', { properties: 'never' }],
2538
semi: ['error', 'never'],
@@ -33,7 +46,10 @@ module.exports = [
3346
'dot-notation': 'error',
3447
'no-else-return': 'error',
3548
'no-tabs': 'error',
36-
'no-trailing-spaces': ['error', { skipBlankLines: false, ignoreComments: false }],
49+
'no-trailing-spaces': [
50+
'error',
51+
{ skipBlankLines: false, ignoreComments: false }
52+
],
3753
'no-var': 'error',
3854
'unicode-bom': ['error', 'never'],
3955
curly: ['error', 'all'],
@@ -42,33 +58,39 @@ module.exports = [
4258
'require-atomic-updates': 0,
4359
'linebreak-style': ['error', 'unix'],
4460
'import/extensions': ['error', 'ignorePackages'],
45-
'no-restricted-syntax': ['error', 'IfStatement > ExpressionStatement > AssignmentExpression']
46-
},
61+
'no-restricted-syntax': [
62+
'error',
63+
'IfStatement > ExpressionStatement > AssignmentExpression'
64+
]
65+
}
4766
},
4867

4968
// TypeScript files
5069
{
5170
files: ['**/*.ts'],
5271
plugins: {
53-
'@typescript-eslint': tsPlugin,
72+
'@typescript-eslint': tsPlugin
5473
},
5574
languageOptions: {
56-
parser: tsParser,
75+
parser: tsParser
5776
},
5877
rules: {
59-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
78+
'@typescript-eslint/no-unused-vars': [
79+
'error',
80+
{ argsIgnorePattern: '^_' }
81+
],
6082
'@typescript-eslint/consistent-type-imports': 'error',
6183
'no-unused-vars': 'off',
6284
'no-undef': 'off',
63-
'no-redeclare': 'off',
64-
},
85+
'no-redeclare': 'off'
86+
}
6587
},
6688

6789
// TypeScript test files
6890
{
6991
files: ['**/*.test.ts'],
7092
rules: {
71-
'dot-notation': 'off',
72-
},
73-
},
93+
'dot-notation': 'off'
94+
}
95+
}
7496
]

example/features/pageobjects/login.page.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@ import Page from './page.js'
55
* sub page containing specific selectors and methods for a specific page
66
*/
77
class LoginPage extends Page {
8-
/**
9-
* define selectors using getter methods
10-
*/
11-
public get inputUsername () {
12-
return $('#username')
13-
}
8+
/**
9+
* define selectors using getter methods
10+
*/
11+
public get inputUsername() {
12+
return $('#username')
13+
}
1414

15-
public get inputPassword () {
16-
return $('#password')
17-
}
15+
public get inputPassword() {
16+
return $('#password')
17+
}
1818

19-
public get btnSubmit () {
20-
return $('button[type="submit"]')
21-
}
19+
public get btnSubmit() {
20+
return $('button[type="submit"]')
21+
}
2222

23-
/**
24-
* a method to encapsule automation code to interact with the page
25-
* e.g. to login using username and password
26-
*/
27-
public async login (username: string, password: string) {
28-
await this.inputUsername.setValue(username)
29-
await this.inputPassword.setValue(password)
30-
await this.btnSubmit.click()
31-
}
23+
/**
24+
* a method to encapsule automation code to interact with the page
25+
* e.g. to login using username and password
26+
*/
27+
public async login(username: string, password: string) {
28+
await this.inputUsername.setValue(username)
29+
await this.inputPassword.setValue(password)
30+
await this.btnSubmit.click()
31+
}
3232

33-
/**
34-
* overwrite specific options to adapt it to page object
35-
*/
36-
public open () {
37-
return super.open('login')
38-
}
33+
/**
34+
* overwrite specific options to adapt it to page object
35+
*/
36+
public open() {
37+
return super.open('login')
38+
}
3939
}
4040

4141
export default new LoginPage()
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { browser } from '@wdio/globals'
22

33
/**
4-
* main page object containing all methods, selectors and functionality
5-
* that is shared across all page objects
6-
*/
4+
* main page object containing all methods, selectors and functionality
5+
* that is shared across all page objects
6+
*/
77
export default class Page {
8-
/**
9-
* Opens a sub page of the page
10-
* @param path path of the sub page (e.g. /path/to/page.html)
11-
*/
12-
public open (path: string) {
13-
return browser.url(`https://the-internet.herokuapp.com/${path}`)
14-
}
8+
/**
9+
* Opens a sub page of the page
10+
* @param path path of the sub page (e.g. /path/to/page.html)
11+
*/
12+
public open(path: string) {
13+
return browser.url(`https://the-internet.herokuapp.com/${path}`)
14+
}
1515
}

example/features/pageobjects/secure.page.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import Page from './page.js'
55
* sub page containing specific selectors and methods for a specific page
66
*/
77
class SecurePage extends Page {
8-
/**
9-
* define selectors using getter methods
10-
*/
11-
public get flashAlert () {
12-
return $('#flash')
13-
}
8+
/**
9+
* define selectors using getter methods
10+
*/
11+
public get flashAlert() {
12+
return $('#flash')
13+
}
1414
}
1515

1616
export default new SecurePage()

example/features/step-definitions/steps.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@ import LoginPage from '../pageobjects/login.page.js'
55
import SecurePage from '../pageobjects/secure.page.js'
66

77
const pages = {
8-
login: LoginPage
8+
login: LoginPage
99
} as const
1010

1111
After(async () => {
12-
await browser.reloadSession()
12+
await browser.reloadSession()
1313
})
1414

1515
Given(/^I am on the (\w+) page$/, async (page: keyof typeof pages) => {
16-
await pages[page].open()
16+
await pages[page].open()
1717
})
1818

1919
When(/^I login with (\w+) and (.+)$/, async (username, password) => {
20-
await LoginPage.login(username, password)
20+
await LoginPage.login(username, password)
2121
})
2222

2323
Then(/^I should see a flash message saying (.*)$/, async (message) => {
24-
const el = await SecurePage.flashAlert
25-
await expect(el).toBeExisting()
26-
await expect(el).toHaveText(expect.stringContaining(message))
27-
await browser.pause(15000)
24+
const el = await SecurePage.flashAlert
25+
await expect(el).toBeExisting()
26+
await expect(el).toHaveText(expect.stringContaining(message))
27+
// await browser.pause(15000)
2828
})
29-

0 commit comments

Comments
 (0)