Fix most Github Actions 'annotations' in PRs (#417)

* Fix Github Actions 'annotations' in PRs
Fixes #383

* Fix the React Hooks complains, and _app for rust

* Revert "Fix the React Hooks complains, and _app for rust"

This reverts commit 4a2ff925e5.

* Add back prettier fix and rust _app

* Fmt

* More annotation fixes

* More non-hooks fixes

* Rollback with eslint rule

* Add APPLE_TEAM_ID secret

* Revert "Add APPLE_TEAM_ID secret"

This reverts commit 346aaff5f4.

* More fixes
This commit is contained in:
Pierre Jacquier
2023-11-01 07:39:31 -04:00
committed by GitHub
parent 0b0219b810
commit cf66b93963
15 changed files with 23 additions and 58 deletions

View File

@ -129,10 +129,10 @@ async fn get_user(
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
.setup(|app| { .setup(|_app| {
#[cfg(debug_assertions)] // only include this code on debug builds #[cfg(debug_assertions)] // only include this code on debug builds
{ {
let window = app.get_window("main").unwrap(); let window = _app.get_window("main").unwrap();
// comment out the below if you don't devtools to open everytime. // comment out the below if you don't devtools to open everytime.
// it's useful because otherwise devtools shuts everytime rust code changes. // it's useful because otherwise devtools shuts everytime rust code changes.
window.open_devtools(); window.open_devtools();

View File

@ -1,4 +1,3 @@
import { ToolTip } from './useStore'
import { Fragment, WheelEvent, useRef, useMemo } from 'react' import { Fragment, WheelEvent, useRef, useMemo } from 'react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faSearch, faX } from '@fortawesome/free-solid-svg-icons' import { faSearch, faX } from '@fortawesome/free-solid-svg-icons'
@ -15,23 +14,6 @@ export const sketchButtonClassnames = {
icon: 'text-fern-20 h-auto group-hover:text-fern-10 hover:text-fern-10 dark:text-chalkboard-100 dark:group-hover:text-chalkboard-100 dark:hover:text-chalkboard-100 group-disabled:bg-chalkboard-60 hover:group-disabled:text-inherit', icon: 'text-fern-20 h-auto group-hover:text-fern-10 hover:text-fern-10 dark:text-chalkboard-100 dark:group-hover:text-chalkboard-100 dark:hover:text-chalkboard-100 group-disabled:bg-chalkboard-60 hover:group-disabled:text-inherit',
} }
const sketchFnLabels: Record<ToolTip | 'sketch_line' | 'move', string> = {
sketch_line: 'Line',
line: 'Line',
move: 'Move',
angledLine: 'Angled Line',
angledLineThatIntersects: 'Angled Line That Intersects',
angledLineOfXLength: 'Angled Line Of X Length',
angledLineOfYLength: 'Angled Line Of Y Length',
angledLineToX: 'Angled Line To X',
angledLineToY: 'Angled Line To Y',
lineTo: 'Line to Point',
xLine: 'Horizontal Line',
yLine: 'Vertical Line',
xLineTo: 'Horizontal Line to Point',
yLineTo: 'Vertical Line to Point',
}
export const Toolbar = () => { export const Toolbar = () => {
const { state, send, context } = useModelingContext() const { state, send, context } = useModelingContext()
const toolbarButtonsRef = useRef<HTMLSpanElement>(null) const toolbarButtonsRef = useRef<HTMLSpanElement>(null)

View File

@ -184,6 +184,7 @@ function DisplayObj({
</li> </li>
) )
} }
return null
})} })}
</ul> </ul>
</span> </span>

View File

@ -2,7 +2,7 @@ import { IndexLoaderData, paths } from 'Router'
import { ActionButton } from './ActionButton' import { ActionButton } from './ActionButton'
import Tooltip from './Tooltip' import Tooltip from './Tooltip'
import { FileEntry } from '@tauri-apps/api/fs' import { FileEntry } from '@tauri-apps/api/fs'
import { Dispatch, useEffect, useRef, useState } from 'react' import { Dispatch, useRef, useState } from 'react'
import { useNavigate } from 'react-router-dom' import { useNavigate } from 'react-router-dom'
import { Dialog, Disclosure } from '@headlessui/react' import { Dialog, Disclosure } from '@headlessui/react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'

View File

@ -20,7 +20,6 @@ import {
recast, recast,
parse, parse,
Program, Program,
VariableDeclarator,
PipeExpression, PipeExpression,
CallExpression, CallExpression,
} from 'lang/wasm' } from 'lang/wasm'

