Skip to content

Commit 125468b

Browse files
committed
Run formatter
1 parent 1ac3605 commit 125468b

Some content is hidden

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

62 files changed

+2200
-2200
lines changed

.eslintrc.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,77 +5,77 @@ module.exports = {
55
env: { es2022: true, browser: true, node: true },
66
// Standard linting for pure javascript files
77
extends: [
8-
'eslint:recommended',
8+
"eslint:recommended",
99
// Disables all style rules (must always be put last, so it overrides anything before it)
1010
// https://prettier.io/docs/en/integrating-with-linters.html
1111
// https://github.com/prettier/eslint-config-prettier
12-
'prettier',
12+
"prettier",
1313
],
1414
overrides: [
1515
// TypeScript linting for TypeScript files
1616
{
17-
files: '*.ts',
17+
files: "*.ts",
1818
plugins: [
19-
'@typescript-eslint',
19+
"@typescript-eslint",
2020
// https://tsdoc.org/
21-
'eslint-plugin-tsdoc',
21+
"eslint-plugin-tsdoc",
2222
],
23-
parser: '@typescript-eslint/parser',
24-
parserOptions: { project: 'tsconfig.eslint.json' },
23+
parser: "@typescript-eslint/parser",
24+
parserOptions: { project: "tsconfig.eslint.json" },
2525
extends: [
26-
'plugin:@typescript-eslint/recommended-type-checked',
27-
'prettier',
26+
"plugin:@typescript-eslint/recommended-type-checked",
27+
"prettier",
2828
],
2929
rules: {
30-
'tsdoc/syntax': 'error',
30+
"tsdoc/syntax": "error",
3131
// @TODO: Remove the ones between "~~", adapt code
3232
// ~~
33-
'@typescript-eslint/prefer-as-const': 'off',
34-
'@typescript-eslint/ban-ts-comment': 'off',
35-
'@typescript-eslint/no-unsafe-call': 'off',
36-
'@typescript-eslint/no-unsafe-member-access': 'off',
37-
'@typescript-eslint/no-unsafe-return': 'off',
38-
'@typescript-eslint/no-unsafe-assignment': 'off',
39-
'@typescript-eslint/no-unsafe-argument': 'off',
40-
'@typescript-eslint/no-floating-promises': 'off',
33+
"@typescript-eslint/prefer-as-const": "off",
34+
"@typescript-eslint/ban-ts-comment": "off",
35+
"@typescript-eslint/no-unsafe-call": "off",
36+
"@typescript-eslint/no-unsafe-member-access": "off",
37+
"@typescript-eslint/no-unsafe-return": "off",
38+
"@typescript-eslint/no-unsafe-assignment": "off",
39+
"@typescript-eslint/no-unsafe-argument": "off",
40+
"@typescript-eslint/no-floating-promises": "off",
4141
// ~~
42-
'@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
42+
"@typescript-eslint/array-type": ["warn", { default: "array-simple" }],
4343
// @TODO: Should be careful with this rule, should leave it be and disable
4444
// it within files where necessary with explanations
45-
'@typescript-eslint/no-explicit-any': 'off',
46-
'@typescript-eslint/no-unused-vars': [
47-
'error',
45+
"@typescript-eslint/no-explicit-any": "off",
46+
"@typescript-eslint/no-unused-vars": [
47+
"error",
4848
// argsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#argsignorepattern
4949
// varsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#varsignorepattern
50-
{ args: 'all', argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
50+
{ args: "all", argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
5151
],
5252
// @TODO: Not recommended to disable rule, should instead disable locally
5353
// with explanation
54-
'@typescript-eslint/ban-ts-ignore': 'off',
54+
"@typescript-eslint/ban-ts-ignore": "off",
5555
},
5656
},
5757
// Jest linting for test files
5858
{
59-
files: 'tests/*.ts',
60-
plugins: ['jest'],
59+
files: "tests/*.ts",
60+
plugins: ["jest"],
6161
env: {
6262
// @TODO: Jasmine is not meant to be used in Jest tests,
6363
// there's even a rule for it in plugin:jest/recommended
6464
jasmine: true,
6565
jest: true,
66-
'jest/globals': true,
66+
"jest/globals": true,
6767
},
68-
extends: ['plugin:jest/recommended', 'prettier'],
68+
extends: ["plugin:jest/recommended", "prettier"],
6969
// @TODO: Remove all of these rules and adapt code!
7070
rules: {
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',
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",
7979
},
8080
},
8181
],

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// https://prettier.io/docs/en/options.html
22

33
module.exports = {
4-
plugins: ['./node_modules/prettier-plugin-jsdoc/dist/index.js'],
4+
plugins: ["./node_modules/prettier-plugin-jsdoc/dist/index.js"],
55
// https://github.com/hosseinmd/prettier-plugin-jsdoc#tsdoc
66
tsdoc: true,
77
};

jest.config.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
/** @type {import('jest').Config} */
1+
/** @type {import("jest").Config} */
22
const config = {
3-
rootDir: '.',
4-
testMatch: ['<rootDir>/tests/**/*.ts?(x)'],
3+
rootDir: ".",
4+
testMatch: ["<rootDir>/tests/**/*.ts?(x)"],
55
verbose: true,
6-
testPathIgnorePatterns: ['meilisearch-test-utils', 'env'],
6+
testPathIgnorePatterns: ["meilisearch-test-utils", "env"],
77
collectCoverage: true,
88
coverageThreshold: {
99
global: {
10-
'ts-jest': {
11-
tsConfig: '<rootDir>/tsconfig.json',
10+
"ts-jest": {
11+
tsConfig: "<rootDir>/tsconfig.json",
1212
},
1313
},
1414
},
1515
watchPlugins: [
16-
'jest-watch-typeahead/filename',
17-
'jest-watch-typeahead/testname',
16+
"jest-watch-typeahead/filename",
17+
"jest-watch-typeahead/testname",
1818
],
1919
projects: [
2020
{
21-
preset: 'ts-jest',
22-
displayName: 'browser',
23-
testEnvironment: 'jsdom',
24-
testMatch: ['<rootDir>/tests/**/*.ts?(x)'],
21+
preset: "ts-jest",
22+
displayName: "browser",
23+
testEnvironment: "jsdom",
24+
testMatch: ["<rootDir>/tests/**/*.ts?(x)"],
2525
testPathIgnorePatterns: [
26-
'meilisearch-test-utils',
27-
'env/',
28-
'token.test.ts',
26+
"meilisearch-test-utils",
27+
"env/",
28+
"token.test.ts",
2929
],
3030
// make sure built-in Node.js fetch doesn't get replaced for consistency
3131
globals: { fetch: global.fetch, AbortController: global.AbortController },
3232
},
3333
{
34-
preset: 'ts-jest',
35-
displayName: 'node',
36-
testEnvironment: 'node',
37-
testMatch: ['<rootDir>/tests/**/*.ts?(x)'],
38-
testPathIgnorePatterns: ['meilisearch-test-utils', 'env/'],
34+
preset: "ts-jest",
35+
displayName: "node",
36+
testEnvironment: "node",
37+
testMatch: ["<rootDir>/tests/**/*.ts?(x)"],
38+
testPathIgnorePatterns: ["meilisearch-test-utils", "env/"],
3939
},
4040
],
4141
};

playgrounds/javascript/src/app.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { MeiliSearch } from '../../../src';
1+
import { MeiliSearch } from "../../../src";
22

33
const config = {
4-
host: 'http://127.0.0.1:7700',
5-
apiKey: 'masterKey',
4+
host: "http://127.0.0.1:7700",
5+
apiKey: "masterKey",
66
};
77

88
const client = new MeiliSearch(config);
9-
const indexUid = 'movies';
9+
const indexUid = "movies";
1010

1111
const addDataset = async () => {
1212
await client.deleteIndex(indexUid);
@@ -16,16 +16,16 @@ const addDataset = async () => {
1616
const documents = await client.index(indexUid).getDocuments();
1717

1818
const dataset = [
19-
{ id: 1, title: 'Carol', genres: ['Romance', 'Drama'] },
20-
{ id: 2, title: 'Wonder Woman', genres: ['Action', 'Adventure'] },
21-
{ id: 3, title: 'Life of Pi', genres: ['Adventure', 'Drama'] },
19+
{ id: 1, title: "Carol", genres: ["Romance", "Drama"] },
20+
{ id: 2, title: "Wonder Woman", genres: ["Action", "Adventure"] },
21+
{ id: 3, title: "Life of Pi", genres: ["Adventure", "Drama"] },
2222
{
2323
id: 4,
24-
title: 'Mad Max: Fury Road',
25-
genres: ['Adventure', 'Science Fiction'],
24+
title: "Mad Max: Fury Road",
25+
genres: ["Adventure", "Science Fiction"],
2626
},
27-
{ id: 5, title: 'Moana', genres: ['Fantasy', 'Action'] },
28-
{ id: 6, title: 'Philadelphia', genres: ['Drama'] },
27+
{ id: 5, title: "Moana", genres: ["Fantasy", "Action"] },
28+
{ id: 6, title: "Philadelphia", genres: ["Drama"] },
2929
];
3030
if (documents.results.length === 0) {
3131
const { taskUid } = await client.index(indexUid).addDocuments(dataset);
@@ -37,24 +37,24 @@ const addDataset = async () => {
3737
try {
3838
await addDataset();
3939
const indexes = await client.getRawIndexes();
40-
document.querySelector('.indexes').innerText = JSON.stringify(
40+
document.querySelector(".indexes").innerText = JSON.stringify(
4141
indexes,
4242
null,
4343
1,
4444
);
45-
const resp = await client.index(indexUid).search('', {
46-
attributesToHighlight: ['title'],
45+
const resp = await client.index(indexUid).search("", {
46+
attributesToHighlight: ["title"],
4747
});
4848
console.log({ resp });
4949
console.log({ hit: resp.hits[0] });
50-
document.querySelector('.hits').innerText = JSON.stringify(
50+
document.querySelector(".hits").innerText = JSON.stringify(
5151
resp.hits.map((hit) => hit.title),
5252
null,
5353
1,
5454
);
55-
document.querySelector('.errors_title').style.display = 'none';
55+
document.querySelector(".errors_title").style.display = "none";
5656
} catch (e) {
5757
console.error(e);
58-
document.querySelector('.errors').innerText = JSON.stringify(e, null, 1);
58+
document.querySelector(".errors").innerText = JSON.stringify(e, null, 1);
5959
}
6060
})();

rollup.config.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,107 @@
1-
const nodeResolve = require('@rollup/plugin-node-resolve');
2-
const { resolve } = require('path');
3-
const commonjs = require('@rollup/plugin-commonjs');
4-
const json = require('@rollup/plugin-json');
5-
const typescript = require('rollup-plugin-typescript2');
6-
const pkg = require('./package.json');
7-
const { terser } = require('rollup-plugin-terser');
8-
const { babel } = require('@rollup/plugin-babel');
1+
const nodeResolve = require("@rollup/plugin-node-resolve");
2+
const { resolve } = require("path");
3+
const commonjs = require("@rollup/plugin-commonjs");
4+
const json = require("@rollup/plugin-json");
5+
const typescript = require("rollup-plugin-typescript2");
6+
const pkg = require("./package.json");
7+
const { terser } = require("rollup-plugin-terser");
8+
const { babel } = require("@rollup/plugin-babel");
99

1010
function getOutputFileName(fileName, isProd = false) {
11-
return isProd ? fileName.replace(/\.js$/, '.min.js') : fileName;
11+
return isProd ? fileName.replace(/\.js$/, ".min.js") : fileName;
1212
}
1313

14-
const env = process.env.NODE_ENV || 'development';
15-
const ROOT = resolve(__dirname, '.');
14+
const env = process.env.NODE_ENV || "development";
15+
const ROOT = resolve(__dirname, ".");
1616

1717
const PLUGINS = [
1818
typescript({
1919
useTsconfigDeclarationDir: true,
2020
tsconfigOverride: {
2121
allowJs: false,
22-
include: ['src'],
23-
exclude: ['tests', 'examples', '*.js', 'scripts'],
22+
include: ["src"],
23+
exclude: ["tests", "examples", "*.js", "scripts"],
2424
},
2525
}),
2626
];
2727

2828
module.exports = [
2929
// browser-friendly UMD build
3030
{
31-
input: 'src/browser.ts', // directory to transpilation of typescript
31+
input: "src/browser.ts", // directory to transpilation of typescript
3232
output: {
33-
name: 'window',
33+
name: "window",
3434
extend: true,
3535
file: getOutputFileName(
3636
// will add .min. in filename if in production env
3737
resolve(ROOT, pkg.jsdelivr),
38-
env === 'production',
38+
env === "production",
3939
),
40-
format: 'umd',
41-
sourcemap: env === 'production', // create sourcemap for error reporting in production mode
40+
format: "umd",
41+
sourcemap: env === "production", // create sourcemap for error reporting in production mode
4242
},
4343
plugins: [
4444
...PLUGINS,
4545
babel({
4646
babelrc: false,
47-
extensions: ['.ts'],
47+
extensions: [".ts"],
4848
presets: [
4949
[
50-
'@babel/preset-env',
50+
"@babel/preset-env",
5151
{
5252
modules: false,
5353
targets: {
54-
browsers: ['last 2 versions', 'ie >= 11'],
54+
browsers: ["last 2 versions", "ie >= 11"],
5555
},
5656
},
5757
],
5858
],
5959
}),
6060
nodeResolve({
61-
mainFields: ['jsnext', 'main'],
61+
mainFields: ["jsnext", "main"],
6262
preferBuiltins: true,
6363
browser: true,
6464
}),
6565
commonjs({
66-
include: ['node_modules/**'],
66+
include: ["node_modules/**"],
6767
}),
6868
// nodePolyfills
6969
json(),
70-
env === 'production' ? terser() : {}, // will minify the file in production mode
70+
env === "production" ? terser() : {}, // will minify the file in production mode
7171
],
7272
},
7373

7474
// ES module (for bundlers) build.
7575
{
76-
input: 'src/index.ts',
76+
input: "src/index.ts",
7777
output: [
7878
{
7979
file: getOutputFileName(
8080
resolve(ROOT, pkg.module),
81-
env === 'production',
81+
env === "production",
8282
),
83-
exports: 'named',
84-
format: 'es',
85-
sourcemap: env === 'production', // create sourcemap for error reporting in production mode
83+
exports: "named",
84+
format: "es",
85+
sourcemap: env === "production", // create sourcemap for error reporting in production mode
8686
},
8787
],
8888
plugins: [
89-
env === 'production' ? terser() : {}, // will minify the file in production mode
89+
env === "production" ? terser() : {}, // will minify the file in production mode
9090
...PLUGINS,
9191
],
9292
},
9393
// Common JS build (Node).
9494
// Compatible only in a nodeJS environment.
9595
{
96-
input: 'src/index.ts',
96+
input: "src/index.ts",
9797
output: {
9898
file: getOutputFileName(
9999
// will add .min. in filename if in production env
100100
resolve(ROOT, pkg.main),
101-
env === 'production',
101+
env === "production",
102102
),
103-
exports: 'named',
104-
format: 'cjs',
103+
exports: "named",
104+
format: "cjs",
105105
},
106106
plugins: [...PLUGINS],
107107
},

0 commit comments

Comments
 (0)