Skip to content

Commit

Permalink
chore: re-enable no-unused-vars ESLint rule and address related issues
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Sep 18, 2024
1 parent 8420e66 commit 6db9c9d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/visualizations/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"rules": {
"max-params": "off",
// TODO: switch back on before merging
"no-unused-vars": "off"
"max-params": "off"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DynamicStyles } from './styles.js'

export function renderSingleValueSVG() {
const color = this.title.styles.color
const { dashboard, formattedValue, icon, subText } =
const { /* dashboard, */ formattedValue, icon, subText } =
this.userOptions.customSVGOptions
const dynamicStyles = new DynamicStyles()
const valueElement = this.renderer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { VIS_TYPE_SINGLE_VALUE } from '../../../../../../modules/visTypes.js'
import getSingleValueTitle from '../singleValue.js'
import { getSingleValueTitleText } from '../singleValue.js'

jest.mock('../../../../../util/getFilterText', () => () => 'The filter text')

describe('getSingleValueTitle', () => {
it('returns empty title when flag hideTitle exists', () => {
expect(getSingleValueTitle({ hideTitle: true })).toEqual('')
expect(getSingleValueTitleText({ hideTitle: true })).toEqual('')
})

it('returns the title provided in the layout', () => {
const title = 'The title was already set'
expect(getSingleValueTitle({ title })).toEqual(title)
expect(getSingleValueTitleText({ title })).toEqual(title)
})

it('returns null when layout does not have columns', () => {
expect(getSingleValueTitle({})).toEqual('')
expect(getSingleValueTitleText({})).toEqual('')
})

it('returns the filter text based on column items', () => {
expect(
getSingleValueTitle({
getSingleValueTitleText({
columns: [
{
items: [{}],
Expand All @@ -32,7 +31,7 @@ describe('getSingleValueTitle', () => {
describe('not dashboard', () => {
it('returns filter text as title', () => {
expect(
getSingleValueTitle(
getSingleValueTitleText(
{
columns: [
{
Expand All @@ -50,7 +49,9 @@ describe('getSingleValueTitle', () => {

describe('dashboard', () => {
it('returns empty string', () => {
expect(getSingleValueTitle({ filters: {} }, {}, true)).toEqual('')
expect(getSingleValueTitleText({ filters: {} }, {}, true)).toEqual(
''
)
})
})
})
1 change: 0 additions & 1 deletion src/visualizations/config/generators/highcharts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import HNDTD from 'highcharts/modules/no-data-to-display'
import HOE from 'highcharts/modules/offline-exporting'
import HPF from 'highcharts/modules/pattern-fill'
import HSG from 'highcharts/modules/solid-gauge'
import renderSingleValueSvg from './renderSingleValueSvg/index.js'

// apply
HM(H)
Expand Down

0 comments on commit 6db9c9d

Please sign in to comment.