by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 08:18
    FieryCod commented #1379
  • Jan 30 2019 10:01
    atif089 commented #1379
  • Jan 30 2019 10:01
    atif089 commented #1379
  • Jan 30 2019 10:01
    atif089 commented #1379
  • Jan 30 2019 04:11
    tclindner opened #1998
  • Jan 28 2019 05:21

    ljharb on master

    [eslint config] [base] [patch] … [eslint config] [patch] extend … Merge pull request #1996 from r… (compare)

  • Jan 28 2019 05:21
    ljharb closed #1996
  • Jan 28 2019 04:50
    ljharb synchronize #1996
  • Jan 27 2019 21:45
    ljharb closed #1997
  • Jan 27 2019 21:45

    ljharb on master

    [editorial] [react] fix typo [eslint config] [*] [deps] upda… (compare)

  • Jan 27 2019 21:39
    ljharb synchronize #1997
  • Jan 27 2019 21:39
    ljharb labeled #1997
  • Jan 27 2019 21:39
    ljharb labeled #1997
  • Jan 26 2019 18:14
    ljharb labeled #1996
  • Jan 26 2019 18:14
    ljharb labeled #1996
  • Jan 26 2019 18:13
    ljharb synchronize #1996
  • Jan 26 2019 18:05
    ljharb commented #1996
  • Jan 26 2019 08:55
    telmen opened #1997
  • Jan 24 2019 19:37
    peteclark3 commented #1689
  • Jan 24 2019 17:25
    ljharb commented #747
Mile Mijatović
@mijatovicmile
What's that
Jordan Harband
@ljharb
what, irc?
it's the thing that predates slack/gitter/discord/etc by decades
Mile Mijatović
@mijatovicmile
freenode IRC
Jordan Harband
@ljharb
freenode is a specific IRC network
i'm sure you can google some tutorials
Jordan Harband
@ljharb
anyone who has eslint v7 questions, please see airbnb/javascript#2223
Scott Ball
@scotttball
@ljharb you should just have a bot post "This isn't a help channel, it's a channel for airbnb's javascript styleguide." lol
Jordan Harband
@ljharb
it's already the welcome message, people just don't read
Mayur K
@Tensai66
so i'm looking at the style guide, if i had like a ternary statement such as :
node !== undefined ? 0 : node.item
is this not good? because the reader of the code might not understand what the 0 stands for, should I be declaring this as a const variable somewhere, it just seems weird. i'm lookin at 13.4 where it says to assign variables where you need them. i don't exactly need it but i think it'd make it more readable right?
Jordan Harband
@ljharb
yes, that seems like 0 should be a constant
Mayur K
@Tensai66
ok sounds good thanks, do you think it's clearer to group all constants associated with something into an object that can be accessed instead? i couldn't find anything about that in style guide, but not sure if that's really a style guide question either
Jordan Harband
@ljharb
sure, that's fine
Mayur K
@Tensai66
awesome thanks, also i'm looking at the functions 7.1, but the examples throughout the doc use regular function declarations? i'm a little confused am i interpreting this incorrectly
vinayaktitti2015
@vinayaktitti2015

Hi all, how to check price2 > price1 using for loop? I have used array.push to store values but array values showing undefined.

expected
price 2 > price 1
price 3 > price 2
price 4 > price 3

 cy.get(orderCard).find('.kbbrUi').then(listing => {
            const listcount = Cypress.$(listing).length;
            console.log('count', listcount);
            var price_array = [];
            for (var i = 1; i < listcount; i++) {
                cy.get(orderValue).eq(i).invoke('text').then((label2) => {
                    const price = label2.replace(/[$]+/g, '');
                    //const price_2_int = parseInt(price_2);
                    console.log('price_2_int', price);
                    price_array.push(price);

                })
            }

          for (var j = 0; j <= price_array.length; j++) {
                        for (var k = 1; k < j; k++) {
                            expect(price_array[k]).to.be.greaterThan(price_array[j])
                        }
                    }
        })
Jordan Harband
@ljharb
don't use loops
in this case, you want to .map over the list, and get an array of promises, and Promise.all it
vinayaktitti2015
@vinayaktitti2015
can plz share sample snippet
Jordan Harband
@ljharb
so, somehow get Cypress.$(listing) into a real array, and then:
vinayaktitti2015
@vinayaktitti2015
ok will try that, thanks
Jordan Harband
@ljharb
const promises = arr.map(async (item) => { const label2 = await item.invoke('text'); const price = blah; return price; }); Promise.all(promises).then((prices) => { blah });
something like that
replace the "blah" with your own stuff
vinayaktitti2015
@vinayaktitti2015
got it now 👍
vinayaktitti2015
@vinayaktitti2015

