Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this example appropriate? (19.6) #2403

Closed
kimhanui opened this issue Mar 17, 2021 · 1 comment · Fixed by #2404
Closed

Is this example appropriate? (19.6) #2403

kimhanui opened this issue Mar 17, 2021 · 1 comment · Fixed by #2404

Comments

@kimhanui
Copy link
Contributor

kimhanui commented Mar 17, 2021

First of all, thx for open this convention!

LINK : https://github.com/ParkSB/javascript-style-guide#whitespace--chains
Here is the examples of convention 19.6 and I have no idea of how the final good example is an improvement of bad one.

What does it mean?
Why some chainings were cut off?

// bad
const leds = stage.selectAll('.led').data(data).enter().append('svg:svg').classed('led', true)
    .attr('width', (radius + margin) * 2).append('svg:g')
    .attr('transform', `translate(${radius + margin},${radius + margin})`)
    .call(tron.led);

// good
const leds = stage.selectAll('.led')
    .data(data)
  .enter().append('svg:svg')
    .classed('led', true)
    .attr('width', (radius + margin) * 2)
  .append('svg:g')
    .attr('transform', `translate(${radius + margin},${radius + margin})`)
    .call(tron.led);

// good
const leds = stage.selectAll('.led').data(data); //<- what does it mean?
@ljharb
Copy link
Collaborator

ljharb commented Mar 17, 2021

yes, you're right - it's probably supposed to be:

// good
const leds = stage.selectAll('.led').data(data);
const svg = leds.enter().append('svg:svg');
svg.classed('led', true).attr(width', (radius + margin) * 2);
const g = svg.append('svg:g');
g.attr('transform', `translate(${radius + margin},${radius + margin})`).call(tron.led);

(added in #730)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants