Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed Jun 19, 2024
1 parent f220566 commit 4403640
Show file tree
Hide file tree
Showing 13 changed files with 87 additions and 59 deletions.
26 changes: 0 additions & 26 deletions .eslintrc.cjs

This file was deleted.

52 changes: 52 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
})

export default [
{
ignores: ['packages/server/upload', 'packages/server/upload_test', '**/*.js', 'packages/projects/projects/**/*']
},
...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended'),
{
plugins: {
'@typescript-eslint': typescriptEslint
},

languageOptions: {
globals: {
...globals.browser,
...globals.node
},

parser: tsParser
},

rules: {
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'prefer-const': 'warn',
'no-async-promise-executor': 'off',
'no-useless-escape': 'off',
'@typescript-eslint/no-extra-semi': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'no-fallthrough': 'off'
}
}
]
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
]
},
"devDependencies": {
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.5.0",
"@ianvs/prettier-plugin-sort-imports": "4.1.0",
"@swc/core": "1.3.41",
"@testing-library/react": "15.0.4",
Expand All @@ -114,12 +116,13 @@
"@types/mocha": "10.0.1",
"@types/primus": "^7.3.6",
"@types/three": "0.158.0",
"@typescript-eslint/eslint-plugin": "5.56.0",
"@typescript-eslint/parser": "5.56.0",
"@typescript-eslint/eslint-plugin": "7.13.1",
"@typescript-eslint/parser": "7.13.1",
"concurrently": "7.6.0",
"deep-object-diff": "^1.1.9",
"depcheck": "1.4.3",
"eslint": "8.36.0",
"eslint": "9.5.0",
"globals": "15.6.0",
"jsdom": "^21.1.1",
"kill-port": "2.0.1",
"lerna": "6.5.1",
Expand Down
3 changes: 1 addition & 2 deletions packages/editor/src/components/assets/SceneAssetsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-case-declarations */
/*
CPAL-1.0 License
Expand Down Expand Up @@ -190,7 +189,7 @@ const SceneAssetsPanel = () => {
useEffect(() => {
const staticResourcesFindApi = () => {
const query = {
key: { $like: `%${searchText.value}%` || undefined },
key: { $like: `%${searchText.value}%` },
$sort: { mimeType: 1 },
$limit: 10000,
project: projectName.value!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ export function* heirarchyTreeWalker(sceneID: string, treeNode: Entity): Generat
const entityTreeComponent = getComponent(entityNode as Entity, EntityTreeComponent)

// treat entites with all helper children as leaf nodes
const allhelperChildren =
false || entityTreeComponent.children.every((child) => !hasComponent(child, SourceComponent))
const allhelperChildren = entityTreeComponent.children.every((child) => !hasComponent(child, SourceComponent))

yield {
isLeaf: entityTreeComponent.children.length === 0 || allhelperChildren,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const InputFieldForValue = ({
valueType
}: Pick<InputSocketProps, 'choices' | 'value' | 'defaultValue' | 'name' | 'onChange' | 'valueType'>) => {
const showChoices = choices?.length
const inputVal = String(value) ?? defaultValue ?? ''
const inputVal = String(value) // ?? defaultValue ?? ''
const inputSocketStyle = {
backgroundColor: 'var(--panelCards)',
cursor: 'pointer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ export async function combineMaterials(document: Document) {
if (eeMat !== null && cachedEEMat !== null) {
return (
eeMat.prototype === cachedEEMat.prototype &&
((eeMat.args === cachedEEMat.args) === null || (cachedEEMat.args && eeMat.args?.equals(cachedEEMat.args)))
((eeMat.args === cachedEEMat.args && eeMat.args === null) ||
(cachedEEMat.args && eeMat.args?.equals(cachedEEMat.args)))
)
} else return material.equals(cachedMaterial)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ export const getProjectCommits = async (
}

export const findBuilderTags = async (): Promise<Array<ProjectBuilderTagsType>> => {
const builderRepo = `${process.env.SOURCE_REPO_URL}/${process.env.SOURCE_REPO_NAME_STEM}-builder` || ''
const builderRepo = `${process.env.SOURCE_REPO_URL}/${process.env.SOURCE_REPO_NAME_STEM}-builder`
const publicECRExec = publicECRRepoRegex.exec(builderRepo)
const privateECRExec = privateECRRepoRegex.exec(builderRepo)
if (publicECRExec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const server = {
hub: JSON.stringify({
endpoint: process.env.HUB_ENDPOINT
}),
url: '' || (null! as string),
url: '',
certPath: appRootPath.path.toString() + '/' + process.env.CERT,
keyPath: appRootPath.path.toString() + '/' + process.env.KEY,
gitPem: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ const AssetPanel = () => {
const staticResourcesFindApi = () => {
const query = {
key: {
$like: `%${searchText.value}%` || undefined
$like: `%${searchText.value}%`
},
type: 'asset',
project: projectName.value!,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const InputFieldForValue = ({
valueType
}: Pick<InputSocketProps, 'choices' | 'value' | 'defaultValue' | 'name' | 'onChange' | 'valueType'>) => {
const showChoices = choices?.length
const inputVal = String(value) ?? defaultValue ?? ''
const inputVal = String(value) // ?? defaultValue ?? ''
const inputSocketStyle = {
userDrag: 'none',
WebkitUserDrag: 'none',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,24 @@ export const ImageSourceProperties: EditorComponentType = (props) => {
/>
</InputGroup>
{
/*imageComponent.alphaMode.value === ImageAlphaMode.Mask*/ true && (
<InputGroup
name="Alpha Cutoff"
label={t('editor:properties.image.lbl-alphaCutoff')}
info={t('editor:properties.image.info-alphaCutoff')}
>
<NumericInput
min={0}
max={1}
smallStep={0.01}
mediumStep={0.1}
largeStep={0.25}
value={/*imageComponent.alphaCutoff.value*/ 0}
onChange={updateProperty(ImageComponent, 'alphaCutoff')}
onRelease={commitProperty(ImageComponent, 'alphaCutoff')}
/>
</InputGroup>
)
/*{imageComponent.alphaMode.value === ImageAlphaMode.Mask && (*/
<InputGroup
name="Alpha Cutoff"
label={t('editor:properties.image.lbl-alphaCutoff')}
info={t('editor:properties.image.info-alphaCutoff')}
>
<NumericInput
min={0}
max={1}
smallStep={0.01}
mediumStep={0.1}
largeStep={0.25}
value={/*imageComponent.alphaCutoff.value*/ 0}
onChange={updateProperty(ImageComponent, 'alphaCutoff')}
onRelease={commitProperty(ImageComponent, 'alphaCutoff')}
/>
</InputGroup>
/** )} */
}
<InputGroup name="Projection" label={t('editor:properties.image.lbl-projection')}>
<SelectInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ export const ListLoop = makeFlowNodeDefinition({
initialState: undefined,
triggered: ({ read, write, commit }) => {
const list = read<any[]>('list')
const startIndex = Math.max(0, Number(read<bigint>('startIndex')) ?? 0)
const endIndex = Math.min(list.length, Number(read<bigint>('endIndex')) ?? list.length)
const startIndex = Math.max(0, Number(read<bigint>('startIndex')) || 0)
const endIndex = Math.min(list.length, Number(read<bigint>('endIndex')) || list.length)
const loopBodyIteration = (i: number) => {
if (i < endIndex) {
write('value', JSON.stringify(list[i]))
Expand Down

0 comments on commit 4403640

Please sign in to comment.