Skip to content

Commit

Permalink
chore: run lint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
illiteratewriter committed Apr 26, 2024
1 parent f88f635 commit b73b74d
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"clean": "rm -rf esm lib",
"prepublishOnly": "npm run build",
"create-release": "npm run cover && sh ./scripts/release",
"lint": "eslint src stories",
"lint": "eslint src stories --fix",
"dtslint": "dtslint types --expectOnly",
"prettier": "prettier --write src stories",
"version": "node_modules/.bin/conventional-changelog -i CHANGELOG.md -o CHANGELOG.md -p angular && git add -A CHANGELOG.md"
Expand Down
3 changes: 1 addition & 2 deletions src/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class Dropdown extends React.Component {
const menu = this.getMenu();
const toggle = this.getToggle();

// Add a conditional check to avoid using toggle
// Add a conditional check to avoid using toggle
// if there is no toggle component in the dropdown
if (!toggle) {
return;
Expand Down Expand Up @@ -127,7 +127,6 @@ class Dropdown extends React.Component {
this.toggle(e);
}


handleKeyDown(e) {
const isTargetMenuItem =
e.target.getAttribute('role') === 'menuitem' ||
Expand Down
6 changes: 5 additions & 1 deletion src/DropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ class DropdownMenu extends React.Component {
strategy={strategy}
>
{({ ref, style, placement, update }) => {
let combinedStyle = { ...this.props.style, ...persistStyles, ...style };
let combinedStyle = {
...this.props.style,
...persistStyles,
...style,
};

const handleRef = (tagRef) => {
// Send the ref to `react-popper`
Expand Down
16 changes: 3 additions & 13 deletions src/DropdownToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,25 +118,15 @@ class DropdownToggle extends React.Component {
children={children}
/>
);
}
};

// No Reference component if the component is in Navbar
if (this.context.inNavbar) {
return (
<>
{returnFunction({ ref: this.context.onToggleRef })}
</>
);
return <>{returnFunction({ ref: this.context.onToggleRef })}</>;
}

// Normal rendering if component not in NavBar
return (

<Reference innerRef={innerRef} >
{returnFunction}
</Reference>
);

return <Reference innerRef={innerRef}>{returnFunction}</Reference>;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/NavLink.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { createEvent, fireEvent, render, screen } from '@testing-library/react';
import { NavLink } from '..';
import user from '@testing-library/user-event';
import { NavLink } from '..';
import {
testForChildrenInComponent,
testForCustomClass,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/Pagination.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Pagination } from '..';
import { screen, render } from '@testing-library/react';
import { Pagination } from '..';
import { testForChildrenInComponent } from '../testUtils';

describe('Pagination', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/PaginationItem.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { PaginationItem } from '..';
import {
testForCustomTag,
testForDefaultClass,
testForDefaultTag,
} from '../testUtils';
import { render, screen } from '@testing-library/react';

describe('PaginationItem', () => {
it('should render default tag', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/PaginationLink.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { PaginationLink } from '..';
import {
testForCustomTag,
testForDefaultClass,
testForDefaultTag,
} from '../testUtils';
import { render, screen } from '@testing-library/react';

describe('PaginationLink', () => {
it('should render default `a` tag when `href` is present', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/PlaceholderButton.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { PlaceholderButton } from '..';
import { render, screen } from '@testing-library/react';
import { PlaceholderButton } from '..';
import '@testing-library/jest-dom';

describe('PlaceholderButton', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/Progress.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { Progress } from '..';
import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/react';
import {
testForCustomTag,
testForDefaultClass,
testForDefaultTag,
} from '../testUtils';
import { render, screen } from '@testing-library/react';
import { Progress } from '..';

describe('Progress', () => {
it('should render with "div" tag by default', () => {
Expand Down
10 changes: 5 additions & 5 deletions src/__tests__/Tabs.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { TabContent, TabPane } from '..';
import { screen, render } from '@testing-library/react';
import { TabContent, TabPane } from '..';
import '@testing-library/jest-dom';

let activeTab = '1';
describe('Tabs', () => {
it('should render', () => {
render(
<TabContent activeTab={'1'}>
<TabContent activeTab="1">
<TabPane tabId="1">Destiny</TabPane>
<TabPane tabId="2">Death</TabPane>
</TabContent>,
Expand All @@ -18,7 +18,7 @@ describe('Tabs', () => {

it('should have tab1 as active', () => {
render(
<TabContent activeTab={'1'}>
<TabContent activeTab="1">
<TabPane tabId="1">Dream</TabPane>
<TabPane tabId="2">Destruction</TabPane>
</TabContent>,
Expand All @@ -29,7 +29,7 @@ describe('Tabs', () => {

it('should switch to tab2 as active', () => {
render(
<TabContent activeTab={'2'}>
<TabContent activeTab="2">
<TabPane tabId="1">Desire</TabPane>
<TabPane tabId="2">Despair</TabPane>
</TabContent>,
Expand All @@ -40,7 +40,7 @@ describe('Tabs', () => {

it('should show no active tabs if active tab id is unknown', () => {
render(
<TabContent activeTab={'3'}>
<TabContent activeTab="3">
<TabPane tabId="1">Delirium</TabPane>
<TabPane tabId="2">Delight</TabPane>
</TabContent>,
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/Uncontrolled.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
import user from '@testing-library/user-event';
import {
Alert,
ButtonDropdown,
Expand All @@ -10,9 +12,7 @@ import {
UncontrolledDropdown,
UncontrolledTooltip,
} from '..';
import { fireEvent, render, screen } from '@testing-library/react';
import { testForDefaultClass } from '../testUtils';
import user from '@testing-library/user-event';
import '@testing-library/jest-dom';

describe('UncontrolledAlert', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/UncontrolledCollapse.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { UncontrolledCollapse } from '..';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom';
import user from '@testing-library/user-event';
import { UncontrolledCollapse } from '..';

describe('UncontrolledCollapse', () => {
let toggler;
Expand Down

0 comments on commit b73b74d

Please sign in to comment.