Skip to content

Commit

Permalink
Update Examples Browser NPM dependencies (#7113)
Browse files Browse the repository at this point in the history
* Update Examples Browser NPM dependencies

* Fix a couple of eslint warnings

* Fix another eslint error

* Fix another eslint error

* Remove newline@

* Fix another eslint error

* Reverted tokenizer and language regex eslint fixes

---------

Co-authored-by: kpal <[email protected]>
  • Loading branch information
willeastcott and kpal81xd authored Nov 14, 2024
1 parent a611fe2 commit c234bed
Show file tree
Hide file tree
Showing 179 changed files with 3,727 additions and 3,219 deletions.
2 changes: 0 additions & 2 deletions examples/assets/scripts/misc/camera-frame.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable jsdoc/check-tag-names */

import {
Script,
Color,
Expand Down
30 changes: 30 additions & 0 deletions examples/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import playcanvasConfig from '@playcanvas/eslint-config';
import globals from 'globals';

export default [
...playcanvasConfig,
{
files: ['**/*.js', '**/*.mjs'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
'ObjModelParser': 'readonly',
'OutlineEffect': 'readonly'
}
},
rules: {
'import/no-unresolved': 'off'
}
},
{
ignores: [
'assets/scripts/utils/area-light-lut-bin-gen.js',
'cache',
'dist',
'src/lib',
'src/app/monaco/languages',
'src/app/monaco/tokenizer-rules.mjs'
]
}
];
6 changes: 3 additions & 3 deletions examples/iframe/loader.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { updateDeviceType, fetchFile, localImport, clearImports, parseConfig, fire } from 'examples/utils';
import { data, refresh } from 'examples/observer';
import files from 'examples/files';
import { data, refresh } from 'examples/observer';
import { updateDeviceType, fetchFile, localImport, clearImports, parseConfig, fire } from 'examples/utils';

import MiniStats from './ministats.mjs';

Expand Down Expand Up @@ -82,7 +82,7 @@ class ExampleLoader {
*/
const locations = [];
lines.forEach((line) => {
const match = /^\s*at\s(.+):(\d+):(\d+)$/g.exec(line);
const match = /^\s*at\s(.+):(\d+):(\d+)$/.exec(line);
if (!match) {
return;
}
Expand Down
12 changes: 6 additions & 6 deletions examples/iframe/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export const rootPath = root.replace(/\/iframe/g, '');
*/
export function getQueryParams(url) {
return Object.fromEntries(url
.split('?').pop()
.split('#')[0]
.split('&').map(s => s.split('=')));
.split('?').pop()
.split('#')[0]
.split('&').map(s => s.split('=')));
}

/**
Expand Down Expand Up @@ -90,14 +90,14 @@ export function clearImports() {
* @returns {Record<string, any>} - The parsed config.
*/
export function parseConfig(script) {
const regex = /\/\/ @config ([^ \n]+) ?([^\n]+)?/g;
const regex = /\/\/ @config (\S+)(?:\s+([^\n]+))?/g;
let match;
/** @type {Record<string, any>} */
const config = {};
while ((match = regex.exec(script)) !== null) {
const key = match[1].trim();
const val = match[2]?.trim();
config[key] = /true|false/g.test(val) ? val === 'true' : val ?? true;
config[key] = /true|false/.test(val) ? val === 'true' : val ?? true;
}
return config;
}
Expand All @@ -113,7 +113,7 @@ export function updateDeviceType(config) {
deviceType = DEVICE_TYPES.includes(savedDevice) ? savedDevice : 'webgl2';

if (params.deviceType && DEVICE_TYPES.includes(params.deviceType)) {
console.warn("Overriding default device: ", params.deviceType);
console.warn('Overriding default device: ', params.deviceType);
deviceType = params.deviceType;
return;
}
Expand Down
Loading

0 comments on commit c234bed

Please sign in to comment.