Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
fixed linter errors in Carbon graphs package (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
AshishMotanamGurunadham authored Jan 28, 2021
1 parent 6ba5847 commit 2da07fe
Show file tree
Hide file tree
Showing 64 changed files with 448 additions and 422 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/aggregated-translations/*.*
build
coverage
dist
generated-themes
lib
node_modules
57 changes: 34 additions & 23 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
# ---
parser: babel-eslint
# extends: "@cerner/eslint-config-terra"
settings:
polyfills:
extends: "@cerner/eslint-config-terra"
settings:
polyfills:
- Promise
- Map

rules:
react/forbid-prop-types: off
env:
jasmine: true
rules:
react/forbid-prop-types: off

overrides:
- files: "*.js"
rules:
import/no-cycle: off
no-param-reassign: off
template-curly-spacing: off
indent:
- error
- 2
- ignoredNodes:
- TemplateLiteral
strict: off
func-names: off
no-undef: off
no-unused-expressions: off
no-new: off
no-underscore-dangle: off
no-console: off
rules:
import/no-cycle: off
template-curly-spacing: off
indent:
- error
- 2
- ignoredNodes:
- TemplateLiteral
strict: off
func-names: off
no-underscore-dangle: off
no-console: off
import/no-extraneous-dependencies: off
no-param-reassign: off

- files: "**/scripts/**/*.js"
rules:
Expand All @@ -38,6 +37,10 @@
rules:
import/no-extraneous-dependencies: off

- files: "**/*.conf.js"
rules:
import/no-extraneous-dependencies: off

- files: "**/webpack/**/*.js"
rules:
import/no-extraneous-dependencies: off
Expand All @@ -60,9 +63,17 @@
import/no-extraneous-dependencies: off
import/no-unresolved: off
import/extensions: off
prefer-rest-params: off
no-restricted-syntax: off

- files: "*.doc.jsx"
rules:
rules:
import/no-webpack-loader-syntax: off
import/first: off
import/no-duplicates: off

- files: "**/*/terra-dev-site/**/*.jsx"
rules:
"import/no-extraneous-dependencies": off
"import/no-unresolved": off
"import/extensions": off
3 changes: 3 additions & 0 deletions packages/carbon-graphs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* Fixed linter issues.

## 2.16.0 - (December 16, 2020)

* Changed
Expand Down
9 changes: 3 additions & 6 deletions packages/carbon-graphs/dev-site/assets/polyfills.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
'use strict';

/* eslint-disable no-plusplus */
/* eslint-disable prefer-rest-params */
/* eslint-disable no-restricted-syntax */

(function () {
// object conversion errors
const CANNOT_CNVT_TO_OBJ = 'Cannot convert undefined or null to object';

// Shorthand for object.defineProperty
const objectDefineProperty = function (proto, keyValuePairArray) {
for (let i = keyValuePairArray.length; i--;) {
// eslint-disable-next-line no-cond-assign
for (let i = keyValuePairArray.length; i -= 1;) {
const key = keyValuePairArray[i][0];
const val = keyValuePairArray[i][1];
if (!proto[key]) {
Expand Down Expand Up @@ -45,7 +42,7 @@
// create the new object which is to be returned from the target object
const to = checkConvertible(target);
// combine with each additional argument
for (let i = 1; i < arguments.length; i++) {
for (let i = 1; i < arguments.length; i += 1) {
const nextSource = arguments[i];
if (
nextSource !== null
Expand Down
4 changes: 2 additions & 2 deletions packages/carbon-graphs/dev-site/iconography/buildIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ const { parserOptions } = require('./fileSkeleton');

const iconPath = path.join(
__dirname,
'..', '..','node_modules','one-cerner-style-icons','src','icons'
'..', '..', 'node_modules', 'one-cerner-style-icons', 'src', 'icons',
);
const outputPath = path.join(
__dirname,
'../','../','src','main','js','core','Shape',
'../', '../', 'src', 'main', 'js', 'core', 'Shape',
'shapeDefinitions.js',
);
const defaultPositionOptions = {
Expand Down
1 change: 1 addition & 0 deletions packages/carbon-graphs/dev-site/serve/serve-static.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const serve = (options) => {
if (!dirExistsWithContent(site)) {
return console.warn(
`Cannot serves content from ${site} because it does not exist or it is empty.`,
// eslint-disable-next-line no-undef
{ context },
);
}
Expand Down
30 changes: 15 additions & 15 deletions packages/carbon-graphs/dev/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
renderBarPanningWithDynamicEventline,
renderBarGraphAndLegendPaddingReduced,
} from './examples/controls/bar';
import { renderColorsExample } from './examples/controls/colors';
import renderColorsExample from './examples/controls/colors';
import {
renderCombinationBar,
renderCombinationRegion,
Expand Down Expand Up @@ -651,9 +651,9 @@ renderSiteApp(
title: 'Dynamic Data',
},
{
pathname: "/panning/line/dynamic-eventline",
pathname: '/panning/line/dynamic-eventline',
content: renderLinePanningWithDynamicEventline,
title: "Dynamic Eventline"
title: 'Dynamic Eventline',
},
{
pathname: '/panning/line/dynamic-data/updated-legend',
Expand All @@ -676,10 +676,10 @@ renderSiteApp(
title: 'Dynamic Data',
},
{
pathname: "/panning/gantt/dynamic-eventline",
pathname: '/panning/gantt/dynamic-eventline',
content: renderGanttPanningWithDynamicEventline,
title: "Dynamic Eventline"
}
title: 'Dynamic Eventline',
},
],
},
{
Expand Down Expand Up @@ -711,10 +711,10 @@ renderSiteApp(
title: 'Dynamic Data',
},
{
pathname: "/panning/bar/dynamic-eventline",
pathname: '/panning/bar/dynamic-eventline',
content: renderBarPanningWithDynamicEventline,
title: "Dynamic Eventline"
}
title: 'Dynamic Eventline',
},
],
},
{
Expand All @@ -736,10 +736,10 @@ renderSiteApp(
title: 'Dynamic Data',
},
{
pathname: "/panning/paired-result/dynamic-eventline",
pathname: '/panning/paired-result/dynamic-eventline',
content: renderPairedResultPanningWithDynamicEventline,
title: "Dynamic Eventline"
}
title: 'Dynamic Eventline',
},
],
},
{
Expand All @@ -761,10 +761,10 @@ renderSiteApp(
title: 'Dynamic Data',
},
{
pathname: "/panning/scatter/dynamic-eventline",
pathname: '/panning/scatter/dynamic-eventline',
content: renderScatterPanningWithDynamicEventline,
title: "Dynamic Eventline"
}
title: 'Dynamic Eventline',
},
],
},
{
Expand Down
35 changes: 18 additions & 17 deletions packages/carbon-graphs/dev/examples/controls/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint prefer-destructuring: ["error", {VariableDeclarator: {object: true}}] */
import Carbon from '../../../src/js/carbon';
import utils from '../../../src/js/helpers/utils';
import { getDemoData } from '../data';
import getDemoData from '../data';
import { loadDatelinePopup, loadTextLabelPopup, loadBarPopup } from '../popup';
import { createPanningControls } from '../panHelpers';

Expand Down Expand Up @@ -552,18 +552,18 @@ export const renderBarPanningWithDynamicData = (id) => {
return graph;
};
export const renderBarPanningWithDynamicEventline = (id) => {
const axisData = utils.deepClone(getDemoData(`#${id}`, "BAR_TIMESERIES"));
const axisData = utils.deepClone(getDemoData(`#${id}`, 'BAR_TIMESERIES'));
axisData.pan = {
enabled: true
enabled: true,
};
axisData.eventline = [
{
color: Carbon.helpers.COLORS.GREY,
style: {
strokeDashArray: "4,4"
strokeDashArray: '4,4',
},
value: new Date(2016, 0, 1, 4, 30).toISOString()
}
value: new Date(2016, 0, 1, 4, 30).toISOString(),
},
];
axisData.axis.x.lowerLimit = new Date(2016, 0, 1, 0).toISOString();
axisData.axis.x.upperLimit = new Date(2016, 0, 2, 0).toISOString();
Expand All @@ -573,30 +573,31 @@ export const renderBarPanningWithDynamicEventline = (id) => {
new Date(2016, 0, 1, 6).toISOString(),
new Date(2016, 0, 1, 9).toISOString(),
new Date(2016, 0, 1, 12).toISOString(),
new Date(2016, 0, 1, 15).toISOString()
new Date(2016, 0, 1, 15).toISOString(),
],
format: "%H"
format: '%H',
};

const graph = Carbon.api.graph(axisData);
graph.loadContent(Carbon.api.bar(graphData[0]));
axisData.axis = graph.config.axis;

const createGraph = () => {
graphData[1].eventline = [
{
color: Carbon.helpers.COLORS.BLACK,
style: {
strokeDashArray: "2,2"
strokeDashArray: '2,2',
},
value: new Date(2016, 0, 1, 7, 30).toISOString()
}
]
value: new Date(2016, 0, 1, 7, 30).toISOString(),
},
];
graph.reflow(graphData[1]);
};

const graph = Carbon.api.graph(axisData);
graph.loadContent(Carbon.api.bar(graphData[0]));
axisData.axis = graph.config.axis;

createPanningControls(id, {
axisData,
creationHandler: createGraph
creationHandler: createGraph,
});
return graph;
};
Expand Down
4 changes: 3 additions & 1 deletion packages/carbon-graphs/dev/examples/controls/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Carbon from '../../../src/js/carbon';

import { vector } from '../helpers';

export const renderColorsExample = (id) => {
const renderColorsExample = (id) => {
const sect = document.createElement('section');
sect.setAttribute('class', 'shape-container');
const svgElement = vector.render(sect, id, '0 0 1080 150');
Expand All @@ -20,3 +20,5 @@ export const renderColorsExample = (id) => {
.attr('cy', () => 75)
.attr('style', (d) => `fill: ${Carbon.helpers.COLORS[d]};`);
};

export default renderColorsExample;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Carbon from '../../../src/js/carbon';
import utils from '../../../src/js/helpers/utils';

import { getDemoData } from '../data';
import getDemoData from '../data';

export const renderCombinationSimple = (id) => {
const combGraph = Carbon.api.graph(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Carbon from '../../../src/js/carbon';
import utils from '../../../src/js/helpers/utils';

import { getDemoData } from '../data';
import getDemoData from '../data';
import { multiRegion, multiRegionAlt } from './pairedResult';

export const renderCriticalityLineSimple = (id) => {
Expand Down
Loading

0 comments on commit 2da07fe

Please sign in to comment.