Hi guys, how to check Date.parse(d2) > Date.parse(d1)? I am getting data as below, could anyone plz help

data input:
Mon Jun 01 10:00 AM
Tue Jun 01 10:00 PM
Thr Jun 03 9:00 AM
Sat Jun 05 11:00 AM

expected:

Tue Jun 01 10:00 PM > Mon Jun 01 10:00 AM

Thr Jun 03 9:00 AM > Tue Jun 01 10:00 PM

rio5404
@rio5404
hi guys, can someone show me how to clone other developers repository to my local computer?
Philihp Busby
@philihp
@rio5404 have you tried using this? https://tinyurl.com/git-tutorial
davidmungai
@davidmungai
@all So I am using typescript and want to map the raw pg result to interfaces I have .. how do I go about it
Jordan Harband
@ljharb
@davidmungai this isn't a general help channel, it's for airbnb's javascript styleguide.
ajay yadav
@ajay7868
let obj =[ {
"ACC_Kategorie": "Not LTE"
"Dim_Beauftragungsform": "missing"
"GU7/GU8": "GU7"
"GU_Projekt": "ZTE"
"Gebäudeart": "Bürohaus"
"Ist_month": 1
}]
any one help
now i want to update value of ACC_Kategorie key hw to do ,all key are dynamic
sgda021992
@sgda021992
Hi all
can anyone know regex to check number is greater than 6
Jordan Harband
@ljharb
hi, please don’t cross-post. and this isn’t a place for general JS help, it’s for airbnb’s JS styleguide
cddsgtc
@cddsgtc
anyone?
hello
Jordan Harband
@ljharb
yes?
Klaus Bayrhammer
@klausbayrhammer
Good Morning everybody. I have a question around the adoption of new rules. How do you evaluate whether or not to add a specific rule to the JS-styleguide? How do you know whether a rule is a good fit for the guide? I tried to find it in the docs, but I couldn't find anything about it. Thanks a lot!
Jordan Harband
@ljharb
mainly i just see if it matches the style airbnb uses
mridul037
@mridul037
better way to write above code

const da = await(
await fetch("http://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=")
).json();
// console.log(da);
const val1=da.articles[0].title;
const val2=da.articles[1].title;
const val3=da.articles[2].title;
const val4=da.articles[3].title;
const val5=da.articles[4].title;

const des1=da.articles[0].description;
const des2=da.articles[1].description;
const des3=da.articles[2].description;
const des4=da.articles[3].description;
const des5=da.articles[4].description;

Jordan Harband
@ljharb
@mridul037 const data = await fetch(…).then(x => x.json()); for one
Jordan Harband
@ljharb
and then const [val1, val2, val3, val4, val5] = data;, but only if there's always precisely 5 items in there (which would be weird).
3 replies
otherwise, const titles = data.map(x => x.title); const descriptions = data.map(x => x.description), etc
Moises Nunez
@moinunez
Hello, I'm currently trying to set up eslint-config-airbnb with babel-preset-airbnb on a create-react-app but I keep getting this following error: Parsing error: Unexpected token =eslint. I've set up my .babelrc file to have "presets": ["airbnb"] and most of the answers I found kept suggesting to add "parser": "babel-eslint" to my .eslintrc.json file. The thing is I'm not using babel-eslint. What would be the equivalent solution for the airbnb babel preset? Thanks!
Moises Nunez
@moinunez
I tried downgrading eslint to V5 as per your suggestion @ljharb on :point_up: September 28, 2019 4:24 PM but I'm still having issues.
Jordan Harband
@ljharb
that was a year ago; get on eslint 7
Moises Nunez
@moinunez

For some odd reason, create-react-app gives me the following error with eslint 7 😕

The react-scripts package provided by Create React App requires a dependency:

  "eslint": "^6.6.0"

and asks me to

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your
    project folder.
  2. Delete node_modules in your project folder.
  3. Remove "eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.
Jordan Harband
@ljharb
that means CRA is incompatible with eslint 7, only with eslint 6.
mridul037
@mridul037

const getR = async()=>(
await fetch("http://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=077fe507985744818b3f405349c79601")
).json();

(async ()=>{
const articles=(await getR()).articles;
articles.map(({title,description},index)=>{
(
value+index = title
description+index = description
)
}).join('')
})();

how to write value+ index