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
FOBABS
@fobabs
I used readLine() to read a number in a JavaScript env it worked but running it in node.js it didn’t run.
Must I use the readline() function for node.js?
Jordan Harband
@ljharb
don’t ever use inline event handlers like that; all JS goes in a separate .js file
tobslob
@tobslob
Hello, can anyone help with this challenge?
Create an application ticTacToeCheck that takes a two dimensional array representing a
finished game of tic-tac-toe (e.g. [["XO-"], ["XXX"], ["XO-"]]).
● X represents player 1 move(s).
● O represents player 2 move(s).
● Dash (-) represents no move(s).
Rules:
  1. Return true if player 1 or player 2 win the game.
    [["XO-"], ["XXO"], ["O-X"]] ➞ true
  2. Return false if nobody won the game.
    [["XXO"], ["OOX"], ["XOO"]] ➞ false
  3. Return "Nobody moved" if nobody made a move.
    [[---], [---], [---]] ➞ "Nobody moved"
  4. Return "No/Incomplete game" if no value was received / all received arrays are void /
    type of any given value is not "array".
    [[], [], []] ➞ "No/Incomplete game"
    [[], []] ➞ "No/Incomplete game"
    [[]], [] ➞ "No/Incomplete game"
    ["XOX", ["XOX"], ["XOO"]] ➞ "No/Incomplete game"
    ["XOX", ["XOX"], []] ➞ "No/Incomplete game"
    undefined ➞ "No/Incomplete game"
  5. Return "Corrupted game" if any values differ from the expected "X", "O", "-".
    [["X"], ["XX"], ["X-"]] ➞ "Corrupted game"
    [["AAA"], ["BBA"], ["ABB"]] ➞ "Corrupted game"
    [["XOX"], ["XOO"], [undefined]] ➞ "Corrupted game"
    [["XXX"], ["XOX"], [""]] ➞ "Corrupted game"
    [["XXX"], ["XOX"], [1,2,3]] ➞ "Corrupted game"
Muhammad
@MuhammadJamaluddin
when I import sub-components into a parent component or any component within a test file to test it, I use the jsxextension in the import statement. That causes eslint to throw this error:
Unexpected use of file extension "jsx" for "./components/Reviews.jsx"eslint(import/extensions)
Why is that?
Jordan Harband
@ljharb
always omit extensions in the path
node looks those up for you.
Muhammad
@MuhammadJamaluddin
node? I'm using import not require
Jordan Harband
@ljharb
you're using babel
which converts it to require.
Muhammad
@MuhammadJamaluddin
I see. didn't know that, so node looks it up to know whether it's a js or a jsx file... right?
Jordan Harband
@ljharb
yes
Muhammad
@MuhammadJamaluddin
Thanks, Jordan ❤
OmarAlmaqtri
@OmarAlmaqtri
Hi
how to print web page with css in js ..
i want print page with Style and table
Muhammad
@MuhammadJamaluddin

I'm trying to map the reviews array, but I get 2 eslint warnings:

render() {
    const reviews = this.state.reviews.map((review, index) => (
      <div key={index} className="review">
      </div>
    ));
}

