Skip to content

Commit 8444131

Browse files
committed
chore(javascript): use oxlint
1 parent edf0ca9 commit 8444131

File tree

65 files changed

+156
-342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+156
-342
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -79,147 +79,6 @@ module.exports = {
7979
'yml/no-empty-mapping-value': 0,
8080
},
8181
},
82-
{
83-
// es linter
84-
files: ['*.ts', '*.js'],
85-
86-
extends: [
87-
'algolia',
88-
'algolia/typescript',
89-
'plugin:import/errors',
90-
'plugin:import/warnings',
91-
'plugin:import/typescript',
92-
],
93-
94-
env: {
95-
es6: true,
96-
},
97-
98-
parser: '@typescript-eslint/parser',
99-
100-
parserOptions: {
101-
tsconfigRootDir: __dirname,
102-
project: './**/tsconfig.json',
103-
},
104-
105-
settings: {
106-
'import/extensions': ['.js', '.ts'],
107-
'import/parsers': {
108-
'@typescript-eslint/parser': ['.ts'],
109-
},
110-
'import/ignore': ['node_modules'],
111-
},
112-
113-
plugins: ['algolia', 'unused-imports'],
114-
115-
rules: {
116-
// disabled
117-
'no-bitwise': 0,
118-
'max-classes-per-file': 0,
119-
'no-continue': 0,
120-
'@typescript-eslint/prefer-enum-initializers': 0,
121-
'@typescript-eslint/no-namespace': 0,
122-
'import/dynamic-import-chunkname': 0,
123-
124-
'unused-imports/no-unused-imports-ts': 2,
125-
'@typescript-eslint/no-unused-vars': 2,
126-
'@typescript-eslint/consistent-indexed-object-style': 2,
127-
'@typescript-eslint/member-ordering': [
128-
'error',
129-
{
130-
default: [
131-
'protected-instance-method',
132-
'private-instance-method',
133-
'public-instance-method',
134-
],
135-
},
136-
],
137-
'@typescript-eslint/no-restricted-types': [
138-
'error',
139-
{
140-
types: {
141-
String: {
142-
message: 'Use `string` instead.',
143-
fixWith: 'string',
144-
},
145-
Number: {
146-
message: 'Use `number` instead.',
147-
fixWith: 'number',
148-
},
149-
Boolean: {
150-
message: 'Use `boolean` instead.',
151-
fixWith: 'boolean',
152-
},
153-
Symbol: {
154-
message: 'Use `symbol` instead.',
155-
fixWith: 'symbol',
156-
},
157-
Object: {
158-
message:
159-
'The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848',
160-
fixWith: 'Record<string, unknown>',
161-
},
162-
'{}': {
163-
message:
164-
'The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead.',
165-
fixWith: 'Record<string, unknown>',
166-
},
167-
object: {
168-
message:
169-
'The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848',
170-
fixWith: 'Record<string, unknown>',
171-
},
172-
Function: 'Use a specific function type instead, like `() => void`.',
173-
},
174-
},
175-
],
176-
'jsdoc/match-description': [
177-
'error',
178-
{
179-
matchDescription: '^\n?([A-Z`\[\\d_][\\s\\S]*[.?!`]\\s*)?$'
180-
},
181-
],
182-
},
183-
},
184-
{
185-
files: ['clients/algoliasearch-client-javascript/packages/**/*.ts'],
186-
187-
rules: {
188-
// For a wider browser support (IE>=11), we forbid those two
189-
'no-restricted-syntax': [
190-
'error',
191-
{
192-
selector: "LogicalExpression[operator='??']",
193-
message:
194-
'For wider browser support, nullish coalescing operator is not allowed.',
195-
},
196-
{
197-
selector: 'ChainExpression',
198-
message:
199-
'For wider browser support, optional chaining is not allowed.',
200-
},
201-
],
202-
'@typescript-eslint/prefer-optional-chain': 0,
203-
}
204-
},
205-
{
206-
files: ['clients/algoliasearch-client-javascript/packages/**/__tests__/**/*.ts'],
207-
208-
extends: ["plugin:vitest/legacy-recommended"],
209-
210-
plugins: ['@vitest/eslint-plugin'],
211-
},
212-
{
213-
files: ['guides/**/*.ts'],
214-
215-
rules: {
216-
'no-console': 0,
217-
218-
// TODO: remove this after https://algolia.atlassian.net/browse/DI-2984
219-
'@typescript-eslint/no-unused-vars': 0,
220-
'@typescript-eslint/explicit-function-return-type': 0,
221-
},
222-
},
22382
{
22483
files: ['*.json'],
22584
parserOptions: {

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
run: yarn scripts:test
147147

148148
- name: Lint custom eslint plugin
149-
run: yarn workspace eslint-plugin-automation-custom lint
149+
run: yarn cli format javascript eslint
150150

151151
- name: Test custom eslint plugin
152152
run: yarn workspace eslint-plugin-automation-custom test

.lintstagedrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"generators/**/*.java": "yarn cli format java generators",
33
".github/**/*.yml": "yarn github-actions:lint --fix",
44
"*.json": "yarn fix:json",
5-
"scripts/**/*.(js|ts|mjs|cjs)": "yarn scripts:lint --fix",
5+
"scripts/**/*.(js|ts|mjs|cjs)": "yarn cli format javascript scripts",
66
"specs/**/*.yml": "yarn eslint --ext=yml --fix"
77
}

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ build
55
.gradle
66
target
77
bin
8+
.nx
9+
.parcel-cache
10+
.yarn
11+
builddir

.prettierrc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,26 @@
22
"trailingComma": "all",
33
"singleQuote": true,
44
"plugins": [
5-
"prettier-plugin-java"
5+
"prettier-plugin-java",
6+
"prettier-plugin-organize-imports"
67
],
78
"overrides": [
89
{
910
"files": "*.java",
1011
"options": {
1112
"printWidth": 140
1213
}
14+
},
15+
{
16+
"files": ["*.ts", "*.js"],
17+
"options": {
18+
"arrowParens": "always",
19+
"bracketSpacing": true,
20+
"bracketSameLine": false,
21+
"printWidth": 120,
22+
"useTabs": false,
23+
"quoteProps": "as-needed"
24+
}
1325
}
1426
]
1527
}

