Skip to content

Commit

Permalink
build: add prefer-template eslint rule (opensearch-project#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
markov00 authored Mar 9, 2020
1 parent 72f9fcd commit 6efc70b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/osd-charts/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module.exports = {
'@typescript-eslint/no-inferrable-types': 'off',
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
'react/prop-types': 0,
'prefer-template': 'error',
'file-header/file-header': [
'error',
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export function addOpacity(hexColorString: string, opacity: Ratio) {
? hexColorString
: hexColorString.slice(0, 7) +
(hexColorString.slice(7).length === 0 || parseInt(hexColorString.slice(7, 2), 16) === 255
? ('00' + Math.round(opacity * 255).toString(16)).substr(-2) // color was of full opacity
: ('00' + Math.round((parseInt(hexColorString.slice(7, 2), 16) / 255) * opacity * 255).toString(16)).substr(
? `00${Math.round(opacity * 255).toString(16)}`.substr(-2) // color was of full opacity
: `00${Math.round((parseInt(hexColorString.slice(7, 2), 16) / 255) * opacity * 255).toString(16)}`.substr(
-2,
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function angleToCircline(

// todo pick a better unique key for the slices (D3 doesn't keep track of an index)
export function nodeId(node: ShapeTreeNode): string {
return node.x0 + '|' + node.y0;
return `${node.x0}|${node.y0}`;
}

export function rectangleConstruction(node: ShapeTreeNode) {
Expand Down

0 comments on commit 6efc70b

Please sign in to comment.