Skip to content

Commit

Permalink
Lint markdown with eslint, fix errors, update deps (chartjs#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle authored Apr 14, 2021
1 parent cd5a73f commit 862fec4
Show file tree
Hide file tree
Showing 8 changed files with 387 additions and 261 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
extends:
- chartjs
- plugin:es/no-new-in-es2019
- plugin:markdown/recommended

env:
es6: true
Expand Down
3 changes: 0 additions & 3 deletions .markdownlint.yml

This file was deleted.

4 changes: 2 additions & 2 deletions docs/guide/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const options = {
annotations: {
box1: {
drawTime: 'afterDatasetsDraw',
display: (context, options) => {
display: (context, opts) => {
const body = document.querySelector('body');
const rect = body.getBoundingClientRect();
return rect.width >= 1000;
Expand Down Expand Up @@ -59,7 +59,7 @@ const config = {

module.exports = {
config
}
};
```

## Draw Time
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/types/box.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ const config = {
// <block:utils:3>
function min(ctx, datasetIndex, prop) {
const dataset = ctx.chart.data.datasets[datasetIndex];
return dataset.data.reduce((max, point) => Math.min(point[prop], max), Infinity);
return dataset.data.reduce((v, point) => Math.min(point[prop], v), Infinity);
}

function max(ctx, datasetIndex, prop) {
const dataset = ctx.chart.data.datasets[datasetIndex];
return dataset.data.reduce((max, point) => Math.max(point[prop], max), -Infinity);
return dataset.data.reduce((v, point) => Math.max(point[prop], v), -Infinity);
}

// </block:utils>
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/types/ellipse.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ const config = {
// <block:utils:3>
function min(ctx, datasetIndex, prop) {
const dataset = ctx.chart.data.datasets[datasetIndex];
return dataset.data.reduce((max, point) => Math.min(point[prop], max), Infinity);
return dataset.data.reduce((v, point) => Math.min(point[prop], v), Infinity);
}

function max(ctx, datasetIndex, prop) {
const dataset = ctx.chart.data.datasets[datasetIndex];
return dataset.data.reduce((max, point) => Math.max(point[prop], max), -Infinity);
return dataset.data.reduce((v, point) => Math.max(point[prop], v), -Infinity);
}

// </block:utils>
Expand Down
3 changes: 1 addition & 2 deletions docs/samples/types/point.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ const config = {
// <block:utils:3>
function value(ctx, datasetIndex, index, prop) {
const meta = ctx.chart.getDatasetMeta(datasetIndex);
const value = meta.controller.getParsed(index)[prop];
return value;
return meta.controller.getParsed(index)[prop];
}
// </block:utils>

Expand Down
Loading

0 comments on commit 862fec4

Please sign in to comment.