clients/algoliasearch-client-javascript/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
- [d4df544d6](https://github.com/algolia/api-clients-automation/commit/d4df544d6) fix(specs): remove usage [skip-bc] ([#3691](https://github.com/algolia/api-clients-automation/pull/3691)) by [@kai687](https://github.com/kai687/)
4747
- [d39b87726](https://github.com/algolia/api-clients-automation/commit/d39b87726) chore: assert node helpers ([#3689](https://github.com/algolia/api-clients-automation/pull/3689)) by [@shortcuts](https://github.com/shortcuts/)
48-
- [46d9d8fd0](https://github.com/algolia/api-clients-automation/commit/46d9d8fd0) feat(specs): add (optional) _automaticInsights to search result ([#3688](https://github.com/algolia/api-clients-automation/pull/3688)) by [@raed667](https://github.com/raed667/)
48+
- [46d9d8fd0](https://github.com/algolia/api-clients-automation/commit/46d9d8fd0) feat(specs): add (optional) \_automaticInsights to search result ([#3688](https://github.com/algolia/api-clients-automation/pull/3688)) by [@raed667](https://github.com/raed667/)
4949

5050
## [5.4.0](https://github.com/algolia/algoliasearch-client-javascript/compare/5.3.2...5.4.0)
5151

@@ -757,7 +757,7 @@ New major version released! Browse [our documentation](https://www.algolia.com/d
757757

758758
## [5.0.0-alpha.12](https://github.com/algolia/algoliasearch-client-javascript/compare/5.0.0-alpha.11...5.0.0-alpha.12)
759759

760-
- [ff02ba09](https://github.com/algolia/api-clients-automation/commit/ff02ba09) fix(javascript): revert: do not send user-agent for Predict (#957) ([#919](https://github.com/algolia/api-clients-automation/pull/919)) by [@shortcuts](https://github.com/shortcuts/)
760+
- [ff02ba09](https://github.com/algolia/api-clients-automation/commit/ff02ba09) fix(javascript): revert: do not send user-agent for Predict (#957) ([#919](https://github.com/algolia/api-clients-automation/pull/919)) by [@shortcuts](https://github.com/shortcuts/)
761761

762762
## [5.0.0-alpha.11](https://github.com/algolia/algoliasearch-client-javascript/compare/5.0.0-alpha.10...5.0.0-alpha.11)
763763

clients/algoliasearch-client-javascript/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@
3232

3333
## 💡 Getting Started
3434

35-
3635
To get started, you first need to install algoliasearch (or any other available API client package).
3736
All of our clients comes with type definition, and are available for both browser and node environments.
3837

3938
### With a package manager
4039

41-
4240
```bash
4341
4442
# or
@@ -82,4 +80,4 @@ Encountering an issue? Before reaching out to support, we recommend heading to o
8280

8381
## 📄 License
8482

85-
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).
83+
The Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE).
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"packages": [
3-
"packages/*"
4-
],
2+
"packages": ["packages/*"],
53
"version": "independent",
64
"useNx": true
75
}

clients/algoliasearch-client-javascript/nx.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
"default": {
44
"runner": "nx/tasks-runners/default",
55
"options": {
6-
"cacheableOperations": [
7-
"build:many",
8-
"build:all",
9-
"build"
10-
]
6+
"cacheableOperations": ["build:many", "build:all", "build"]
117
}
128
}
139
}

clients/algoliasearch-client-javascript/packages/algoliasearch/__tests__/algoliasearch.browser.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console: 0 */
22

3-
import { vi, test, expect } from 'vitest';
3+
import { expect, test, vi } from 'vitest';
44

55
import { LogLevelEnum } from '../../client-common/src/types';
66
import { createConsoleLogger } from '../../logger-console/src/logger';

clients/algoliasearch-client-javascript/packages/algoliasearch/__tests__/algoliasearch.common.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
DEFAULT_WRITE_TIMEOUT_BROWSER,
55
} from '@algolia/client-common';
66
import type { EchoResponse } from '@algolia/requester-testing';
7-
import { describe, test, expect } from 'vitest';
7+
import { describe, expect, test } from 'vitest';
88

99
import { browserEchoRequester } from '../../requester-testing/src/browserEchoRequester';
1010
import { algoliasearch, apiClientVersion } from '../builds/browser';

clients/algoliasearch-client-javascript/packages/algoliasearch/__tests__/algoliasearch.fetch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console: 0 */
22

3-
import { vi, test, expect } from 'vitest';
3+
import { expect, test, vi } from 'vitest';
44

55
import { LogLevelEnum } from '../../client-common/src/types';
66
import { createConsoleLogger } from '../../logger-console/src/logger';

clients/algoliasearch-client-javascript/packages/algoliasearch/__tests__/algoliasearch.node.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console: 0 */
22

3-
import { vi, test, expect } from 'vitest';
3+
import { expect, test, vi } from 'vitest';
44

55
import { LogLevelEnum } from '../../client-common/src/types';
66
import { createConsoleLogger } from '../../logger-console/src/logger';

clients/algoliasearch-client-javascript/packages/client-common/src/__tests__/cache/browser-local-storage-cache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { vi, describe, test, beforeEach, expect } from 'vitest';
1+
import { beforeEach, describe, expect, test, vi } from 'vitest';
22

33
import { createBrowserLocalStorageCache } from '../../cache';
44

clients/algoliasearch-client-javascript/packages/client-common/src/__tests__/cache/fallbackable-cache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, test, expect } from 'vitest';
1+
import { describe, expect, test } from 'vitest';
22

33
import {
44
createBrowserLocalStorageCache,

clients/algoliasearch-client-javascript/packages/client-common/src/__tests__/cache/memory-cache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { vi, describe, test, beforeEach, expect } from 'vitest';
1+
import { beforeEach, describe, expect, test, vi } from 'vitest';
22

33
import { createMemoryCache } from '../../cache';
44

clients/algoliasearch-client-javascript/packages/client-common/src/__tests__/cache/null-cache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { vi, describe, test, beforeEach, expect } from 'vitest';
1+
import { beforeEach, describe, expect, test, vi } from 'vitest';
22

33
import { createNullCache } from '../../cache';
44

clients/algoliasearch-client-javascript/packages/client-common/src/__tests__/create-iterable-promise.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, test, expect } from 'vitest';
1+
import { describe, expect, test } from 'vitest';
22

33
import { createIterablePromise } from '../createIterablePromise';
44

clients/algoliasearch-client-javascript/packages/client-common/src/__tests__/logger/null-logger.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console: 0 */
22

3-
import { vi, describe, test, expect } from 'vitest';
3+
import { describe, expect, test, vi } from 'vitest';
44

55
import { createNullLogger } from '../../logger';
66

clients/algoliasearch-client-javascript/packages/client-common/src/cache/createFallbackableCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { FallbackableCacheOptions, Cache, CacheEvents } from '../types';
1+
import type { Cache, CacheEvents, FallbackableCacheOptions } from '../types';
22

33
import { createNullCache } from './createNullCache';
44

clients/algoliasearch-client-javascript/packages/client-common/src/createAlgoliaAgent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AlgoliaAgentOptions, AlgoliaAgent } from './types';
1+
import type { AlgoliaAgent, AlgoliaAgentOptions } from './types';
22

33
export function createAlgoliaAgent(version: string): AlgoliaAgent {
44
const algoliaAgent = {

clients/algoliasearch-client-javascript/packages/client-common/src/getAlgoliaAgent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createAlgoliaAgent } from './createAlgoliaAgent';
2-
import type { AlgoliaAgentOptions, AlgoliaAgent } from './types';
2+
import type { AlgoliaAgent, AlgoliaAgentOptions } from './types';
33

44
export type GetAlgoliaAgent = {
55
algoliaAgents: AlgoliaAgentOptions[];

clients/algoliasearch-client-javascript/packages/client-common/src/transporter/createTransporter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import type {
22
EndRequest,
33
Host,
4+
QueryParameters,
45
Request,
56
RequestOptions,
67
Response,
78
StackFrame,
8-
TransporterOptions,
99
Transporter,
10-
QueryParameters,
10+
TransporterOptions,
1111
} from '../types';
1212

1313
import { createStatefulHost } from './createStatefulHost';
1414
import { RetryError } from './errors';
1515
import { deserializeFailure, deserializeSuccess, serializeData, serializeHeaders, serializeUrl } from './helpers';
1616
import { isRetryable, isSuccess } from './responses';
17-
import { stackTraceWithoutCredentials, stackFrameWithoutCredentials } from './stackTrace';
17+
import { stackFrameWithoutCredentials, stackTraceWithoutCredentials } from './stackTrace';
1818

1919
type RetryableOptions = {
2020
hosts: Host[];

clients/algoliasearch-client-javascript/packages/client-common/src/transporter/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export * from './createTransporter';
21
export * from './createStatefulHost';
2+
export * from './createTransporter';
33
export * from './errors';
44
export * from './helpers';
55
export * from './responses';

clients/algoliasearch-client-javascript/packages/client-common/src/types/requester.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import type { Headers, QueryParameters } from './transporter';
1+
export type Headers = Record<string, string>;
2+
3+
export type QueryParameters = Record<string, any>;
24

35
/**
46
* The method of the request.

0 commit comments

Comments
 (0)