1- Must use destructuring state assignmenteslint(react/destructuring-assignment)
2- Do not use Array index in keyseslint(react/no-array-index-key

What's the suggested solution to fix these 2 warnings in this situation?

I tried assigning the key to an _id property , but I got this eslint warning:
Unexpected dangling '_' in '_id'.eslint(no-underscore-dangle)
Muhammad
@MuhammadJamaluddin
I fixed the second warning by including this rule: "no-underscore-dangle": ["error", { "allow": ["_id"] }], in my .eslintrc.js file as suggested by Jordan on this thread (airbnb/javascript#1408)
But I still don't know what to do about the first warning...
Muhammad
@MuhammadJamaluddin
Never mind :D... I also fixed the first warning by destructuring first:
render() {
    let { reviews } = this.state;
    reviews = reviews.map((review, index) => (
      <div key={index} className="review">
      </div>
    ));
}
I am not sure though about the reason behind the destructuring rule
Jordan Harband
@ljharb
const { reviews } = this.state, for one
but then also, don't reassign it.
i'm not sure what _id would be for tho
(unless you're using mongo, which you shouldn't be - but that override's the way to do it if so)
Muhammad
@MuhammadJamaluddin
  • If I won't reassign it what should I do?
    I needed the new array returned from map here:
    return (
        <div id="reviews">
          {reviews} <----------
        </div>
      );
  • Yes, i'm using mongoDB (which I shouldn't be?... not sure I get what you mean).
Jordan Harband
@ljharb
you should either make a new variable name, or inline the .map
and i mean you should use a real database, like mysql or similar.
Muhammad
@MuhammadJamaluddin
Gotcha. Thanks for explaining ❤.
Muhammad
@MuhammadJamaluddin
I have a like method in my Reviews component that just uses the event.target object & sends an AJAX request accordingly. I get this eslint error:
Expected 'this' to be used by class method 'like'.eslint(class-methods-use-this)
What's the suggested approach in this case?
jiaweri
@jiaweri
怎么翻墙呢
Muhammad
@MuhammadJamaluddin

Why this is considered an error & how would I add whitespaces in JSX otherwise:

<p>{review.reviewer_name} <time>{review.review_date}</time></p>

the eslint error I mean:
{review.reviewer_name} must be placed on a new lineeslint(react/jsx-one-expression-per-line)

1point7point4
@1point7point4
Consider doing it like so (if this does the same thing, I'm not exactly sure how HTML does its thing with whitespace:
<p>
  {review.reviewer_name}
  <time> {review.review_date}</time>
</p>
Seems to work on chrome
Manuk
@ManukMinasyan

Hello dear developers,
When entering for the first time IE 11 loaded the site correctly you can see it in the first picture.
After refreshing the page we see that the page is not being loaded(see the second picture).
If you can help me, I will be grateful.
Thanks.

Images`

  1. https://imgur.com/C5VRb1B
  2. https://imgur.com/iIeFF2a
aparnatech
@aparnatech
@ManukMinasyan try to empty the event after sending the request
Manuk
@ManukMinasyan
@aparnatech How can I do it?
aparnatech
@aparnatech
@ManukMinasyan event.target.value = ''; set this inside a function atlast where u think the event should be empty so that everytime the event will be empty when u click the function
Manuk
@ManukMinasyan
https://migrolpartnerevent.ch/event2019/ - please take a look to this link, open it with IE 11.
And take a look the console.
Thanks
aparnatech
@aparnatech
@ManukMinasyan i am not getting error in console
Manuk
@ManukMinasyan
I think that I finally could find the solution of the problem.
The problem was connected with version of jquery.
I changed it to latest version.
Thank you guys.
aparnatech
@aparnatech
@ManukMinasyan ok
aparnatech
@aparnatech

@aparnatech
when i trigger the function to convert html to pdf and dowmload it in pdf form the web app restarts everytime ...when i give empty cache and hard reload i can download it without any issue how to correct it
downloadPdf() {

this.Router.navigate(['/test/preview'], { queryParams: { 'test_id': this.test_id, 'branch_id': this.branch_id, 'isprint': true } });

}

Jordan Harband
@ljharb
hi folks - this is not a general JS help channel. It's a channel for the airbnb/javascript repo - which is airbnb's javascript style guide.
Ghost
@ghost~57cbaf6040f3a6eec0634f49
Heya, I am using beforeunload function to get alert when user clicks on refresh button on the browser. But when the user clicks on any link on the page it again display the same alert. Is is possible to show alert on click of refresh button but not on any redirection link?
_
1point7point4
@1point7point4
Hi, folks — this is not a general JS help channel. It's a channel for the airbnb/javascript repo - which is airbnb's javascript style guide.
Muhammad
@MuhammadJamaluddin
I have this code in my component:
<label>
  { 'First Name:' }
  <input name="firstName" type="text" onChange={this.handleChange.bind(this)} />
</label>
I get these errors:
  • A form label must be associated with a control.eslint(jsx-a11y/label-has-associated-control)