Expected linebreaks to be 'CRLF' But found 'LF'


#1

Screenshot_9

I haven’t open my project from some long and today it created error now bot is down i don’t understand how to fix
If i Remove “/eslint linebreak-style: [“error”, “windows”]/” this line from code it still says
line 43: Killed node Rainbow.js

bot was running from long suddenly stopped working started giving error


#2

Rainbow.js Code

require(`${process.cwd()}/extenders/Guild.js`);
require(`${process.cwd()}/modules/Prototypes.js`);

/*eslint linebreak-style: ["error", "windows"]*/

if (process.version.slice(1).split(".")[0] < 8) throw new Error("Node 8.0.0 or higher is required. Update Node on your system.");

const Discord = require("discord.js");
const Enmap = require("enmap");
const EnmapLevel = require("enmap-level");
const klaw = require("klaw");
const path = require("path");

const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
  console.log(Date.now() + " Ping Received");
  response.sendStatus(200);
});
app.listen(process.env.PORT);
  http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);

class Rainbow extends Discord.Client {
  constructor(options) {
    super(options);
    this.logger = require(`${process.cwd()}/util/Logger`);

    this.commands = new Enmap();
    this.aliases = new Enmap();
    this.ratelimits = new Enmap();
  }

  loadCommand(commandPath, commandName) {
    try {
      const props = new (require(`${commandPath}${path.sep}${commandName}`))(client);
      // client.logger.log(`Loading Command: ${props.help.name}. 👌`, "log");
      props.conf.location = commandPath;
      if (props.init) {
        props.init(client);
      }
      client.commands.set(props.help.name, props);
      props.conf.aliases.forEach(alias => {
        client.aliases.set(alias, props.help.name);
      }); //Here Line:43
      
      return false;
    } catch (e) {
      return `Unable to load command ${commandName}: ${e}`;
    }
  }

  async unloadCommand(commandPath, commandName) {
    let command;
    if (client.commands.has(commandName)) {
      command = client.commands.get(commandName);
    } else if (client.aliases.has(commandName)) {
      command = client.commands.get(client.aliases.get(commandName));
    }
    if (!command) return `The command \`${commandName}\` doesn"t seem to exist, nor is it an alias. Try again!`;

    if (command.shutdown) {
      await command.shutdown(client);
    }
    delete require.cache[require.resolve(`${commandPath}${path.sep}${commandName}.js`)];
    return false;
  }
}

const client = new Rainbow({
  fetchAllMembers: true,
  disableEveryone: true,
  disabledEvents:["TYPING_START"]
});

require("./modules/functions.js")(client);

const init = async () => {

  const commandList = [];
  klaw("./commands").on("data", (item) => {
    const cmdFile = path.parse(item.path);
    if (!cmdFile.ext || cmdFile.ext !== ".js") return;
    const response = client.loadCommand(cmdFile.dir, `${cmdFile.name}${cmdFile.ext}`);
    commandList.push(cmdFile.name);
    if (response) client.logger.error(response);
  }).on("end", () => {
    client.logger.log(`Loaded a total of ${commandList.length} commands.`);
  }).on("error", (error) => client.logger.error(error));
  
  const extendList = [];
  klaw("./extenders").on("data", (item) => {
    const extFile = path.parse(item.path);
    if (!extFile.ext || extFile.ext !== ".js") return;
    try {
      require(`${extFile.dir}${path.sep}${extFile.base}`);
      extendList.push(extFile.name);
    } catch (error) {
      client.logger.error(`Error loading ${extFile.name} extension: ${error}`);
    }
  }).on("end", () => {
    client.logger.log(`Loaded a total of ${extendList.length} extensions.`);
  }).on("error", (error) => client.logger.error(error));
  
  const eventList = [];
  klaw("./events").on("data", (item) => {  
    const eventFile = path.parse(item.path);
    if (!eventFile.ext || eventFile.ext !== ".js") return;
    const eventName = eventFile.name.split(".")[0];
    try {
      const event = new (require(`${eventFile.dir}${path.sep}${eventFile.name}${eventFile.ext}`))(client);    
      eventList.push(event);      
      client.on(eventName, (...args) => event.run(...args));
      delete require.cache[require.resolve(`${eventFile.dir}${path.sep}${eventFile.name}${eventFile.ext}`)];
    } catch (error) {
      client.logger.error(`Error loading event ${eventFile.name}: ${error}`);
    }
  }).on("end", () => {
    client.logger.log(`Loaded a total of ${eventList.length} events.`);
  }).on("error", (error) => client.logger.error(error));

  client.login(process.env.TOKEN)
};

init();

client.on("disconnect", () => client.logger.warn("Bot is disconnecting..."))
  .on("reconnect", () => client.logger.log("Bot reconnecting...", "log"))
  .on("error", e => client.logger.error(e))
  .on("warn", info => client.logger.warn(info));

#3

Your eslint comment clearly tells it to use CRLF, please adjust it and re-run eslint with --fix


#4

How to use “CRLF”?
and should i run --fix in console?


#5

the editor doesn’t support CRLF line breaks, and it will always convert them to unix newlines. To solve the issue, you can change your .eslintrc.json file, removing that rule.


#6

if i remove this rule it still gives an error as top screenshot


#7

The error about the app being Killed? That’s a separate issue, it means that your app is using too much RAM.


#8

So to Fix RAM Usage should i delete some files ?
or is there any other option?
My App Using 65% MEM


#9

That’s disk usage. RAM is used while your application is running, and it means that some part of your code use too much memory… you should look at your code and make sure it doesn’t create too many variables, basically. It might be leaking connections, for example.

The fact that it is showing 65% memory usage means that on average that’s the memory it uses, but then something happens that make it use more memory, so it stops (releasing all the memory). That’s why you don’t see it reaching 100%.