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 08:18
    FieryCod commented #1379
  • Jan 30 10:01
    atif089 commented #1379
  • Jan 30 10:01
    atif089 commented #1379
  • Jan 30 10:01
    atif089 commented #1379
  • Jan 30 04:11
    tclindner opened #1998
  • Jan 28 05:21

    ljharb on master

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

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

    ljharb on master

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

  • Jan 27 21:39
    ljharb synchronize #1997
  • Jan 27 21:39
    ljharb labeled #1997
  • Jan 27 21:39
    ljharb labeled #1997
  • Jan 26 18:14
    ljharb labeled #1996
  • Jan 26 18:14
    ljharb labeled #1996
  • Jan 26 18:13
    ljharb synchronize #1996
  • Jan 26 18:05
    ljharb commented #1996
  • Jan 26 08:55
    telmen opened #1997
  • Jan 24 19:37
    peteclark3 commented #1689
  • Jan 24 17:25
    ljharb commented #747
Eric Bruno
@enz54
no worries @maximilianotulian
liyunhua520
@jzylyh
hi
liyunhua520
@jzylyh
...
Muhammad
@MuhammadJamaluddin
What's the convention regarding PropTypes for a required array of objects where the objects are not of a consistent structure?
Muhammad
@MuhammadJamaluddin
Also, regarding the (react/no-array-index-key) rule, what should I do if my objects don't have an id or any unique field for that matter?
Jordan Harband
@ljharb
when would an array not have a consistent structure across its items?
as for the key rule, certainly when there’s nothing unique about each item, you have to override that rule and just use the index, but also when would you have nothing unique about the items?
Muhammad
@MuhammadJamaluddin

Now that you asked, I think that yes the objects are consistent, but one situation where you could have inconsistent structure is if you're using MongoDB, so the objects could have different properties.

This is an excerpt of the array. Not sure if any of theses properties would considered to be unique.

{"events": [
  {"date": "-300", "description": "Pilgrims travel to the healing temples of Asclepieion to be cured of their ills. After a ritual purification the followers bring offerings or sacrifices.", "lang": "en", "category1": "By place", "category2": "Greece", "granularity": "year"}, 
  {"date": "-300", "description": "Pyrrhus, the King of Epirus, is taken as a hostage to Egypt after the Battle of Ipsus and makes a diplomatic marriage with the princess Antigone, daughter of Ptolemy and Berenice.", "lang": "en", "category1": "By place", "category2": "Egypt", "granularity": "year"}, ]}
Muhammad
@MuhammadJamaluddin
I get these two elsint errors when I try to attach an event handler on the tbody element:
Visible, non-interactive elements with click handlers must have at least one keyboard listener.eslint(jsx-a11y/click-events-have-key-events)

Non-interactive elements should not be assigned mouse or keyboard event listeners.eslint(jsx-a11y/no-noninteractive-element-interactions)
<tbody onClick={score}>
      <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
      </tr>
// ... other rows
I'm simply trying to build a telephone keypad-style UI that enables the user to choose a score
What is the recommended solution here?
BTW, that my score function:
const score = (event) => {
  console.log(event.target.innerHTML);
};
& it works as expected (it grabs the score of whatever clicked cell/td)...
Jordan Harband
@ljharb
either override the rule or put the onClick on each td
react is using delegation internally so you don’t have to worry about it.
Muhammad
@MuhammadJamaluddin
Yeah, I think overriding the rule would be easier in this case. Thanks @ljharb
Muhammad
@MuhammadJamaluddin
Has the eslint-plugin-react-hooks been incorporated into Airbnb's eslint configuration yet?
Jordan Harband
@ljharb
no
Chris Cullen
@123xylem
    for( var i = 0; i < arr.length; i++){
       var next = arr[(i+1)%len];

         diff = (values[arr[i]] - next );
          console.log(next);
          date += values[arr[i]];
        }
Why is next here going back to the start of the array once its finished?
how can I make it end at the end
RAHUL KOUNDAL
@rahulkoundal
hello everyone
i have to read the name of the sheet of the excel file
how i can do ?
1point7point4
@1point7point4
@rahulkoundal use haskell instead
Jordan Harband
@ljharb
@123xylem don’t use loops. use reduce for that.
@rahulkoundal this isn’t a generic javascript her channel, it’s for Airbnb’s javascript style guide
ajay yadav
@ajay7868
here i want to show to my file in pdf or doc formate so here is pdf is working fine but in Doc it direct goto downloaded
<Iframe src={this.state.file} width="450px" height="600px" />
can any one help me ,
Javier Pons
@JavierPons
hi folks,
I want to upload using react and node, express a js file to mongodb. Any link or best and simple tech to do it?
any npm library?
Jordan Harband
@ljharb
this isn't a general help channel; it's for airbnb's JS styleguide.
Javier Pons
@JavierPons
ups! thnx
Sangeeth Sudheer
@sangeeth96
Hey guys! Was curious about how you adopt this in various JS projects inside Airbnb (or if someone is using it in their company). Do you duplicate these in your respective projects or try to include them via npm? What about JS in different contexts (eg. front-end vs back-end vs electron vs ...)? Also, what about stuff like .editorconfig and .prettierrc?
Jordan Harband
@ljharb
prettier, if you use it, should only be configured and used via eslint
editorconfig you can set it you want but few things use it
everything should only be included via npm
Subho Karmakar
@isubhokarma
Someone please help me with the eslint-prettier setup for React App.
Sayed Sadat
@Skhoshhal
Hello guys! is there any one to help me ?
Daniel Johns
@ClearedFram3
Anyone know how to export a wrapper express-jwt such as
exports.protect = (req, res, next) => {
  expressJwt({ secret: process.env.JWT_SECRET })
  if (!req.user) return res.status(401).json("Unauthorized")
  return next()
}
If I stick expressJwt(...) directly in as a route middleware it works. But I was trying to add my own error message
Should I just exports.protect = expressJwt({ secret: process.env.JWT_SECRET })?
One problem is that sends a stack trace to the user
Sandeep singh
@13banda
Hnn#%%, nun. AA
Nxdx
maoshuaihui
@maoshuaihui
hello
Good afternoon
sombath16496
@sombath16496
Hello, everyone. I have got the error that "ERROR in [at-loader] ./src/app/auth/login/login.component.ts:82:22
TS2339: Property 'toastr' does not exist on type 'LoginComponent'.", when I build the angular app using ng build --prod with webpack.
please help me.
my webpack.config.js file is: