Skip to content

Commit 78bdc6a

Browse files
author
Luke Bowerman
authored
Upgrade @looker/eslint-config dependency (#659)
Deal with related lint tweaks and fixes Add `tsconfig.json` for eslint in www package (Gatsby's ESLint)
1 parent da44092 commit 78bdc6a

File tree

17 files changed

+180
-65
lines changed

17 files changed

+180
-65
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"@babel/preset-react": "7.8.3",
5252
"@babel/preset-typescript": "^7.8.3",
5353
"@babel/runtime": "^7.8.7",
54-
"@looker/eslint-config": "^1.0.7",
54+
"@looker/eslint-config": "^1.0.11",
5555
"@looker/prettier-config": "^1.0.6",
5656
"@testing-library/jest-dom": "^5.1.1",
5757
"@testing-library/react": "^9.5.0",

packages/components/src/Button/ButtonSet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const ButtonSet = forwardRef(
109109
? {
110110
selected: isToggle
111111
? value === childValue
112-
: value.indexOf(childValue) > -1,
112+
: value.includes(childValue),
113113
}
114114
: { selected: childProps.selected }),
115115
...(disabled ? { disabled } : {}),

packages/components/src/Calendar/CalendarNav.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ import { CalendarNav } from './CalendarNav'
3535
const realDateNow = Date.now.bind(global.Date)
3636

3737
beforeEach(() => {
38+
/* eslint-disable-next-line @typescript-eslint/unbound-method */
3839
global.Date.now = jest.fn(() => 1580517818172)
3940
})
4041

4142
afterEach(() => {
43+
/* eslint-disable-next-line @typescript-eslint/unbound-method */
4244
global.Date.now = realDateNow // reset Date.now mock
4345
jest.clearAllMocks()
4446
})

packages/components/src/Form/Fields/FieldColor/utils/color_format_utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export const toFormattedColorString = (
179179
): string => {
180180
const color = d3color.color(value)
181181
if (!color) return ''
182+
/* eslint-disable-next-line @typescript-eslint/unbound-method */
182183
if (!color.displayable) return ''
183184

184185
if (format === null) format = recognize(value)

packages/components/src/Form/Inputs/Combobox/ComboboxMultiInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export const ComboboxMultiInputInternal = forwardRef(
9090
function handleChange(values: string[]) {
9191
transition &&
9292
transition(ComboboxActionType.CHANGE_VALUES, { inputValues: values })
93-
const newOptions = options.filter(
94-
option => values.indexOf(getComboboxText(option)) > -1
93+
const newOptions = options.filter(option =>
94+
values.includes(getComboboxText(option))
9595
)
9696
contextOnChange && contextOnChange(newOptions)
9797
}

packages/components/src/Form/Inputs/Combobox/ComboboxOption.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export function ComboboxOptionTextInternal({
231231
inputValue === '' ||
232232
// inputValue is reflecting a currently selected option
233233
// highlighting it would be weird
234-
(text === inputValue && optionTexts.indexOf(text) > -1)
234+
(text === inputValue && optionTexts.includes(text))
235235
) {
236236
return <span {...props}>{text}</span>
237237
}

packages/components/src/Form/Inputs/Combobox/utils/state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ const reducerMulti: Reducer<
294294
options: nextState.options.filter(
295295
option =>
296296
action.inputValues &&
297-
action.inputValues.indexOf(getComboboxText(option)) > -1
297+
action.inputValues.includes(getComboboxText(option))
298298
),
299299
}
300300
case ComboboxActionType.NAVIGATE:

packages/components/src/Form/Inputs/InputChips/InputChips.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const InputChipsInternal = forwardRef(
104104
validValues,
105105
} = getUpdatedValues(
106106
// TypeScript can't tell that inputValue won't be undefined
107-
newInputValue || (inputValue as string),
107+
newInputValue || inputValue,
108108
values,
109109
validate
110110
)
@@ -149,7 +149,7 @@ export const InputChipsInternal = forwardRef(
149149
// If the last character is a comma, update the values
150150
// Or, if the user pastes content, we assume that the final value is complete
151151
// even if there's no comma at the end
152-
if (isPasting.current || value[value.length - 1] === ',') {
152+
if (isPasting.current || value.endsWith(',')) {
153153
updateValues(value)
154154
isPasting.current = false
155155
} else {

packages/components/src/Form/Inputs/InputDate/InputDate.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ import { InputDate } from './InputDate'
3333
const realDateNow = Date.now.bind(global.Date)
3434

3535
beforeEach(() => {
36+
/* eslint-disable-next-line @typescript-eslint/unbound-method */
3637
global.Date.now = jest.fn(() => 1580517818172)
3738
})
3839

3940
afterEach(() => {
41+
/* eslint-disable-next-line @typescript-eslint/unbound-method */
4042
global.Date.now = realDateNow // reset Date.now mock
4143
jest.clearAllMocks()
4244
})

packages/components/src/Form/Inputs/InputDateRange/InputDateRange.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ import { InputDateRange } from './InputDateRange'
3333
const realDateNow = Date.now.bind(global.Date)
3434

3535
beforeEach(() => {
36+
/* eslint-disable-next-line @typescript-eslint/unbound-method */
3637
global.Date.now = jest.fn(() => 1580517818172)
3738
})
3839

3940
afterEach(() => {
41+
/* eslint-disable-next-line @typescript-eslint/unbound-method */
4042
global.Date.now = realDateNow // reset Date.now mock
4143
jest.clearAllMocks()
4244
})

0 commit comments

Comments
 (0)