Add eslint (#364)

* Add initial prettier and eslint configs

* Modify prettierrc

* Run eslint on everything

* Actually remove prettier

* Fix some eslints

* Remove label in gs2

* Update CHANGELOG

* Update eslintrc to specify es2021
This commit is contained in:
CosminPerRam 2023-09-19 19:52:35 +03:00 committed by GitHub
parent bff9507189
commit 93a9095d99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 6960 additions and 5211 deletions

View file

@ -1,39 +1,39 @@
import Core from './core.js';
export default class mumble extends Core {
async run(state) {
const json = await this.withTcp(async socket => {
return await this.tcpSend(socket, 'json', (buffer) => {
if (buffer.length < 10) return;
const str = buffer.toString();
let json;
try {
json = JSON.parse(str);
} catch (e) {
// probably not all here yet
return;
}
return json;
});
});
state.raw = json;
state.name = json.name;
state.gamePort = json.x_gtmurmur_connectport || 64738;
let channelStack = [state.raw.root];
while(channelStack.length) {
const channel = channelStack.shift();
channel.description = this.cleanComment(channel.description);
channelStack = channelStack.concat(channel.channels);
for(const user of channel.users) {
user.comment = this.cleanComment(user.comment);
state.players.push(user);
}
}
}
cleanComment(str) {
return str.replace(/<.*>/g,'');
}
}
import Core from './core.js'
export default class mumble extends Core {
async run (state) {
const json = await this.withTcp(async socket => {
return await this.tcpSend(socket, 'json', (buffer) => {
if (buffer.length < 10) return
const str = buffer.toString()
let json
try {
json = JSON.parse(str)
} catch (e) {
// probably not all here yet
return
}
return json
})
})
state.raw = json
state.name = json.name
state.gamePort = json.x_gtmurmur_connectport || 64738
let channelStack = [state.raw.root]
while (channelStack.length) {
const channel = channelStack.shift()
channel.description = this.cleanComment(channel.description)
channelStack = channelStack.concat(channel.channels)
for (const user of channel.users) {
user.comment = this.cleanComment(user.comment)
state.players.push(user)
}
}
}
cleanComment (str) {
return str.replace(/<.*>/g, '')
}
}