Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lint): update dependencies #6247

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const config = {
'algolia/typescript',
'plugin:react-hooks/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['react-hooks', 'deprecation'],
globals: {
__DEV__: false,
Expand All @@ -35,7 +36,6 @@ const config = {
'import/no-extraneous-dependencies': 'off',
'@typescript-eslint/explicit-member-accessibility': ['off'],
'import/extensions': 'off',
'eslint-comments/disable-enable-pair': 'off',
'react/jsx-no-bind': 'off',
// We can't display an error message with the ESLint version we're using
// See https://github.com/eslint/eslint/pull/14580
Expand Down Expand Up @@ -68,7 +68,6 @@ const config = {
// Avoid errors about `UNSAFE` lifecycles (e.g. `UNSAFE_componentWillMount`)
'react/no-deprecated': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
'@typescript-eslint/no-unused-vars': [
'error',
Expand Down Expand Up @@ -186,7 +185,7 @@ const config = {
},
},
{
files: ['scripts/**/*', '*.config.js', '*.conf.js'],
files: ['scripts/**/*', '*.config.js', '*.conf.js', '.eslintrc.js'],
rules: {
'import/no-commonjs': 'off',
},
Expand Down
1 change: 1 addition & 0 deletions examples/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require('path');

module.exports = {
extends: path.join(__dirname, '..', '.eslintrc.js'),
parser: '@typescript-eslint/parser',
rules: {
'import/no-unresolved': 'off',
'import/named': 'off',
Expand Down
2 changes: 1 addition & 1 deletion examples/react/next-app-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@types/node": "17.0.40",
"@types/react": "18.0.12",
"eslint": "8.4.0",
"eslint-config-next": "12.0.7",
"eslint-config-next": "14.2.4",
"typescript": "5.5.2"
}
}
2 changes: 1 addition & 1 deletion examples/react/next-routing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@types/node": "17.0.40",
"@types/react": "18.0.12",
"eslint": "8.4.0",
"eslint-config-next": "12.0.7",
"eslint-config-next": "14.2.4",
"typescript": "5.5.2"
}
}
5 changes: 4 additions & 1 deletion examples/react/next/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// This rule is not able to find the `pages/` folder in the monorepo.
"@next/next/no-html-link-for-pages": ["off"],
"react/react-in-jsx-scope": "off",
"spaced-comment": ["error", "always", { "markers": ["/"] }]
"spaced-comment": ["error", "always", { "markers": ["/"] }],
// conflict with other rules
"@typescript-eslint/consistent-type-assertions": "off",
"deprecation/deprecation": "off"
}
}
2 changes: 1 addition & 1 deletion examples/react/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@types/node": "17.0.40",
"@types/react": "18.0.12",
"eslint": "8.4.0",
"eslint-config-next": "12.0.7",
"eslint-config-next": "14.2.4",
"typescript": "5.5.2"
}
}
14 changes: 13 additions & 1 deletion examples/vue/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
const path = require('path');

