Skip to content

Commit

Permalink
Added eslint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
pkirilin committed Jan 2, 2024
1 parent 1351316 commit b19c5aa
Show file tree
Hide file tree
Showing 19 changed files with 5,434 additions and 423 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
node-version: '18.16.0'
- name: Install dependencies
run: yarn
- name: Lint
run: yarn lint
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright tests
Expand Down
1 change: 1 addition & 0 deletions tests/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
playwright.config.ts
22 changes: 22 additions & 0 deletions tests/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"root": true,
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:import/typescript", "standard-with-typescript", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["prettier", "import"],
"rules": {
"prettier/prettier": 2,
"no-console": "warn"
}
}
]
}
3 changes: 0 additions & 3 deletions tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/node_modules
/.pnp
.pnp.js
/coverage
dist
playwright-report

.DS_Store

npm-debug.log*
Expand Down
3,429 changes: 3,060 additions & 369 deletions tests/.pnp.cjs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions tests/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.vscode
.yarn
.yarnrc.yml
.pnp.cjs
.pnp.loader.mjs

node_modules
tsconfig.json
9 changes: 9 additions & 0 deletions tests/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"endOfLine": "auto",
"arrowParens": "avoid"
}
4 changes: 3 additions & 1 deletion tests/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"recommendations": [
"arcanis.vscode-zipfs"
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
20 changes: 19 additions & 1 deletion tests/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,23 @@
"**/.pnp.*": true
},
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.formatOnSave": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
},
"[json][jsonc]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.validate": [
"typescript"
],
"eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs"
}
20 changes: 20 additions & 0 deletions tests/.yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);
20 changes: 20 additions & 0 deletions tests/.yarn/sdks/eslint/lib/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint your application uses
module.exports = absRequire(`eslint`);
20 changes: 20 additions & 0 deletions tests/.yarn/sdks/eslint/lib/unsupported-api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/use-at-your-own-risk
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/use-at-your-own-risk your application uses
module.exports = absRequire(`eslint/use-at-your-own-risk`);
14 changes: 14 additions & 0 deletions tests/.yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "eslint",
"version": "8.56.0-sdk",
"main": "./lib/api.js",
"type": "commonjs",
"bin": {
"eslint": "./bin/eslint.js"
},
"exports": {
"./package.json": "./package.json",
".": "./lib/api.js",
"./use-at-your-own-risk": "./lib/unsupported-api.js"
}
}
20 changes: 20 additions & 0 deletions tests/.yarn/sdks/prettier/bin/prettier.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/bin/prettier.cjs
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier/bin/prettier.cjs your application uses
module.exports = absRequire(`prettier/bin/prettier.cjs`);
20 changes: 20 additions & 0 deletions tests/.yarn/sdks/prettier/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier your application uses
module.exports = absRequire(`prettier`);
7 changes: 7 additions & 0 deletions tests/.yarn/sdks/prettier/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "prettier",
"version": "3.1.1-sdk",
"main": "./index.cjs",
"type": "commonjs",
"bin": "./bin/prettier.cjs"
}
17 changes: 16 additions & 1 deletion tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@
"scripts": {
"test": "playwright test",
"debug": "playwright test --debug",
"codegen": "playwright codegen https://localhost:7003"
"codegen": "playwright codegen https://localhost:7003",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"devDependencies": {
"@playwright/test": "^1.40.1",
"@types/eslint": "^8",
"@types/node": "^18.16.0",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^43.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.1",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
}
}
8 changes: 4 additions & 4 deletions tests/scenarios/main.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from "@playwright/test";
import { expect, test } from '@playwright/test';

test("should display google search page", async ({ page }) => {
await page.goto("https://www.google.com/");
await expect(page.getByRole("img", { name: "Google" })).toBeVisible();
test('should display google search page', async ({ page }) => {
await page.goto('https://www.google.com/');
await expect(page.getByRole('img', { name: 'Google' })).toBeVisible();
});
Loading

0 comments on commit b19c5aa

Please sign in to comment.