dashboard: minor polishes, exclude misspell linter

This commit is contained in:
Péter Szilágyi 2017-12-21 16:27:56 +02:00
parent 5a6362e2d5
commit 5e647192d7
No known key found for this signature in database
GPG key ID: E9AE538CEDF8293D
9 changed files with 7935 additions and 9524 deletions

1
.gitignore vendored
View file

@ -35,6 +35,7 @@ profile.cov
.idea
# dashboard
/dashboard/assets/flow-typed
/dashboard/assets/node_modules
/dashboard/assets/stats.json
/dashboard/assets/public/bundle.js

View file

@ -9,10 +9,11 @@ The client's UI uses [React][React] with JSX syntax, which is validated by the [
### Development and bundling
As the dashboard depends on certain NPM packages (which are not included in the go-ethereum repo), these need to be installed first:
As the dashboard depends on certain NPM packages (which are not included in the `go-ethereum` repo), these need to be installed first:
```
$ (cd dashboard/assets && npm install)
$ (cd dashboard/assets && ./node_modules/.bin/flow-typed install)
```
Normally the dashboard assets are bundled into Geth via `go-bindata` to avoid external dependencies. Rebuilding Geth after each UI modification however is not feasible from a developer perspective. Instead, we can run `webpack` in watch mode to automatically rebundle the UI, and ask `geth` to use external assets to not rely on compiled resources:
@ -28,18 +29,13 @@ To bundle up the final UI into Geth, run `go generate`:
$ go generate ./dashboard
```
Since JavaScript doesn't provide type safety, [Flow][Flow] is used to introduce and check types. These types are only useful during the development, so at the end of the day Babel will strip them.
To take advantage of types the IDE needs to be prepared for them.
In case of [Atom][Atom] a configuration guide can be found [here][Atom config].
Install the [Nuclide][Nuclide] package for Flow support, make sure it installs all of its support packages by enabling `Install Recommended Packages on Startup`, and set the path of the `flow-bin` which were installed previously by `npm`.
For more IDE support install the `linter-eslint` package too, which finds the `.eslintrc` file, and provides real-time linting.
Atom warns, that these two packages are incompatible, but they seem to work well together.
For third-party library errors and their auto-complete [flow-typed][flow-typed] is used.
### Static type checking
To visualize the hidden elements (e.g. `node_modules`), uncheck the `Exclude VCS Ignored Path` in `Settings > Core`.
To visualize the white spaces, check `Show invisibles` in `Settings > Editor`.
To use Sublime-like minimap, install the `minimap` package.
In case of trouble related to the Atom UI, run `atom --clear-window-state`.
Since JavaScript doesn't provide type safety, [Flow][Flow] is used to check types. These are only useful during development, so at the end of the process Babel will strip them.
To take advantage of static type checking, your IDE needs to be prepared for it. In case of [Atom][Atom] a configuration guide can be found [here][Atom config]: Install the [Nuclide][Nuclide] package for Flow support, making sure it installs all of its support packages by enabling `Install Recommended Packages on Startup`, and set the path of the `flow-bin` which were installed previously by `npm`.
For more IDE support install the `linter-eslint` package too, which finds the `.eslintrc` file, and provides real-time linting. Atom warns, that these two packages are incompatible, but they seem to work well together. For third-party library errors and auto-completion [flow-typed][flow-typed] is used.
### Have fun

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,32 +0,0 @@
// flow-typed signature: e931b17fb0a809fe442a2efc46879228
// flow-typed version: <<STUB>>/path_v^0.12.7/flow_v0.59.0
/**
* This is an autogenerated libdef stub for:
*
* 'path'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'path' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'path/path' {
declare module.exports: any;
}
// Filename aliases
declare module 'path/path.js' {
declare module.exports: $Exports<'path/path'>;
}

View file

@ -1,87 +0,0 @@
// flow-typed signature: 342a3d0c93da454166459879159cf1af
// flow-typed version: <<STUB>>/react-transition-group_v^2.2.1/flow_v0.59.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-transition-group'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'react-transition-group' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'react-transition-group/CSSTransition' {
declare module.exports: any;
}
declare module 'react-transition-group/dist/react-transition-group' {
declare module.exports: any;
}
declare module 'react-transition-group/dist/react-transition-group.min' {
declare module.exports: any;
}
declare module 'react-transition-group/Transition' {
declare module.exports: any;
}
declare module 'react-transition-group/TransitionGroup' {
declare module.exports: any;
}
declare module 'react-transition-group/utils/ChildMapping' {
declare module.exports: any;
}
declare module 'react-transition-group/utils/PropTypes' {
declare module.exports: any;
}
declare module 'react-transition-group/utils/SimpleSet' {
declare module.exports: any;
}
// Filename aliases
declare module 'react-transition-group/CSSTransition.js' {
declare module.exports: $Exports<'react-transition-group/CSSTransition'>;
}
declare module 'react-transition-group/dist/react-transition-group.js' {
declare module.exports: $Exports<'react-transition-group/dist/react-transition-group'>;
}
declare module 'react-transition-group/dist/react-transition-group.min.js' {
declare module.exports: $Exports<'react-transition-group/dist/react-transition-group.min'>;
}
declare module 'react-transition-group/index' {
declare module.exports: $Exports<'react-transition-group'>;
}
declare module 'react-transition-group/index.js' {
declare module.exports: $Exports<'react-transition-group'>;
}
declare module 'react-transition-group/Transition.js' {
declare module.exports: $Exports<'react-transition-group/Transition'>;
}
declare module 'react-transition-group/TransitionGroup.js' {
declare module.exports: $Exports<'react-transition-group/TransitionGroup'>;
}
declare module 'react-transition-group/utils/ChildMapping.js' {
declare module.exports: $Exports<'react-transition-group/utils/ChildMapping'>;
}
declare module 'react-transition-group/utils/PropTypes.js' {
declare module.exports: $Exports<'react-transition-group/utils/PropTypes'>;
}
declare module 'react-transition-group/utils/SimpleSet.js' {
declare module.exports: $Exports<'react-transition-group/utils/SimpleSet'>;
}

File diff suppressed because it is too large Load diff

6806
dashboard/assets/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,8 @@ package dashboard
//go:generate ./assets/node_modules/.bin/webpack --config ./assets/webpack.config.js --context ./assets
//go:generate go-bindata -nometadata -o assets.go -prefix assets -nocompress -pkg dashboard assets/public/...
//go:generate gofmt -s -w .
//go:generate gofmt -s -w assets.go
//go:generate sed -i "s#var _public#//nolint:misspell\\n&#" assets.go
import (
"fmt"