ljharb on master
[eslint config] [base] [patch] … [eslint config] [patch] extend … Merge pull request #1996 from r… (compare)
ljharb on master
[editorial] [react] fix typo [eslint config] [*] [deps] upda… (compare)
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
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;
const titles = data.map(x => x.title); const descriptions = data.map(x => x.description)
, etc
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!
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
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('')
})();
opentok.createSession(function (err, session) {
if (err) return console.log(err);
const token = session.generateToken({
role: 'moderator',
expireTime: (new Date().getTime() / 1000) + (1 * 24 * 60 * 60), // in one day
data: 'name=ajay',
initialLayoutClassList: ['focus']
});
return { sessionId: session.sessionId,token:token}
});
can any one tell me how to get these value in a variable ?
Can anyone please explain this part of the airbnb style guide to me?
https://github.com/airbnb/javascript#arrays--mapping
It says:
4.6 Use Array.from instead of spread ... for mapping over iterables, because it avoids creating an intermediate array.
// bad
const baz = [...foo].map(bar);
// good
const baz = Array.from(foo, bar);
But I don't understand why you wouldn't instead do:
const baz = foo.map(bar);
foo.map(bar)
is fine. If it's a non-array iterable
, then use Array.from
to prevent converting to an array just to use map
11.2 Don’t use generators for now.
Why? They don’t transpile well to ES5.