codesuki / react-d3-components

D3 Components for React
http://codesuki.github.io/react-d3-components/example.html
MIT License
1.63k stars 206 forks source link

Update codestyle and building #106

Closed solomein closed 7 years ago

solomein commented 7 years ago

Building

I have updated the dev dependencies to the newest versions. In consequence I also had to update the configs. I added a eslint to resolve a possible conflict with the global version of package.

Added lint command.

Coding style

I would like to propose some changes.

I have updated the eslint configuration, added more rules. All files have been fixed in accordance with the rules (indents, spacing, declarations, etc., have been normalized).

Other changes:

codesuki commented 7 years ago

Great! A long overdue refresh :) Thank you!

One question: What exactly do you mean by Getting rid of the list destructuring asa regular way of declaration?

I thought you were talking about this:

const {
            data,
            area,
            colorScale,
            values,
            label,
            onMouseEnter,
            onMouseLeave
        } = this.props;

But since it's still there I am mistaken.

codesuki commented 7 years ago

What tool do you use to format the source? My emacs setup ignores the .eslint file it seems. So I have to figure something out. Probably eslint --fix?

solomein commented 7 years ago

@codesuki Mostly, I use Atom and WebStorm. The --fix option automatically fixes not all problems.

List destructuring

let [data,
     innerWidth,
     innerHeight,
     xScale,
     yScale,
     xIntercept,
     yIntercept] = [this._data,
                    this._innerWidth,
                    this._innerHeight,
                    this._xScale,
                    this._yScale,
                    this._xIntercept,
                    this._yIntercept];
codesuki commented 7 years ago

Oh this one! True, haha. Totally missed it. Sorry.

codesuki commented 7 years ago

I had to make a small change, replacing babel with babel-cli in package.json. Already pushed it.