Chore: Update eslint configuration (#224)

- Update missing dev dependencies
- Fix root .eslintrc.json and client and server versions
- Add lint.yaml workflow
- Remove babel settings
- Clean up and fix eslint and ts errors
This commit is contained in:
Elisha Nuchi
2024-06-02 18:01:12 -04:00
committed by GitHub
parent a976451c78
commit 85223ca42a
19 changed files with 1411 additions and 594 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
}
+6 -3
View File
@@ -1,12 +1,14 @@
{
"root": true,
"parser": "@babel/eslint-parser",
"parser": "@typescript-eslint/parser",
"extends": [
"airbnb-base",
"plugin:prettier/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended"
],
"plugins": ["babel", "prettier"],
"plugins": ["prettier"],
"env": {
"browser": true,
"es6": true,
@@ -27,8 +29,9 @@
"jest/no-done-callback": "off",
"prettier/prettier": "error",
"camelcase": "warn",
"import/prefer-default-export": "warn",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": "warn",
"import/extensions": "off",
"jest/expect-expect": "off",
"no-new": "off",
"no-underscore-dangle": "off"
+8 -4
View File
@@ -3,7 +3,6 @@
// This allows using stealth mode.
import fs from 'fs';
const fsPromises = fs.promises;
import os from 'os';
import path from 'path';
import puppeteer from 'puppeteer-extra';
@@ -11,9 +10,11 @@ import puppeteer from 'puppeteer-extra';
// add stealth plugin and use defaults (all evasion techniques)
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
import jestPuppeteerConfig from './jest-puppeteer.config.js';
const fsPromises = fs.promises;
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
export default async function globalSetup() {
puppeteer.use(StealthPlugin());
const browser = await puppeteer.launch(jestPuppeteerConfig.launch);
@@ -23,5 +24,8 @@ export default async function globalSetup() {
// use the file system to expose the wsEndpoint for TestEnvironments
await fsPromises.mkdir(DIR, { recursive: true });
await fsPromises.writeFile(path.join(DIR, 'wsEndpoint'), browser.wsEndpoint());
};
await fsPromises.writeFile(
path.join(DIR, 'wsEndpoint'),
browser.wsEndpoint()
);
}
+3 -2
View File
@@ -3,10 +3,11 @@
// This allows using stealth mode.
import fs from 'fs';
const fsPromises = fs.promises;
import os from 'os';
import path from 'path';
const fsPromises = fs.promises;
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
export default async function globalTeardown() {
// close the browser instance
@@ -14,4 +15,4 @@ export default async function globalTeardown() {
// clean-up the wsEndpoint file
await fsPromises.rmdir(DIR, { recursive: true, force: true });
};
}
+4 -2
View File
@@ -2,9 +2,9 @@ import fs from 'fs';
import path from 'path';
import { exec } from 'child_process';
import { configureToMatchImageSnapshot } from 'jest-image-snapshot';
import dotenv from 'dotenv';
import { openAddon } from './utils/open-addon';
import dotenv from 'dotenv';
dotenv.config();
const isExtended = `${process.env.IS_EXTENDED}` === 'true';
@@ -57,7 +57,9 @@ describe(`Local setup ${isExtended ? '*extended*' : ''}`, () => {
if (isExtended) {
await openAddon(page);
} else {
await page.goto('https://localhost:3000/dialog-demo-bootstrap/index.html');
await page.goto(
'https://localhost:3000/dialog-demo-bootstrap/index.html'
);
await page.waitForTimeout(3000);
}
});
+1 -5
View File
@@ -11,10 +11,6 @@ import NodeEnvironment from 'jest-environment-node';
const DIR = path.join(os.tmpdir(), 'jest_puppeteer_global_setup');
export default class PuppeteerEnvironment extends NodeEnvironment.default {
constructor(config) {
super(config);
}
async setup() {
await super.setup();
// get the wsEndpoint
@@ -36,4 +32,4 @@ export default class PuppeteerEnvironment extends NodeEnvironment.default {
getVmContext() {
return super.getVmContext();
}
}
}