module.exports = {
extends: [
path.join(__dirname, '..', '.eslintrc.js'),
'algolia/vue',
'prettier',
],
parser: '@babel/eslint-parser',
parserOptions: {
parser: '@babel/eslint-parser',
},
rules: {
'import/no-unresolved': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/consistent-type-assertions': 'off',
'@typescript-eslint/no-useless-constructor': 'off',
'vue/max-attributes-per-line': 'off',
'vue/html-closing-bracket-newline': 'off',
'vue/html-indent': 'off',
Expand All @@ -18,7 +26,11 @@ module.exports = {
},
overrides: [
{
files: ['*.config.js', '*.conf.js'],
files: ['*.vue'],
parser: 'vue-eslint-parser',
},
{
files: ['*.config.js', '*.conf.js', '.eslintrc.js'],
rules: {
'import/no-commonjs': 'off',
},
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@algolia/transporter": "4.23.2",
"@babel/cli": "7.15.4",
"@babel/core": "7.15.5",
"@babel/eslint-parser": "7.24.7",
"@babel/plugin-proposal-class-properties": "7.14.5",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-transform-react-constant-elements": "7.9.0",
Expand Down Expand Up @@ -75,8 +76,8 @@
"@types/react-test-renderer": "^18.0.0",
"@types/storybook__addon-actions": "3.4.2",
"@types/storybook__addon-knobs": "^5.0.0",
"@typescript-eslint/eslint-plugin": "5.38.1",
"@typescript-eslint/parser": "4.31.2",
"@typescript-eslint/eslint-plugin": "7.13.1",
"@typescript-eslint/parser": "7.13.1",
"@vue/vue2-jest": "27",
"@vue/vue3-jest": "27",
"@wdio/cli": "5.16.9",
Expand All @@ -89,7 +90,6 @@
"@wdio/static-server-service": "5.16.5",
"algoliasearch": "4.23.2",
"algoliasearch-v3": "npm:[email protected]",
"babel-eslint": "10.1.0",
"babel-jest": "27.4.6",
"babel-plugin-inline-replace-variables": "1.3.1",
"babel-plugin-polyfill-es-shims": "0.0.7",
Expand All @@ -99,19 +99,19 @@
"bundlesize": "0.18.0",
"doctoc": "1.4.0",
"enzyme": "3.11.0",
"eslint": "6.8.0",
"eslint": "8.57.0",
"eslint-config-algolia": "16.0.0",
"eslint-config-prettier": "6.15.0",
"eslint-import-resolver-typescript": "2.5.0",
"eslint-plugin-deprecation": "1.3.2",
"eslint-plugin-deprecation": "3.0.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.24.2",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jasmine": "4.1.0",
"eslint-plugin-jest": "27.0.4",
"eslint-plugin-jest": "28.6.0",
"eslint-plugin-prettier": "3.4.0",
"eslint-plugin-react": "7.26.0",
"eslint-plugin-react-hooks": "4.3.0",
"eslint-plugin-vue": "9.8.0",
"eslint-plugin-vue": "9.26.0",
"eslint-plugin-wdio": "5.11.0",
"jest": "27.4.7",
"jest-diff": "27.4.6",
Expand Down
1 change: 1 addition & 0 deletions packages/create-instantsearch-app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
extends: ['algolia', 'algolia/jest'],
parser: '@typescript-eslint/parser',
rules: {
'import/no-commonjs': 'off',
'no-console': 'off',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ describe('FrequentlyBoughtTogether', () => {
);

userEvent.click(
container.querySelectorAll('.ais-FrequentlyBoughtTogether-item')[0]!
container.querySelectorAll('.ais-FrequentlyBoughtTogether-item')[0]
);

expect(sendEvent).toHaveBeenCalledTimes(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ describe('Hits', () => {
const props = createProps({});
const { container } = render(<Hits {...props} />);

userEvent.click(container.querySelectorAll('.ais-Hits-item')[0]!);
userEvent.click(container.querySelectorAll('.ais-Hits-item')[0]);
expect(props.sendEvent).toHaveBeenCalledTimes(1);
expect(props.sendEvent).toHaveBeenLastCalledWith(
'click:internal',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ describe('LookingSimilar', () => {
/>
);

userEvent.click(container.querySelectorAll('.ais-LookingSimilar-item')[0]!);
userEvent.click(container.querySelectorAll('.ais-LookingSimilar-item')[0]);

expect(sendEvent).toHaveBeenCalledTimes(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,7 @@ describe('RelatedProducts', () => {
/>
);

userEvent.click(
container.querySelectorAll('.ais-RelatedProducts-item')[0]!
);
userEvent.click(container.querySelectorAll('.ais-RelatedProducts-item')[0]);

expect(sendEvent).toHaveBeenCalledTimes(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ describe('TrendingItems', () => {
/>
);

userEvent.click(container.querySelectorAll('.ais-TrendingItems-item')[0]!);
userEvent.click(container.querySelectorAll('.ais-TrendingItems-item')[0]);

expect(sendEvent).toHaveBeenCalledTimes(1);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/instantsearch.js/src/components/Slider/Rheostat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ class Rheostat extends Component<Props, State> {
);
};

public render = () => {
public render() {
const {
children,
disabled,
Expand Down Expand Up @@ -713,7 +713,7 @@ class Rheostat extends Component<Props, State> {
{children}
</div>
);
};
}
}

export default Rheostat;
2 changes: 1 addition & 1 deletion packages/instantsearch.js/src/components/Slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { range } from '../../lib/utils';
import Pit from './Pit';
import Rheostat from './Rheostat';

import type { HandleProps } from './Rheostat';
import type { RangeBoundaries } from '../../connectors/range/connectRange';
import type { ComponentCSSClasses } from '../../types';
import type {
RangeSliderCssClasses,
RangeSliderWidgetParams,
} from '../../widgets/range-slider/range-slider';
import type { HandleProps } from './Rheostat';

export type RangeSliderComponentCSSClasses =
ComponentCSSClasses<RangeSliderCssClasses>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { withInsights } from '../../lib/insights';

import connectHits from './connectHits';

import type { Connector } from '../../types';
import type { HitsConnectorParams, HitsWidgetDescription } from './connectHits';
import type { Connector } from '../../types';

/**
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { withInsights } from '../../lib/insights';

import connectInfiniteHits from './connectInfiniteHits';

import type { Connector } from '../../types';
import type {
InfiniteHitsWidgetDescription,
InfiniteHitsConnectorParams,
} from './connectInfiniteHits';
import type { Connector } from '../../types';

/**
* Due to https://github.com/microsoft/web-build-tools/issues/1050, we need
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ function hasNumericRefinement(
) {
return (
currentRefinements[operator] !== undefined &&
currentRefinements[operator]!.includes(value)
currentRefinements[operator].includes(value)
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import highlight from '../highlight';

const NONE = 'none' as const;
const FULL = 'full' as const;
const NONE: 'none' = 'none';
const FULL: 'full' = 'full';

const hit = {
name: 'Amazon - Fire TV Stick with Alexa Voice Remote - Black',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import reverseHighlight from '../reverseHighlight';

const NONE = 'none' as const;
const FULL = 'full' as const;
const NONE: 'none' = 'none';
const FULL: 'full' = 'full';

const hit = {
name: 'Amazon - Fire TV Stick with Alexa Voice Remote - Black',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import reverseSnippet from '../reverseSnippet';

const NONE = 'none' as const;
const FULL = 'full' as const;
const NONE: 'none' = 'none';
const FULL: 'full' = 'full';

const hit = {
name: 'Amazon - Fire TV Stick with Alexa Voice Remote - Black',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import snippet from '../snippet';

const NONE = 'none' as const;
const FULL = 'full' as const;
const NONE: 'none' = 'none';
const FULL: 'full' = 'full';

const hit = {
name: 'Amazon - Fire TV Stick with Alexa Voice Remote - Black',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ type CallbackReturn = {
env: 'client' | 'server';
};

const CLIENT = 'client' as const;
const SERVER = 'server' as const;
const CLIENT: 'client' = 'client';
const SERVER: 'server' = 'server';

describe('safelyRunOnBrowser', () => {
const originalWindow = (global as any).window;
Expand Down
4 changes: 2 additions & 2 deletions packages/instantsearch.js/src/lib/utils/checkIndexUiState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ ${missingWidgets
return connectors.length > 0;
})
.map(([_stateParameter, { connectors, widgets }]) => {
const capitalizedWidget = capitalize(widgets[0]!);
const capitalizedWidget = capitalize(widgets[0]);
const connectorName = connectors[0];

return `const virtual${capitalizedWidget} = ${connectorName}(() => null);`;
Expand All @@ -183,7 +183,7 @@ search.addWidgets([
return connectors.length > 0;
})
.map(([_stateParameter, { widgets }]) => {
const capitalizedWidget = capitalize(widgets[0]!);
const capitalizedWidget = capitalize(widgets[0]);

return `virtual${capitalizedWidget}({ /* ... */ })`;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('createMetadataMiddleware', () => {

describe('metadata disabled', () => {
it('does not enable on normal user agent', () => {
global.navigator!.userAgent = defaultUserAgent;
global.navigator.userAgent = defaultUserAgent;

expect(isMetadataEnabled()).toBe(false);

Expand Down Expand Up @@ -78,7 +78,7 @@ describe('createMetadataMiddleware', () => {

it("does not enable when navigator is different from browser's (React Native)", () => {
// @ts-expect-error (simulate no userAgent)
global.navigator!.userAgent = undefined;
global.navigator.userAgent = undefined;

createMetadataMiddleware();

Expand All @@ -90,7 +90,7 @@ describe('createMetadataMiddleware', () => {

describe('metadata enabled', () => {
beforeEach(() => {
global.navigator!.userAgent = algoliaUserAgent;
global.navigator.userAgent = algoliaUserAgent;
});

it('metadata enabled returns true', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/instantsearch.js/src/types/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type InstantSearch from '../lib/InstantSearch';
import type { UiState } from './ui-state';
import type { AtLeastOne } from './utils';
import type InstantSearch from '../lib/InstantSearch';

export type MiddlewareDefinition<TUiState extends UiState = UiState> = {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/instantsearch.js/src/types/render-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type { ConfigureWidgetDescription } from '../connectors/configure/connect
import type { CurrentRefinementsWidgetDescription } from '../connectors/current-refinements/connectCurrentRefinements';
import type { GeoSearchWidgetDescription } from '../connectors/geo-search/connectGeoSearch';
import type { HierarchicalMenuWidgetDescription } from '../connectors/hierarchical-menu/connectHierarchicalMenu';
import type { HitsPerPageWidgetDescription } from '../connectors/hits-per-page/connectHitsPerPage';
import type { HitsWidgetDescription } from '../connectors/hits/connectHits';
import type { HitsPerPageWidgetDescription } from '../connectors/hits-per-page/connectHitsPerPage';
import type { InfiniteHitsWidgetDescription } from '../connectors/infinite-hits/connectInfiniteHits';
import type { MenuWidgetDescription } from '../connectors/menu/connectMenu';
import type { NumericMenuWidgetDescription } from '../connectors/numeric-menu/connectNumericMenu';
Expand Down
Loading