Skip to content

Commit b6a9c1a

Browse files
committed
Disable rule about require only locally
1 parent 9a2f882 commit b6a9c1a

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

eslint.config.js

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,80 @@
1-
const eslint = require('@eslint/js');
2-
const tseslint = require('typescript-eslint');
3-
const tsdoc = require('eslint-plugin-tsdoc');
4-
const jest = require('eslint-plugin-jest');
5-
const globals = require('globals');
6-
const prettier = require('eslint-config-prettier');
1+
const eslint = require("@eslint/js");
2+
const tseslint = require("typescript-eslint");
3+
const tsdoc = require("eslint-plugin-tsdoc");
4+
const jest = require("eslint-plugin-jest");
5+
const globals = require("globals");
6+
const prettier = require("eslint-config-prettier");
77

8-
/** @type {import('eslint').Linter.Config[]} */
8+
/** @type {import("eslint").Linter.Config[]} */
99
module.exports = [
1010
{
11-
ignores: ['dist/', 'tests/env/', 'coverage/', 'playgrounds/', 'docs/'],
11+
ignores: ["dist/", "tests/env/", "coverage/", "playgrounds/", "docs/"],
1212
},
1313
// Standard linting for js files
1414
{
15-
files: ['**/*.js'],
16-
languageOptions: { sourceType: 'script', globals: globals.node },
15+
files: ["**/*.js"],
16+
languageOptions: { sourceType: "script", globals: globals.node },
1717
plugins: { eslint },
1818
rules: eslint.configs.recommended.rules,
1919
},
2020
// TypeScript linting for ts files
2121
...tseslint.configs.recommendedTypeChecked.map((config) => ({
2222
...config,
23-
files: ['**/*.ts'],
23+
files: ["**/*.ts"],
2424
languageOptions: {
2525
globals: globals.node,
2626
parser: tseslint.parser,
27-
parserOptions: { project: 'tsconfig.eslint.json' },
27+
parserOptions: { project: "tsconfig.eslint.json" },
2828
},
2929
plugins: { ...config.plugins, tsdoc },
3030
rules: {
3131
...config.rules,
32-
'tsdoc/syntax': 'error',
32+
"tsdoc/syntax": "error",
3333
// @TODO: Remove the ones between "~~", adapt code
3434
// ~~
35-
'@typescript-eslint/prefer-as-const': 'off',
36-
'@typescript-eslint/ban-ts-comment': 'off',
37-
'@typescript-eslint/no-unsafe-call': 'off',
38-
'@typescript-eslint/no-unsafe-member-access': 'off',
39-
'@typescript-eslint/no-unsafe-return': 'off',
40-
'@typescript-eslint/no-unsafe-assignment': 'off',
41-
'@typescript-eslint/no-unsafe-argument': 'off',
42-
'@typescript-eslint/no-floating-promises': 'off',
35+
"@typescript-eslint/prefer-as-const": "off",
36+
"@typescript-eslint/ban-ts-comment": "off",
37+
"@typescript-eslint/no-unsafe-call": "off",
38+
"@typescript-eslint/no-unsafe-member-access": "off",
39+
"@typescript-eslint/no-unsafe-return": "off",
40+
"@typescript-eslint/no-unsafe-assignment": "off",
41+
"@typescript-eslint/no-unsafe-argument": "off",
42+
"@typescript-eslint/no-floating-promises": "off",
4343
// ~~
44-
'@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
44+
"@typescript-eslint/array-type": ["warn", { default: "array-simple" }],
4545
// @TODO: Should be careful with this rule, should leave it be and disable
4646
// it within files where necessary with explanations
47-
'@typescript-eslint/no-explicit-any': 'off',
48-
'@typescript-eslint/no-unused-vars': [
49-
'error',
47+
"@typescript-eslint/no-explicit-any": "off",
48+
"@typescript-eslint/no-unused-vars": [
49+
"error",
5050
// argsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#argsignorepattern
5151
// varsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#varsignorepattern
52-
{ args: 'all', argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
52+
{ args: "all", argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
5353
],
5454
// @TODO: Not recommended to disable rule, should instead disable locally
5555
// with explanation
56-
'@typescript-eslint/ban-ts-ignore': 'off',
57-
'@typescript-eslint/no-require-imports': 'off',
56+
"@typescript-eslint/ban-ts-ignore": "off",
5857
},
5958
})),
6059
// Jest linting for test files
6160
{
62-
files: ['tests/*.ts'],
63-
...jest.configs['flat/recommended'],
61+
files: ["tests/*.ts"],
62+
...jest.configs["flat/recommended"],
6463
// languageOptions: {
6564
// ...jest.configs['flat/recommended'].languageOptions,
6665
// globals: globals.jest,
6766
// },
6867
rules: {
69-
...jest.configs['flat/recommended'].rules,
68+
...jest.configs["flat/recommended"].rules,
7069
// @TODO: Remove all of these rules and adapt code!
71-
'jest/no-disabled-tests': 'off',
72-
'jest/expect-expect': 'off',
73-
'jest/no-conditional-expect': 'off',
74-
'jest/valid-title': 'off',
75-
'jest/no-jasmine-globals': 'off',
76-
'jest/valid-expect-in-promise': 'off',
77-
'jest/valid-expect': 'off',
78-
'jest/no-alias-methods': 'off',
70+
"jest/no-disabled-tests": "off",
71+
"jest/expect-expect": "off",
72+
"jest/no-conditional-expect": "off",
73+
"jest/valid-title": "off",
74+
"jest/no-jasmine-globals": "off",
75+
"jest/valid-expect-in-promise": "off",
76+
"jest/valid-expect": "off",
77+
"jest/no-alias-methods": "off",
7978
},
8079
},
8180
prettier,

src/http-requests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function constructHostURL(host: string): string {
3434
host = addTrailingSlash(host);
3535
return host;
3636
} catch {
37-
throw new MeiliSearchError('The provided host is not valid.');
37+
throw new MeiliSearchError("The provided host is not valid.");
3838
}
3939
}
4040

@@ -106,7 +106,7 @@ class HttpRequests {
106106
const host = constructHostURL(config.host);
107107
this.url = new URL(host);
108108
} catch {
109-
throw new MeiliSearchError('The provided host is not valid.');
109+
throw new MeiliSearchError("The provided host is not valid.");
110110
}
111111
}
112112

src/types/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,9 @@ export type TasksQuery = {
524524
from?: number;
525525
};
526526

527-
export type CancelTasksQuery = Omit<TasksQuery, 'limit' | 'from'> & {};
527+
export type CancelTasksQuery = Omit<TasksQuery, "limit" | "from"> & {};
528528

529-
export type DeleteTasksQuery = Omit<TasksQuery, 'limit' | 'from'> & {};
529+
export type DeleteTasksQuery = Omit<TasksQuery, "limit" | "from"> & {};
530530

531531
export type EnqueuedTaskObject = {
532532
taskUid: number;

tests/search.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from "./utils/meilisearch-test-utils";
1313

1414
if (typeof fetch === "undefined") {
15+
// eslint-disable-next-line @typescript-eslint/no-require-imports
1516
require("cross-fetch/polyfill");
1617
}
1718

0 commit comments

Comments
 (0)