View File

@ -267,11 +267,11 @@ export const Stream = ({ className = '' }) => {
} }
engineCommandManager.sendSceneCommand(command).then(async () => { engineCommandManager.sendSceneCommand(command).then(async () => {
if (!context.sketchPathToNode) return if (!context.sketchPathToNode) return
const varDec = getNodeFromPath<VariableDeclarator>( getNodeFromPath<VariableDeclarator>(
kclManager.ast, kclManager.ast,
context.sketchPathToNode, context.sketchPathToNode,
'VariableDeclarator' 'VariableDeclarator'
).node )
// Get the current plane string for plane we are on. // Get the current plane string for plane we are on.
let currentPlaneString = '' let currentPlaneString = ''
if (context.sketchPlaneId === kclManager.getPlaneId('xy')) { if (context.sketchPlaneId === kclManager.getPlaneId('xy')) {

View File

@ -69,7 +69,7 @@ export function applyConstraintEqualLength({
modifiedAst: Program modifiedAst: Program
pathToNodeMap: PathToNodeMap pathToNodeMap: PathToNodeMap
} { } {
const { enabled, transforms } = setEqualLengthInfo({ selectionRanges }) const { transforms } = setEqualLengthInfo({ selectionRanges })
const { modifiedAst, pathToNodeMap } = transformSecondarySketchLinesTagFirst({ const { modifiedAst, pathToNodeMap } = transformSecondarySketchLinesTagFirst({
ast: kclManager.ast, ast: kclManager.ast,
selectionRanges, selectionRanges,

View File

@ -108,6 +108,7 @@ export default class Client extends jsrpc.JSONRPCServerAndClient {
break break
} }
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
messageString += message messageString += message
return return
}) })

View File

@ -2,8 +2,6 @@ import { useEffect } from 'react'
import { useStore } from 'useStore' import { useStore } from 'useStore'
import { engineCommandManager } from '../lang/std/engineConnection' import { engineCommandManager } from '../lang/std/engineConnection'
import { useModelingContext } from './useModelingContext' import { useModelingContext } from './useModelingContext'
import { v4 as uuidv4 } from 'uuid'
import { SourceRange } from 'lang/wasm'
import { getEventForSelectWithPoint } from 'lib/selections' import { getEventForSelectWithPoint } from 'lib/selections'
export function useEngineConnectionSubscriptions() { export function useEngineConnectionSubscriptions() {
@ -13,11 +11,6 @@ export function useEngineConnectionSubscriptions() {
})) }))
const { send, context } = useModelingContext() const { send, context } = useModelingContext()
interface RangeAndId {
id: string
range: SourceRange
}
useEffect(() => { useEffect(() => {
if (!engineCommandManager) return if (!engineCommandManager) return

View File

@ -1,5 +1,5 @@
import { useLayoutEffect, useEffect, useRef } from 'react' import { useLayoutEffect, useEffect, useRef } from 'react'
import { _executor, parse } from '../lang/wasm' import { parse } from '../lang/wasm'
import { useStore } from '../useStore' import { useStore } from '../useStore'
import { engineCommandManager } from '../lang/std/engineConnection' import { engineCommandManager } from '../lang/std/engineConnection'
import { deferExecution } from 'lib/utils' import { deferExecution } from 'lib/utils'

View File

@ -310,7 +310,7 @@ export function extrudeSketch(
const name = findUniqueName(node, 'part') const name = findUniqueName(node, 'part')
const VariableDeclaration = createVariableDeclaration(name, extrudeCall) const VariableDeclaration = createVariableDeclaration(name, extrudeCall)
let showCallIndex = getShowIndex(_node) let showCallIndex = getShowIndex(_node)
if (showCallIndex == -1) { if (showCallIndex === -1) {
// We didn't find a show, so let's just append everything // We didn't find a show, so let's just append everything
showCallIndex = _node.body.length showCallIndex = _node.body.length
} }

View File

@ -982,7 +982,7 @@ export class EngineCommandManager {
if (parseCommand.type === 'modeling_cmd_req') if (parseCommand.type === 'modeling_cmd_req')
return this.handlePendingCommand(id, parseCommand?.cmd, range) return this.handlePendingCommand(id, parseCommand?.cmd, range)
} }
throw 'shouldnt reach here' throw Error('shouldnt reach here')
} }
handlePendingCommand( handlePendingCommand(
id: string, id: string,

View File

@ -20,7 +20,6 @@ import {
import { isLiteralArrayOrStatic } from './sketchcombos' import { isLiteralArrayOrStatic } from './sketchcombos'
import { toolTips, ToolTip } from '../../useStore' import { toolTips, ToolTip } from '../../useStore'
import { createPipeExpression, splitPathAtPipeExpression } from '../modifyAst' import { createPipeExpression, splitPathAtPipeExpression } from '../modifyAst'
import { generateUuidFromHashSeed } from '../../lib/uuid'
import { SketchLineHelper, ModifyAstBase, TransformCallback } from './stdTypes' import { SketchLineHelper, ModifyAstBase, TransformCallback } from './stdTypes'
@ -92,18 +91,12 @@ export function createFirstArg(
throw new Error('all sketch line types should have been covered') throw new Error('all sketch line types should have been covered')
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
type LineData = { type LineData = {
from: [number, number, number] from: [number, number, number]
to: [number, number, number] to: [number, number, number]
} }
function makeId(seed: string | any) {
if (typeof seed === 'string') {
return generateUuidFromHashSeed(seed)
}
return generateUuidFromHashSeed(JSON.stringify(seed))
}
export const lineTo: SketchLineHelper = { export const lineTo: SketchLineHelper = {
add: ({ add: ({
node, node,
@ -250,9 +243,6 @@ export const line: SketchLineHelper = {
]) ])
if (callExpression.arguments?.[0].type === 'ObjectExpression') { if (callExpression.arguments?.[0].type === 'ObjectExpression') {
const toProp = callExpression.arguments?.[0].properties?.find(
({ key }) => key.name === 'to'
)
mutateObjExpProp(callExpression.arguments?.[0], toArrExp, 'to') mutateObjExpProp(callExpression.arguments?.[0], toArrExp, 'to')
} else { } else {
mutateArrExp(callExpression.arguments?.[0], toArrExp) mutateArrExp(callExpression.arguments?.[0], toArrExp)
@ -974,14 +964,12 @@ export function addNewSketchLn({
const node = JSON.parse(JSON.stringify(_node)) const node = JSON.parse(JSON.stringify(_node))
const { add, updateArgs } = sketchLineHelperMap?.[fnName] || {} const { add, updateArgs } = sketchLineHelperMap?.[fnName] || {}
if (!add || !updateArgs) throw new Error('not a sketch line helper') if (!add || !updateArgs) throw new Error('not a sketch line helper')
const { node: varDec } = getNodeFromPath<VariableDeclarator>( getNodeFromPath<VariableDeclarator>(node, pathToNode, 'VariableDeclarator')
getNodeFromPath<PipeExpression | CallExpression>(
node, node,
pathToNode, pathToNode,
'VariableDeclarator' 'PipeExpression'
) )
const { node: pipeExp, shallowPath: pipePath } = getNodeFromPath<
PipeExpression | CallExpression
>(node, pathToNode, 'PipeExpression')
return add({ return add({
node, node,
previousProgramMemory, previousProgramMemory,

View File

@ -9,6 +9,7 @@ import { v4 as uuidv4 } from 'uuid'
type WebSocketResponse = Models['OkWebSocketResponseData_type'] type WebSocketResponse = Models['OkWebSocketResponseData_type']
class MockEngineCommandManager { class MockEngineCommandManager {
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
constructor(mockParams: { constructor(mockParams: {
setIsStreamReady: (isReady: boolean) => void setIsStreamReady: (isReady: boolean) => void
setMediaStream: (stream: MediaStream) => void setMediaStream: (stream: MediaStream) => void

View File

@ -882,7 +882,7 @@ export const modelingMachine = createMachine(
// TODO implement source ranges for all of these constraints // TODO implement source ranges for all of these constraints
// need to make the async like the modal constraints // need to make the async like the modal constraints
'Make selection horizontal': ({ selectionRanges }) => { 'Make selection horizontal': ({ selectionRanges }) => {
const { modifiedAst, pathToNodeMap } = applyConstraintHorzVert( const { modifiedAst } = applyConstraintHorzVert(
selectionRanges, selectionRanges,
'horizontal', 'horizontal',
kclManager.ast, kclManager.ast,
@ -891,7 +891,7 @@ export const modelingMachine = createMachine(
kclManager.updateAst(modifiedAst, true) kclManager.updateAst(modifiedAst, true)
}, },
'Make selection vertical': ({ selectionRanges }) => { 'Make selection vertical': ({ selectionRanges }) => {
const { modifiedAst, pathToNodeMap } = applyConstraintHorzVert( const { modifiedAst } = applyConstraintHorzVert(
selectionRanges, selectionRanges,
'vertical', 'vertical',
kclManager.ast, kclManager.ast,
@ -900,33 +900,33 @@ export const modelingMachine = createMachine(
kclManager.updateAst(modifiedAst, true) kclManager.updateAst(modifiedAst, true)
}, },
'Constrain horizontally align': ({ selectionRanges }) => { 'Constrain horizontally align': ({ selectionRanges }) => {
const { modifiedAst, pathToNodeMap } = applyConstraintHorzVertAlign({ const { modifiedAst } = applyConstraintHorzVertAlign({
selectionRanges, selectionRanges,
constraint: 'setVertDistance', constraint: 'setVertDistance',
}) })
kclManager.updateAst(modifiedAst, true) kclManager.updateAst(modifiedAst, true)
}, },
'Constrain vertically align': ({ selectionRanges }) => { 'Constrain vertically align': ({ selectionRanges }) => {
const { modifiedAst, pathToNodeMap } = applyConstraintHorzVertAlign({ const { modifiedAst } = applyConstraintHorzVertAlign({
selectionRanges, selectionRanges,
constraint: 'setHorzDistance', constraint: 'setHorzDistance',
}) })
kclManager.updateAst(modifiedAst, true) kclManager.updateAst(modifiedAst, true)
}, },
'Constrain equal length': ({ selectionRanges }) => { 'Constrain equal length': ({ selectionRanges }) => {
const { modifiedAst, pathToNodeMap } = applyConstraintEqualLength({ const { modifiedAst } = applyConstraintEqualLength({
selectionRanges, selectionRanges,
}) })
kclManager.updateAst(modifiedAst, true) kclManager.updateAst(modifiedAst, true)
}, },
'Constrain parallel': ({ selectionRanges }) => { 'Constrain parallel': ({ selectionRanges }) => {
const { modifiedAst, pathToNodeMap } = applyConstraintEqualAngle({ const { modifiedAst } = applyConstraintEqualAngle({
selectionRanges, selectionRanges,
}) })
kclManager.updateAst(modifiedAst, true) kclManager.updateAst(modifiedAst, true)
}, },
'Constrain remove constraints': ({ selectionRanges }) => { 'Constrain remove constraints': ({ selectionRanges }) => {
const { modifiedAst, pathToNodeMap } = applyRemoveConstrainingValues({ const { modifiedAst } = applyRemoveConstrainingValues({
selectionRanges, selectionRanges,
}) })
kclManager.updateAst(modifiedAst, true) kclManager.updateAst(modifiedAst, true)