Code is not formated nicely on github page

For example, I have the following code

https://github.com/kenpeter/mb/blob/master/lib/Processor.js

I used 2 spaces in vim and it is working nicely in vim. When the code is on github, it is not formatedly. Anyone know how to resolve it? The code looks like this in github page.

'use strict';

const Employee = require('./Employee');
const Util = require('./Util');

let util = new Util();
let Processor = function() {};

Processor.prototype.process = async function(taxObj, csvArr, fileName='../data/output.csv') {
    DEBUG && console.log('process');

    let item;
    let currTaxObj;
    let rightTaxSlot;
    let edge;
    let base;
    let taxRate;
    let buf = [];
    let employee;

    csvArr.map((item) => {
        employee = new Employee();

        // fill employee model
    employee.firstName = item.firstName;
    employee.lastName = item.lastName;
    employee.annualSalary = item.annualSalary;
    employee.superRate = util.percentToNum(item.superRate);
    employee.timePeriod = item.timePeriod;
    employee.startPeriod = util.parseTimePeriod(item.timePeriod)[0] + ' ' + TIME_PERIOD_YEAR;
    employee.endPeriod = util.parseTimePeriod(item.timePeriod)[1] + ' ' + TIME_PERIOD_YEAR;

        // get right tax slot
    currTaxObj = util.getTaxData(taxObj, employee.startPeriod, employee.endPeriod);
    rightTaxSlot = util.getRightTaxSlot(currTaxObj, employee.annualSalary);

    employee.grossIncome = util.buildGrossIncome(employee.annualSalary);
    employee.fullName = employee.buildFullName();

    // build income tax
    base = rightTaxSlot['base'];
    edge = rightTaxSlot['edge'];
    taxRate = rightTaxSlot['rate'];

    employee.incomeTax = util.buildIncomeTax(employee.annualSalary, base, edge, taxRate);
    employee.netIncome = util.buildNetIncome(employee.grossIncome, employee.incomeTax);
    employee.mySuper = util.buildMySuper(employee.grossIncome, employee.superRate);

    buf.push(employee);
    });

    return await util.print(buf, fileName);
}

module.exports = Processor;

Hi @kenpeter,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our community organized so users can more easily find information.

As you’ll notice, your topic is now here in the How to use Git and GitHub board. No action is needed on your part; you can continue the conversation as normal here.

To address your original post, I *think* you’re talking about line 31, is that correct? If so, I think I can explain what’s happening.

Line 31 is two tab characters, which vim is rendering as four spaces (two for each tab character). However, GitHub renders tab characters as eight spaces (there’s no way to customize/change that). If you change the leading whitespace to four literal space characters (which is what you have on the lines above and below) then things will line up properly.

I have also seen some people use browser extensions to make it easier to see tabs versus spaces. I do have to mention that the linked extension is not a GitHub owned tool, and please use these types of things at your own discretion/risk.

If this does not quite address what you are trying to get help with, please do elaborate on your original post. Perhaps other community users who are vim experts can jump in and help.

Cheers!