[Dev] Fix linting for JS files (#1864)
This commit is contained in:
parent
0d43e44c6c
commit
391c667f09
@ -98,7 +98,8 @@
|
||||
"teactn/prefer-separate-component-file": "off"
|
||||
},
|
||||
"settings": {
|
||||
"import/resolver": "webpack"
|
||||
"import/resolver": "webpack",
|
||||
"import/core-modules": ["fs", "path"]
|
||||
},
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const createPRComment = require('./createPRComment');
|
||||
const template = require('../.github/workflows/statoscope-comment.js');
|
||||
const template = require('../.github/workflows/statoscope-comment');
|
||||
|
||||
module.exports = async ({ github, context }) => {
|
||||
const data = JSON.parse(fs.readFileSync('result.json', 'utf8'));
|
||||
|
||||
@ -14,10 +14,10 @@
|
||||
"print_version": "node -p -e \"require('./package.json').version\"",
|
||||
"inc_version": "echo $((`cat .patch-version` + 1)) > .patch-version && echo \"$(node -p -e \"require('./package.json').version.match(/^\\d+\\.\\d+/)[0]\").$(cat .patch-version)\"",
|
||||
"telegraph:update_changelog": "node ./dev/telegraphChangelog.js",
|
||||
"check": "tsc && stylelint \"**/*.{css,scss}\" && eslint . --ext .ts,.tsx --ignore-pattern src/lib/gramjs",
|
||||
"check": "tsc && stylelint \"**/*.{css,scss}\" && eslint . --ext .ts,.tsx,.js --ignore-pattern src/lib/gramjs",
|
||||
"check:fix": "npm run check -- --fix",
|
||||
"gramjs:tl": "node ./src/lib/gramjs/tl/generateModules.js",
|
||||
"gramjs:lint": "eslint src/lib/gramjs --ext .ts,.tsx",
|
||||
"gramjs:lint": "eslint src/lib/gramjs --ext .ts,.tsx,.js",
|
||||
"gramjs:lint:fix": "npm run gramjs:lint -- --fix",
|
||||
"test": "cross-env APP_ENV=test jest --verbose --forceExit",
|
||||
"test:playwright": "playwright test",
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable prefer-const */
|
||||
/* eslint-disable eqeqeq */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
/*
|
||||
Superfast Blur - a fast Box Blur For Canvas
|
||||
|
||||
@ -268,7 +268,9 @@ function getRandomInt(min, max) {
|
||||
* @param ms time in milliseconds
|
||||
* @returns {Promise}
|
||||
*/
|
||||
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
const sleep = (ms) => new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
|
||||
/**
|
||||
* Helper to export two buffers of same length
|
||||
|
||||
@ -267,7 +267,6 @@ async function computeCheck(request, password) {
|
||||
K,
|
||||
]));
|
||||
|
||||
|
||||
return new constructors.InputCheckPasswordSRP({
|
||||
srpId: request.srpId,
|
||||
A: Buffer.from(aForHash),
|
||||
|
||||
@ -4,6 +4,7 @@ const { constructors } = require('./tl');
|
||||
const JPEG_HEADER = Buffer.from('ffd8ffe000104a46494600010100000100010000ffdb004300281c1e231e19282321232d2b28303c64413c37373c7b585d4964918099968f808c8aa0b4e6c3a0aadaad8a8cc8ffcbdaeef5ffffff9bc1fffffffaffe6fdfff8ffdb0043012b2d2d3c353c76414176f8a58ca5f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8f8ffc00011080000000003012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00', 'hex');
|
||||
const JPEG_FOOTER = Buffer.from('ffd9', 'hex');
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function _raiseCastFail(entity, target) {
|
||||
throw new Error(`Cannot cast ${entity.className} to any kind of ${target}`);
|
||||
}
|
||||
@ -125,7 +126,6 @@ function getInputChannel(entity) {
|
||||
_raiseCastFail(entity, 'InputChannel')
|
||||
}
|
||||
|
||||
|
||||
if (entity.SUBCLASS_OF_ID === 0x40f202fd) { // crc32(b'InputChannel')
|
||||
return entity
|
||||
}
|
||||
@ -511,7 +511,6 @@ function getMessageId(message) {
|
||||
throw new Error(`Invalid message type: ${message.constructor.name}`);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Parses the given username or channel access hash, given
|
||||
a string, username or URL. Returns a tuple consisting of
|
||||
|
||||
@ -205,7 +205,7 @@ class TelegramClient {
|
||||
return testChat;
|
||||
}
|
||||
|
||||
async invoke(request: Request) {
|
||||
invoke(request: Request) {
|
||||
// await new Promise(resolve => setTimeout(resolve, 1000))
|
||||
if (request instanceof GramJs.messages.GetDiscussionMessage) {
|
||||
return new GramJs.messages.DiscussionMessage({
|
||||
|
||||
@ -371,6 +371,7 @@ class TelegramClient {
|
||||
// if we don't already have an auth key we want to use normal DCs not -1
|
||||
const dc = utils.getDC(dcId, Boolean(sender.authKey.getKey()));
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
try {
|
||||
await sender.connect(new this._connection(
|
||||
@ -682,6 +683,7 @@ class TelegramClient {
|
||||
try {
|
||||
const buff = [];
|
||||
let offset = 0;
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const downloaded = new requests.upload.GetWebFile({
|
||||
location: new constructors.InputWebFileLocation({
|
||||
@ -718,6 +720,7 @@ class TelegramClient {
|
||||
try {
|
||||
const buff = [];
|
||||
let offset = 0;
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
try {
|
||||
const downloaded = new requests.upload.GetWebFile({
|
||||
|
||||
@ -68,7 +68,6 @@ class Factorizator {
|
||||
r = r.multiply(2);
|
||||
}
|
||||
|
||||
|
||||
if (g.eq(pq)) {
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
const { IGE: AESIGE } = require('@cryptography/aes');
|
||||
const Helpers = require('../Helpers');
|
||||
|
||||
|
||||
class IGENEW {
|
||||
constructor(key, iv) {
|
||||
this.ige = new AESIGE(key, iv);
|
||||
|
||||
@ -95,7 +95,6 @@ class Hash {
|
||||
this.data = new Uint8Array(data);
|
||||
}
|
||||
|
||||
|
||||
async digest() {
|
||||
if (this.algorithm === 'sha1') {
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
@ -109,8 +108,7 @@ class Hash {
|
||||
}
|
||||
|
||||
async function pbkdf2(password, salt, iterations) {
|
||||
const passwordKey = await crypto.subtle.importKey('raw', password,
|
||||
{ name: 'PBKDF2' }, false, ['deriveBits']);
|
||||
const passwordKey = await crypto.subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveBits']);
|
||||
return Buffer.from(await crypto.subtle.deriveBits({
|
||||
name: 'PBKDF2',
|
||||
hash: 'SHA-512',
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
* Errors not related to the Telegram API itself
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Occurs when a read operation was cancelled.
|
||||
*/
|
||||
|
||||
@ -5,7 +5,6 @@ const {
|
||||
BadRequestError,
|
||||
} = require('./RPCBaseErrors');
|
||||
|
||||
|
||||
class UserMigrateError extends InvalidDCError {
|
||||
constructor(args) {
|
||||
const newDc = Number(args.capture || 0);
|
||||
@ -17,7 +16,6 @@ class UserMigrateError extends InvalidDCError {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PhoneMigrateError extends InvalidDCError {
|
||||
constructor(args) {
|
||||
const newDc = Number(args.capture || 0);
|
||||
|
||||
@ -16,7 +16,6 @@ class EventBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
EventBuilder,
|
||||
};
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
let _level;
|
||||
|
||||
class Logger {
|
||||
|
||||
@ -83,8 +83,7 @@ class MessagePacker {
|
||||
afterId = state.after.msgId;
|
||||
}
|
||||
state.msgId = await this._state.writeDataAsMessage(
|
||||
buffer, state.data, state.request.classType === 'request',
|
||||
afterId,
|
||||
buffer, state.data, state.request.classType === 'request', afterId,
|
||||
);
|
||||
this._log.debug(`Assigned msgId = ${state.msgId} to ${state.request.className
|
||||
|| state.request.constructor.name}`);
|
||||
|
||||
@ -266,7 +266,8 @@ class MTProtoState {
|
||||
if (this.msgIds.length > 500) {
|
||||
this.msgIds.shift();
|
||||
}
|
||||
this.msgIds.push(remoteMsgId.toString());const remoteSequence = reader.readInt();
|
||||
this.msgIds.push(remoteMsgId.toString());
|
||||
const remoteSequence = reader.readInt();
|
||||
const containerLen = reader.readInt(); // msgLen for the inner object, padding ignored
|
||||
const diff = body.length - containerLen;
|
||||
// We want to check if it's between 12 and 1024
|
||||
|
||||
@ -48,7 +48,6 @@ class MemorySession extends Session {
|
||||
this._takeoutId = value
|
||||
}
|
||||
|
||||
|
||||
getUpdateState(entityId) {
|
||||
return this._updateStates[entityId]
|
||||
}
|
||||
|
||||
@ -149,7 +149,8 @@ class StorageSession extends MemorySession {
|
||||
|
||||
async delete() {
|
||||
try {
|
||||
return await this._delete();
|
||||
const deleted = await this._delete();
|
||||
return deleted;
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('Failed to delete session from storage');
|
||||
|
||||
@ -4,7 +4,6 @@ const BinaryReader = require('../extensions/BinaryReader');
|
||||
|
||||
const CURRENT_VERSION = '1';
|
||||
|
||||
|
||||
class StringSession extends MemorySession {
|
||||
/**
|
||||
* This session file can be easily saved and loaded as a string. According
|
||||
|
||||
@ -7,8 +7,8 @@ const {
|
||||
toSignedLittleBuffer,
|
||||
} = require('../Helpers');
|
||||
|
||||
const tlContent = require('./apiTl.js');
|
||||
const schemeContent = require('./schemaTl.js');
|
||||
const tlContent = require('./apiTl');
|
||||
const schemeContent = require('./schemaTl');
|
||||
|
||||
/* CONTEST
|
||||
const NAMED_AUTO_CASTS = new Set([
|
||||
|
||||
@ -210,7 +210,6 @@ function buildArgConfig(name, argType) {
|
||||
return currentConfig;
|
||||
}
|
||||
|
||||
|
||||
function* parseTl(content, layer, methods = [], ignoreIds = CORE_TYPES) {
|
||||
(methods || []).reduce((o, m) => ({
|
||||
...o,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
/* eslint-disable no-bitwise */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
const utf16 = {
|
||||
// The utf16-class is necessary to convert from javascripts internal character representation to unicode and back.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user