mirror of
https://github.com/jwetzell/psn-js.git
synced 2026-09-01 12:29:15 +00:00
linting
This commit is contained in:
Vendored
+1
-3
@@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll": "explicit",
|
"source.fixAll": "explicit"
|
||||||
"source.organizeImports": "explicit"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// recreation of psn_client.cpp example from https://github.com/vyv/psn-cpp
|
// recreation of psn_client.cpp example from https://github.com/vyv/psn-cpp
|
||||||
const dgram = require('dgram');
|
const dgram = require('node:dgram');
|
||||||
const { Decoder } = require('../dist/cjs');
|
const { Decoder } = require('@jwetzell/posistagenet');
|
||||||
|
|
||||||
const client = dgram.createSocket('udp4');
|
const client = dgram.createSocket('udp4');
|
||||||
const decoder = new Decoder();
|
const decoder = new Decoder();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// recreation of psn_server.cpp example from https://github.com/vyv/psn-cpp
|
// recreation of psn_server.cpp example from https://github.com/vyv/psn-cpp
|
||||||
const dgram = require('dgram');
|
const dgram = require('node:dgram');
|
||||||
const { Encoder, Tracker } = require('../dist/cjs');
|
const { Encoder, Tracker } = require('@jwetzell/posistagenet');
|
||||||
|
|
||||||
const client = dgram.createSocket('udp4');
|
const client = dgram.createSocket('udp4');
|
||||||
const encoder = new Encoder('Test PSN Server', 2, 0);
|
const encoder = new Encoder('Test PSN Server', 2, 0);
|
||||||
@@ -25,7 +25,7 @@ const distFromSun = [
|
|||||||
|
|
||||||
let timestamp = 0;
|
let timestamp = 0;
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
orbits.forEach((orbit, index) => {
|
orbits.forEach((_, index) => {
|
||||||
const a = 1.0 / orbits[index];
|
const a = 1.0 / orbits[index];
|
||||||
const b = distFromSun[index];
|
const b = distFromSun[index];
|
||||||
const x = timestamp;
|
const x = timestamp;
|
||||||
|
|||||||
+2
-3
@@ -2,7 +2,7 @@ import { Decoders } from './index.js';
|
|||||||
import {
|
import {
|
||||||
type DataPacketChunk,
|
type DataPacketChunk,
|
||||||
type InfoPacketChunk,
|
type InfoPacketChunk,
|
||||||
Tracker,
|
type Tracker,
|
||||||
TrackerFromData,
|
TrackerFromData,
|
||||||
TrackerFromInfo,
|
TrackerFromInfo,
|
||||||
} from './models/index.js';
|
} from './models/index.js';
|
||||||
@@ -15,7 +15,6 @@ export class Decoder {
|
|||||||
trackers: { [key: string]: Tracker } = {};
|
trackers: { [key: string]: Tracker } = {};
|
||||||
|
|
||||||
systemName: string = '';
|
systemName: string = '';
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
updateInfo(framePackets: InfoPacketChunk[]) {
|
updateInfo(framePackets: InfoPacketChunk[]) {
|
||||||
framePackets.forEach((packet) => {
|
framePackets.forEach((packet) => {
|
||||||
@@ -64,7 +63,7 @@ export class Decoder {
|
|||||||
|
|
||||||
if (packet.header.id === 0x6756) {
|
if (packet.header.id === 0x6756) {
|
||||||
const infoPacket = Decoders.InfoPacketChunk(packetBuf);
|
const infoPacket = Decoders.InfoPacketChunk(packetBuf);
|
||||||
if (infoPacket && infoPacket.chunk.header.hasSubchunks) {
|
if (infoPacket?.chunk.header.hasSubchunks) {
|
||||||
const currentInfoPacketHeader = infoPacket.data.packetHeader;
|
const currentInfoPacketHeader = infoPacket.data.packetHeader;
|
||||||
if (!currentInfoPacketHeader) {
|
if (!currentInfoPacketHeader) {
|
||||||
// NOTE(jwetzell): not sure that info packets without a header subchunk are valid?
|
// NOTE(jwetzell): not sure that info packets without a header subchunk are valid?
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { Constants } from './constants.js';
|
import { Constants } from './constants.js';
|
||||||
import { Encoders, Tracker } from './index.js';
|
import { Encoders, type Tracker } from './index.js';
|
||||||
|
|
||||||
export class Encoder {
|
export class Encoder {
|
||||||
private systemName: string;
|
private systemName: string;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Decoders } from '@jwetzell/posistagenet';
|
import { Decoders } from '@jwetzell/posistagenet';
|
||||||
import { deepEqual, throws } from 'assert';
|
import { deepEqual, throws } from 'node:assert';
|
||||||
import { describe, it } from 'node:test';
|
import { describe, it } from 'node:test';
|
||||||
|
|
||||||
const goodTests = [
|
const goodTests = [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Encoders } from '@jwetzell/posistagenet';
|
import { deepEqual, throws } from 'node:assert';
|
||||||
import { deepEqual, throws } from 'assert';
|
|
||||||
import { describe, it } from 'node:test';
|
import { describe, it } from 'node:test';
|
||||||
|
import { Encoders } from '@jwetzell/posistagenet';
|
||||||
|
|
||||||
const goodTests = [
|
const goodTests = [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user