Run eslint in CI (#3487)
* Run eslint in CI * Add linting of e2e * Fix formatting * Fix new warnings in e2e * Fix more new warnings
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
"files": ["e2e/**/*.ts"], // Update the pattern based on your file structure
|
||||
"rules": {
|
||||
"@typescript-eslint/no-floating-promises": "warn",
|
||||
"suggest-no-throw/suggest-no-throw": "off",
|
||||
"testing-library/prefer-screen-queries": "off"
|
||||
}
|
||||
},
|
||||
|
2
.github/workflows/build-test-web.yml
vendored
2
.github/workflows/build-test-web.yml
vendored
@ -44,6 +44,8 @@ jobs:
|
||||
- run: yarn build:wasm
|
||||
- run: yarn xstate:typegen
|
||||
- run: yarn tsc
|
||||
- name: Lint
|
||||
run: yarn eslint --max-warnings 0 src e2e
|
||||
|
||||
|
||||
check-typos:
|
||||
|
@ -9,6 +9,7 @@ test.afterEach(async ({ page }, testInfo) => {
|
||||
await tearDown(page, testInfo)
|
||||
})
|
||||
test.describe('Copilot ghost text', () => {
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
test.skip(true, 'Needs to get covered again')
|
||||
|
||||
test('completes code in empty file', async ({ page }) => {
|
||||
|
@ -337,6 +337,7 @@ const sketch001 = startSketchAt([-0, -0])
|
||||
}) => {
|
||||
// This is being weird on ubuntu and windows.
|
||||
test.skip(
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
process.platform === 'linux' || process.platform === 'win32',
|
||||
'This test is being weird on ubuntu'
|
||||
)
|
||||
|
@ -602,7 +602,7 @@ test.describe('Sketch tests', () => {
|
||||
await expect(u.codeLocator).toHaveText(codeStr)
|
||||
|
||||
// exit the sketch, reset relative clicker
|
||||
click00r(undefined, undefined)
|
||||
await click00r(undefined, undefined)
|
||||
await u.openAndClearDebugPanel()
|
||||
await page.getByRole('button', { name: 'Exit Sketch' }).click()
|
||||
await u.expectCmdLog('[data-message-type="execution-done"]')
|
||||
|
@ -53,6 +53,7 @@ test(
|
||||
async ({ page, context }) => {
|
||||
// skip on macos and windows.
|
||||
test.skip(
|
||||
// eslint-disable-next-line jest/valid-title
|
||||
process.platform === 'darwin' || process.platform === 'win32',
|
||||
'Skip on macos and windows'
|
||||
)
|
||||
|
@ -95,6 +95,8 @@ async function expectCmdLog(page: Page, locatorStr: string, timeout = 5000) {
|
||||
await expect(page.locator(locatorStr).last()).toBeVisible({ timeout })
|
||||
}
|
||||
|
||||
// Ignoring the lint since I assume someone will want to use this for a test.
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
async function waitForDefaultPlanesToBeVisible(page: Page) {
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
@ -172,7 +174,8 @@ export const wiggleMove = async (
|
||||
const isElVis = await page.locator(locator).isVisible()
|
||||
if (isElVis) return
|
||||
}
|
||||
const [x1, y1] = [0, Math.sin((tau / steps) * j * freq) * amplitude]
|
||||
// x1 is 0.
|
||||
const y1 = Math.sin((tau / steps) * j * freq) * amplitude
|
||||
const [x2, y2] = [
|
||||
Math.cos(-ang * deg) * i - Math.sin(-ang * deg) * y1,
|
||||
Math.sin(-ang * deg) * i + Math.cos(-ang * deg) * y1,
|
||||
@ -453,7 +456,10 @@ export async function getUtils(page: Page) {
|
||||
return page.evaluate('window.tearDown()')
|
||||
}
|
||||
|
||||
cdpSession?.send('Network.emulateNetworkConditions', networkOptions)
|
||||
return cdpSession?.send(
|
||||
'Network.emulateNetworkConditions',
|
||||
networkOptions
|
||||
)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ test.describe('Testing constraints', () => {
|
||||
page.getByRole('button', { name: 'Exit Sketch' })
|
||||
).not.toBeVisible()
|
||||
})
|
||||
test(`Test remove constraints`, async ({ page }) => {
|
||||
test(`Remove constraints`, async ({ page }) => {
|
||||
await page.addInitScript(async () => {
|
||||
localStorage.setItem(
|
||||
'persistCode',
|
||||
|
@ -977,10 +977,6 @@ const part001 = startSketchOn('XZ')
|
||||
const hoverPos = { x: segmentToDelete.x, y: segmentToDelete.y }
|
||||
await page.mouse.move(0, 0)
|
||||
await page.waitForTimeout(1000)
|
||||
let x = 0,
|
||||
y = 0
|
||||
x = hoverPos.x + Math.cos(ang * deg) * 32
|
||||
y = hoverPos.y - Math.sin(ang * deg) * 32
|
||||
await page.mouse.move(hoverPos.x, hoverPos.y)
|
||||
await wiggleMove(
|
||||
page,
|
||||
|
@ -4,7 +4,6 @@ import { getUtils, setup, setupElectron, tearDown } from './test-utils'
|
||||
import { SaveSettingsPayload } from 'lib/settings/settingsTypes'
|
||||
import { TEST_SETTINGS_KEY, TEST_SETTINGS_CORRUPTED } from './storageStates'
|
||||
import * as TOML from '@iarna/toml'
|
||||
import { APP_NAME } from 'lib/constants'
|
||||
|
||||
test.beforeEach(async ({ context, page }) => {
|
||||
await setup(context, page)
|
||||
@ -205,7 +204,6 @@ test.describe('Testing settings', () => {
|
||||
})
|
||||
|
||||
await page.setViewportSize({ width: 1200, height: 500 })
|
||||
const u = await getUtils(page)
|
||||
|
||||
page.on('console', console.log)
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { test, expect, Page } from '@playwright/test'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { getUtils, setup, setupElectron, tearDown } from './test-utils'
|
||||
import { join } from 'path'
|
||||
import { getUtils, setup, tearDown } from './test-utils'
|
||||
|
||||
test.beforeEach(async ({ context, page }) => {
|
||||
await setup(context, page)
|
||||
|
@ -185,6 +185,8 @@ export function Toolbar({
|
||||
maybeIconConfig[0].disabled
|
||||
}
|
||||
name={maybeIconConfig[0].title}
|
||||
// aria-description is still in ARIA 1.3 draft.
|
||||
// eslint-disable-next-line jsx-a11y/aria-props
|
||||
aria-description={maybeIconConfig[0].description}
|
||||
onClick={() =>
|
||||
maybeIconConfig[0].onClick(configCallbackProps)
|
||||
@ -225,6 +227,8 @@ export function Toolbar({
|
||||
(!itemConfig.showTitle ? ' !px-0' : '')
|
||||
}
|
||||
name={itemConfig.title}
|
||||
// aria-description is still in ARIA 1.3 draft.
|
||||
// eslint-disable-next-line jsx-a11y/aria-props
|
||||
aria-description={itemConfig.description}
|
||||
aria-pressed={itemConfig.isActive}
|
||||
disabled={
|
||||
|
@ -154,10 +154,6 @@ export function buildCommandArgument<
|
||||
} satisfies Omit<CommandArgument<O, T>, 'inputType'>
|
||||
|
||||
if (arg.inputType === 'options') {
|
||||
if (!(arg.options || arg.optionsFromContext)) {
|
||||
throw new Error('Options must be provided for options input type')
|
||||
}
|
||||
|
||||
return {
|
||||
inputType: arg.inputType,
|
||||
...baseCommandArgument,
|
||||
|
@ -38,6 +38,9 @@ const bracket = startSketchOn('XY')
|
||||
tags: [getPreviousAdjacentEdge(outerEdge)]
|
||||
}, %)`
|
||||
|
||||
/**
|
||||
* @throws Error if the search text is not found in the example code.
|
||||
*/
|
||||
function findLineInExampleCode({
|
||||
searchText,
|
||||
example = bracket,
|
||||
@ -48,6 +51,8 @@ function findLineInExampleCode({
|
||||
const lines = example.split('\n')
|
||||
const lineNumber = lines.findIndex((l) => l.includes(searchText)) + 1
|
||||
if (lineNumber === 0) {
|
||||
// We are exporting a constant, so we don't want to return an Error.
|
||||
// eslint-disable-next-line suggest-no-throw/suggest-no-throw
|
||||
throw new Error(
|
||||
`Could not find the line with search text "${searchText}" in the example code. Was it removed?`
|
||||
)
|
||||
|
Reference in New Issue
Block a user