Skip to content

Commit

Permalink
chore: updates and fixes (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWaldschmidt authored Sep 5, 2024
1 parent 69d65da commit 9d4cf11
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 102 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @lob/growth-and-core-experience
* @lob/growth-and-core-experience
* @lob/self-serve-growth

# Order is important; the last matching pattern takes the most
# precedence. When someone opens a pull request that only
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: 'CodeQL'
name: '🕵️ CodeQL'

on:
push:
Expand All @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ['javascript']
language: ['javascript', 'typescript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint and Test
name: 🧪 Lint and Test

on:
push:
Expand All @@ -22,7 +22,7 @@ jobs:
uses: './.github/actions/install-node-and-npm'

- name: Install dependencies
run: npm ci --legacy-peer-deps
run: npm ci

- name: Run lint
run: npm run format-check
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## v2.0.98

- Dependency upgrades
- Code cleanup

## v2.0.97

- Storybook upgrade
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lob/ui-components",
"version": "2.0.97",
"version": "2.0.98",
"engines": {
"node": ">=20.2.0",
"npm": ">=10.2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/components/ColorPicker/__tests__/ColorPicker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const renderComponent = (options: RenderOptions = {}) =>

describe('ColorPicker', () => {
it('should render correctly', async () => {
const { baseElement, getByTestId } = renderComponent({
const { getByTestId } = renderComponent({
props: initialProps
});

Expand Down
6 changes: 1 addition & 5 deletions src/components/Dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,10 @@
import { ChevronDown } from '@/components/Icons';
import DropdownItemGroup from './DropdownItemGroup';
import DropdownItem from './DropdownItem';
import { findLastIndex, shallowEquals } from '@/utils';
import { shallowEquals } from '@/utils';
import LobLabel from '../Label/Label.vue';
import ConfirmChangeModal from './ConfirmChangeModal';

if (!Array.prototype.findLastIndex) {
Array.prototype.findLastIndex = findLastIndex; //eslint-disable-line
}

const Keys = {
Backspace: 'Backspace',
Clear: 'Clear',
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dropdown/__tests__/DropdownItem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('DropdownItem', () => {
expect(emittedEvents).toHaveProperty('click');

// eslint-disable-next-line no-unused-vars
const [event, index] = emittedEvents.click[0];
const [_, index] = emittedEvents.click[0];
expect(index).toEqual(0);
});

Expand All @@ -90,7 +90,7 @@ describe('DropdownItem', () => {
expect(emittedEvents).toHaveProperty('mouseenter');

// eslint-disable-next-line no-unused-vars
const [event, index] = emittedEvents.mouseenter[0];
const [_, index] = emittedEvents.mouseenter[0];
expect(index).toEqual(0);
});
});
4 changes: 2 additions & 2 deletions src/components/Dropdown/__tests__/DropdownItemGroup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('DropdownItemGroup', () => {
expect(emittedEvents).toHaveProperty('click');

// eslint-disable-next-line no-unused-vars
const [event, index] = emittedEvents.click[0];
const [_, index] = emittedEvents.click[0];
expect(index).toEqual(0);
});

Expand All @@ -71,7 +71,7 @@ describe('DropdownItemGroup', () => {
expect(emittedEvents).toHaveProperty('mouseenter');

// eslint-disable-next-line no-unused-vars
const [event, index] = emittedEvents.mouseenter[0];
const [_, index] = emittedEvents.mouseenter[0];
expect(index).toEqual(0);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const renderComponent = (options: RenderOptions = {}) =>

describe('ImageFileUpload', () => {
it('should render correctly', async () => {
const { baseElement, getByTestId } = renderComponent({
const { getByTestId } = renderComponent({
props: initialProps
});

Expand Down Expand Up @@ -135,7 +135,7 @@ describe('ImageFileUpload', () => {
});

it('should display an error when the file size exceeds the maxFileSize prop', async () => {
const { baseElement, getByRole, container, emitted } = renderComponent({
const { getByRole, container, emitted } = renderComponent({
props: { ...initialProps, maxFileSize: 1 }
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/TextInput/__tests__/TextInput.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('Text input', () => {
};

it('the label is correctly associated with the input when the tooltip is trailing', async () => {
const { getByLabelText, getByTestId } = render(TextInput, {
const { getByLabelText } = render(TextInput, {
...DEFAULT_RENDER_OPTIONS,
props: propsTooltip
});
Expand All @@ -198,7 +198,7 @@ describe('Text input', () => {
});

it('the label is correctly associated with the input when the tooltip is leading', () => {
const { getByLabelText, getByTestId } = render(TextInput, {
const { getByLabelText } = render(TextInput, {
...DEFAULT_RENDER_OPTIONS,
props: propsTooltipLeading
});
Expand Down
47 changes: 0 additions & 47 deletions src/utils/__tests__/array.spec.js

This file was deleted.

33 changes: 0 additions & 33 deletions src/utils/array.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,3 @@
/**
* A function to execute on each value in the array until the function returns true, indicating that the satisfying element was found.A function to execute on each value in the array until the function returns true, indicating that the satisfying element was found.
*
* @callback callbackFn
* @param {Object} element The current element being processed in the array.
* @param {number} index The index of the current element being processed in the array. (optional)
* @param {Object[]} array The array findLastIndex() was called upon.
*/

/**
* Returns the index of the last element in the array where predicate is true, and -1
* otherwise.
* @param {callbackFn} predicate findLastIndex calls predicate once for each element of the array, in descending
* order, until it finds one where predicate returns true. If such an element is found,
* findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.
* @param {Object[]} thisArg Value to use as this when executing callbackFn. (optional)
* @return {number} The index
*/
export function findLastIndex(predicate, thisArg) {
// The callback must be a function.
if (typeof predicate !== 'function') {
throw new TypeError();
}

let l = this.length;
while (l--) {
if (predicate(this[l], l, thisArg)) {
return l;
}
}
return -1;
}

/**
* A function that 'filters' a base array by the secondary array and returns the different elements in the base array
* @param {Array} baseArray The base array
Expand Down

0 comments on commit 9d4cf11

Please sign in to comment.