Skip to content

[EXPERIMENTAL] Prettier! #1629

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 1 addition & 4 deletions lib/index-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

var Plotly = require('./core');

Plotly.register([
require('./bar'),
require('./pie')
]);
Plotly.register([require('./bar'), require('./pie')]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is possible to configure prettier to respect vertical formatting?

I see the need to split long lines, but joining short one into a single line doesn't help here.


module.exports = Plotly;
18 changes: 9 additions & 9 deletions lib/index-cartesian.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
var Plotly = require('./core');

Plotly.register([
require('./bar'),
require('./box'),
require('./heatmap'),
require('./histogram'),
require('./histogram2d'),
require('./histogram2dcontour'),
require('./pie'),
require('./contour'),
require('./scatterternary')
require('./bar'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to configure prettier to use a 4-space indent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require('./box'),
require('./heatmap'),
require('./histogram'),
require('./histogram2d'),
require('./histogram2dcontour'),
require('./pie'),
require('./contour'),
require('./scatterternary'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for comma-ending last elements (neater diffs)

]);

module.exports = Plotly;
10 changes: 5 additions & 5 deletions lib/index-finance.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
var Plotly = require('./core');

Plotly.register([
require('./bar'),
require('./histogram'),
require('./pie'),
require('./ohlc'),
require('./candlestick')
require('./bar'),
require('./histogram'),
require('./pie'),
require('./ohlc'),
require('./candlestick'),
]);

module.exports = Plotly;
5 changes: 1 addition & 4 deletions lib/index-geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

var Plotly = require('./core');

Plotly.register([
require('./scattergeo'),
require('./choropleth')
]);
Plotly.register([require('./scattergeo'), require('./choropleth')]);

module.exports = Plotly;
10 changes: 5 additions & 5 deletions lib/index-gl2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
var Plotly = require('./core');

Plotly.register([
require('./scattergl'),
require('./pointcloud'),
require('./heatmapgl'),
require('./contourgl'),
require('./parcoords')
require('./scattergl'),
require('./pointcloud'),
require('./heatmapgl'),
require('./contourgl'),
require('./parcoords'),
]);

module.exports = Plotly;
6 changes: 3 additions & 3 deletions lib/index-gl3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
var Plotly = require('./core');

Plotly.register([
require('./scatter3d'),
require('./surface'),
require('./mesh3d')
require('./scatter3d'),
require('./surface'),
require('./mesh3d'),
]);

module.exports = Plotly;
4 changes: 1 addition & 3 deletions lib/index-mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

var Plotly = require('./core');

Plotly.register([
require('./scattermapbox')
]);
Plotly.register([require('./scattermapbox')]);

module.exports = Plotly;
69 changes: 32 additions & 37 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@ var Plotly = require('./core');

// traces
Plotly.register([
require('./bar'),
require('./box'),
require('./heatmap'),
require('./histogram'),
require('./histogram2d'),
require('./histogram2dcontour'),
require('./pie'),
require('./contour'),
require('./scatterternary'),

require('./scatter3d'),
require('./surface'),
require('./mesh3d'),

require('./scattergeo'),
require('./choropleth'),

require('./scattergl'),
require('./pointcloud'),
require('./heatmapgl'),
require('./parcoords'),

require('./scattermapbox'),

require('./carpet'),
require('./scattercarpet'),
require('./contourcarpet'),

require('./ohlc'),
require('./candlestick')
require('./bar'),
require('./box'),
require('./heatmap'),
require('./histogram'),
require('./histogram2d'),
require('./histogram2dcontour'),
require('./pie'),
require('./contour'),
require('./scatterternary'),

require('./scatter3d'),
require('./surface'),
require('./mesh3d'),

require('./scattergeo'),
require('./choropleth'),

require('./scattergl'),
require('./pointcloud'),
require('./heatmapgl'),
require('./parcoords'),

require('./scattermapbox'),

require('./carpet'),
require('./scattercarpet'),
require('./contourcarpet'),

require('./ohlc'),
require('./candlestick'),
]);

// transforms
Expand All @@ -54,14 +54,9 @@ Plotly.register([
// For more info, see:
// https://github.com/plotly/plotly.js/pull/978#pullrequestreview-2403353
//
Plotly.register([
require('./filter'),
require('./groupby')
]);
Plotly.register([require('./filter'), require('./groupby')]);

// components
Plotly.register([
require('./calendars')
]);
Plotly.register([require('./calendars')]);

module.exports = Plotly;
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
],
"scripts": {
"preprocess": "node tasks/preprocess.js",
"precommit": "lint-staged",
"bundle": "node tasks/bundle.js",
"header": "node tasks/header.js",
"stats": "node tasks/stats.js",
"build": "npm run preprocess && npm run bundle && npm run header && npm run stats",
"cibuild": "npm run preprocess && node tasks/cibundle.js",
"watch": "node tasks/watch.js",
"lint": "eslint --version && eslint .",
Copy link
Contributor

@n-riesco n-riesco Apr 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is prettier able to detect unused variables and variables used out of scope?

If not, I think it's better to keep using eslint for linting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Asking on the gitter channel just in case since I wasn't able to find a better answer, but I think that alone might be enough for me. Seems some people run it through both, but that seems a bit annoying (though not necessarily slow if you prettier + eslint only staged files).

"lint-fix": "eslint . --fix || true",
"lint": "prettier-check --single-quote --trailing-comma es5 \"{src,test,tasks,lib}/**/*.js\"",
"lint-fix": "prettier --single-quote --trailing-comma es5 --write \"{src,test,tasks,lib}/**/*.js\"",
"docker": "node tasks/docker.js",
"pretest": "node tasks/pretest.js",
"test-jasmine": "karma start test/jasmine/karma.conf.js",
Expand Down Expand Up @@ -111,6 +112,7 @@
"glob": "^7.0.0",
"glslify": "^4.0.0",
"gzip-size": "^3.0.0",
"husky": "^0.13.3",
"image-size": "^0.5.1",
"jasmine-core": "^2.4.1",
"karma": "^1.5.0",
Expand All @@ -122,18 +124,27 @@
"karma-jasmine-spec-tags": "^1.0.1",
"karma-spec-reporter": "0.0.30",
"karma-verbose-reporter": "0.0.6",
"lint-staged": "^3.4.0",
"madge": "^1.6.0",
"minimist": "^1.2.0",
"node-sass": "^4.5.0",
"npm-link-check": "^1.2.0",
"open": "0.0.5",
"prepend-file": "^1.3.1",
"prettier": "^1.2.2",
"prettier-check": "^1.0.0",
"prettysize": "0.0.3",
"read-last-lines": "^1.1.0",
"requirejs": "^2.3.1",
"through2": "^2.0.3",
"uglify-js": "^2.8.12",
"watchify": "^3.9.0",
"xml2js": "^0.4.16"
},
"lint-staged": {
"{src,test,tasks,lib}/**/*.js": [
"prettier --single-quote --trailing-comma es5 --write \"{src,test,tasks,lib}/**/*.js\"",
"git add"
]
}
}
1 change: 0 additions & 1 deletion src/assets/geo_assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

var saneTopojson = require('sane-topojson');


// package version injected by `npm run preprocess`
exports.version = '1.26.1';

Expand Down
Loading