Skip to content

Commit 82b6c28

Browse files
authored
chore: fix eslint issues
2 parents bb2694d + 32a7892 commit 82b6c28

20 files changed

+46
-38
lines changed

.eslintrc.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ module.exports = {
22
extends: ['algolia', 'algolia/react'],
33
rules: {
44
'eslint-comments/disable-enable-pair': 0,
5-
// Do not enforce a specific import order
6-
'import/order': 0,
7-
// Allow function components
8-
'react/function-component-definition': 0,
5+
// Enforce function declaration for components
6+
'react/function-component-definition': [
7+
'error',
8+
{
9+
'named-components': 'function-declaration',
10+
},
11+
],
912
// Allow boolean props without explicit values
1013
'react/jsx-boolean-value': 0,
1114
// Allow JSX content in .js files
1215
'react/jsx-filename-extension': 0,
13-
// Do not enforce event listeners naming conventions
14-
'react/jsx-handler-names': 0,
1516
// Allow passing function references to event listeners
1617
'react/jsx-no-bind': 0,
1718
// Avoid errors about `UNSAFE` lifecycles (e.g. `UNSAFE_componentWillMount`)

src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React, { createPortal } from 'preact/compat';
22
import { connectHitInsights } from 'react-instantsearch-dom';
33
import { useNavigate, useLocation } from 'react-router-dom';
44

5-
import { getUrlFromState, getStateFromUrl, createURL } from './router';
6-
import { useSearchClient, useInsights, useMatchMedia } from './hooks';
75
import { SearchButton, Search } from './components';
6+
import { useSearchClient, useInsights, useMatchMedia } from './hooks';
7+
import { getUrlFromState, getStateFromUrl, createURL } from './router';
88

99
export const AppContext = React.createContext(null);
1010
export const SearchContext = React.createContext(null);

src/components/Banner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { QueryRuleCustomData } from 'react-instantsearch-dom';
33

44
import './Banner.scss';
55

6-
export const Banner = () => {
6+
export function Banner() {
77
return (
88
<QueryRuleCustomData>
99
{({ items }) => {
@@ -23,4 +23,4 @@ export const Banner = () => {
2323
}}
2424
</QueryRuleCustomData>
2525
);
26-
};
26+
}

src/components/ColorList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from 'preact/compat';
22
import { connectRefinementList } from 'react-instantsearch-dom';
33

44
import './ColorList.scss';
5-
import { FacetSearchBox } from './SearchBox/FacetSearchBox';
65
import { PartialHighlight } from './PartialHighlight';
6+
import { FacetSearchBox } from './SearchBox/FacetSearchBox';
77

88
export const ColorList = connectRefinementList(function ColorList(props) {
99
const [query, setQuery] = React.useState('');

src/components/FiltersButton.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'preact/compat';
22

3-
import { FilterIcon } from './FilterIcon';
43
import { useSearchContext } from '../hooks';
54

5+
import { FilterIcon } from './FilterIcon';
6+
67
export function FiltersButton({ onClick }) {
78
const { refinementCount } = useSearchContext();
89

src/components/Hits.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'preact/compat';
22
import { connectHits } from 'react-instantsearch-dom';
33

44
import { useAppContext } from '../hooks';
5+
56
import { Pagination } from './Pagination';
67

78
export const Hits = connectHits((props) => {

src/components/InfiniteHits.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const InfiniteHits = connectInfiniteHits((props) => {
1616
<button
1717
type="button"
1818
className="ais-InfiniteHits-loadPrevious"
19-
onClick={props.refinePrevious}
19+
onClick={() => props.refinePrevious()}
2020
>
2121
Show previous
2222
</button>

src/components/NoResultsHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import {
77
connectHits,
88
} from 'react-instantsearch-dom';
99

10-
import { useAppContext, useSearchContext } from '../hooks';
1110
import {
1211
NO_RESULTS_INDEX_NAME,
1312
QUERY_SUGGESTIONS_INDEX_NAME,
1413
} from '../constants';
14+
import { useAppContext, useSearchContext } from '../hooks';
1515

1616
export const NoResultsHandler = connectStateResults(function ResultsWrapper(
1717
props

src/components/ProductList.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import React from 'preact/compat';
22

3+
import { useAppContext } from '../hooks';
4+
35
import { Hits } from './Hits';
46
import { InfiniteHits } from './InfiniteHits';
57

6-
import { useAppContext } from '../hooks';
7-
8-
export const ProductList = (props) => {
8+
export function ProductList(props) {
99
const { isMobile } = useAppContext();
1010

1111
if (isMobile) {
1212
return <InfiniteHits {...props} />;
1313
}
1414

1515
return <Hits {...props} />;
16-
};
16+
}

src/components/QueryRulesHandler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ const getRulesContextFromSearchState = ({ refinementList = {}, menu = {} }) => {
2121
}, {});
2222
};
2323

24-
export const QueryRulesHandler = (props) => {
24+
export function QueryRulesHandler(props) {
2525
const ruleContexts = getRulesContextFromSearchState(props.searchState);
2626

2727
if (Object.keys(ruleContexts).length === 0) {
2828
return null;
2929
}
3030

3131
return <QueryRuleContext trackedFilters={ruleContexts} />;
32-
};
32+
}

0 commit comments

Comments
 (0)