add prettier

This commit is contained in:
Alexander Popov 2023-04-06 18:03:40 +03:00
parent 9286270eb9
commit 797f31c4ab
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
9 changed files with 71 additions and 9 deletions

View File

@ -16,10 +16,14 @@ indent_size = 2
indent_style = tab
indent_size = 4
[{package*.json,.prettierrc}]
indent_style = space
indent_size = 2
[*.md]
trim_trailing_whitespace = false
[/.git/**]
[{node_modules/**,.git/**}]
charset = unset
end_of_line = unset
insert_final_newline = unset

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
**/.git
**/node_modules
*.html

10
.prettierrc Normal file
View File

@ -0,0 +1,10 @@
printWidth: 100
endOfLine: lf
useTabs: false
singleQuote: true
bracketSpacing: true
semi: true
overrides:
- files: 'src/js/*.{js}'
options:
parser: meriyah

27
package-lock.json generated Normal file
View File

@ -0,0 +1,27 @@
{
"name": "microJSengine",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"devDependencies": {
"prettier": "2.8.7"
}
},
"node_modules/prettier": {
"version": "2.8.7",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz",
"integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==",
"dev": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
}
}
}

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"devDependencies": {
"prettier": "2.8.7"
}
}

View File

@ -23,5 +23,5 @@ export class App {
this.scene.run();
requestAnimationFrame(this.run);
}
};
}

View File

@ -11,20 +11,23 @@ export class Pointer {
window.addEventListener('mouseup', this.mouseUp);
}
static set pos({ x, y }) { this.#x = x; this.#y = y; }
static set pos({ x, y }) {
this.#x = x;
this.#y = y;
}
static get pos() {
return { x: this.#x, y: this.#y };
}
static mouseMove = (e) => {
this.pos = { x: e.pageX, y: e.pageY };
}
};
static mouseDown = (e) => {
this.pos = { x: e.pageX, y: e.pageY };
}
};
static mouseUp = (e) => {
this.pos = { x: e.pageX, y: e.pageY };
}
};
}

View File

@ -54,8 +54,15 @@ export class Scene {
break;
case 'uStrokeRect':
this.#drawStrokeRect(item.x, item.y, item.width, item.height,
item.fillColor, item.strokeColor, item.strokeWidth);
this.#drawStrokeRect(
item.x,
item.y,
item.width,
item.height,
item.fillColor,
item.strokeColor,
item.strokeWidth
);
break;
default:

View File

@ -11,7 +11,9 @@ export class Settings {
configurable: true,
enumerable: true,
get: () => this.#props[property],
set: (setValue) => { this.#props[property] = setValue; },
set: (setValue) => {
this.#props[property] = setValue;
},
});
}