Skip to content

Commit

Permalink
Merge branch 'main' into bump-meilisearch-v1.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
curquiza authored Oct 2, 2024
2 parents c8783db + 0204a2d commit c5be7e2
Show file tree
Hide file tree
Showing 66 changed files with 2,643 additions and 2,812 deletions.
22 changes: 0 additions & 22 deletions .editorconfig

This file was deleted.

72 changes: 36 additions & 36 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,77 +5,77 @@ module.exports = {
env: { es2022: true, browser: true, node: true },
// Standard linting for pure javascript files
extends: [
'eslint:recommended',
"eslint:recommended",
// Disables all style rules (must always be put last, so it overrides anything before it)
// https://prettier.io/docs/en/integrating-with-linters.html
// https://github.com/prettier/eslint-config-prettier
'prettier',
"prettier",
],
overrides: [
// TypeScript linting for TypeScript files
{
files: '*.ts',
files: "*.ts",
plugins: [
'@typescript-eslint',
"@typescript-eslint",
// https://tsdoc.org/
'eslint-plugin-tsdoc',
"eslint-plugin-tsdoc",
],
parser: '@typescript-eslint/parser',
parserOptions: { project: 'tsconfig.eslint.json' },
parser: "@typescript-eslint/parser",
parserOptions: { project: "tsconfig.eslint.json" },
extends: [
'plugin:@typescript-eslint/recommended-type-checked',
'prettier',
"plugin:@typescript-eslint/recommended-type-checked",
"prettier",
],
rules: {
'tsdoc/syntax': 'error',
"tsdoc/syntax": "error",
// @TODO: Remove the ones between "~~", adapt code
// ~~
'@typescript-eslint/prefer-as-const': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-floating-promises': 'off',
"@typescript-eslint/prefer-as-const": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-floating-promises": "off",
// ~~
'@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
"@typescript-eslint/array-type": ["warn", { default: "array-simple" }],
// @TODO: Should be careful with this rule, should leave it be and disable
// it within files where necessary with explanations
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
// argsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#argsignorepattern
// varsIgnorePattern: https://eslint.org/docs/latest/rules/no-unused-vars#varsignorepattern
{ args: 'all', argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
{ args: "all", argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
// @TODO: Not recommended to disable rule, should instead disable locally
// with explanation
'@typescript-eslint/ban-ts-ignore': 'off',
"@typescript-eslint/ban-ts-ignore": "off",
},
},
// Jest linting for test files
{
files: 'tests/*.ts',
plugins: ['jest'],
files: "tests/*.ts",
plugins: ["jest"],
env: {
// @TODO: Jasmine is not meant to be used in Jest tests,
// there's even a rule for it in plugin:jest/recommended
jasmine: true,
jest: true,
'jest/globals': true,
"jest/globals": true,
},
extends: ['plugin:jest/recommended', 'prettier'],
extends: ["plugin:jest/recommended", "prettier"],
// @TODO: Remove all of these rules and adapt code!
rules: {
'jest/no-disabled-tests': 'off',
'jest/expect-expect': 'off',
'jest/no-conditional-expect': 'off',
'jest/valid-title': 'off',
'jest/no-jasmine-globals': 'off',
'jest/valid-expect-in-promise': 'off',
'jest/valid-expect': 'off',
'jest/no-alias-methods': 'off',
"jest/no-disabled-tests": "off",
"jest/expect-expect": "off",
"jest/no-conditional-expect": "off",
"jest/valid-title": "off",
"jest/no-jasmine-globals": "off",
"jest/valid-expect-in-promise": "off",
"jest/valid-expect": "off",
"jest/no-alias-methods": "off",
},
},
],
Expand Down
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ updates:
- dependencies
versioning-strategy: increase
rebase-strategy: disabled
groups:
production-dependencies:
dependency-type: "production"
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://prettier.io/docs/en/options.html

module.exports = {
plugins: ['./node_modules/prettier-plugin-jsdoc/dist/index.js'],
plugins: ["./node_modules/prettier-plugin-jsdoc/dist/index.js"],
// https://github.com/hosseinmd/prettier-plugin-jsdoc#tsdoc
tsdoc: true,
};
40 changes: 20 additions & 20 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
/** @type {import('jest').Config} */
/** @type {import("jest").Config} */
const config = {
rootDir: '.',
testMatch: ['<rootDir>/tests/**/*.ts?(x)'],
rootDir: ".",
testMatch: ["<rootDir>/tests/**/*.ts?(x)"],
verbose: true,
testPathIgnorePatterns: ['meilisearch-test-utils', 'env'],
testPathIgnorePatterns: ["meilisearch-test-utils", "env"],
collectCoverage: true,
coverageThreshold: {
global: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.json',
"ts-jest": {
tsConfig: "<rootDir>/tsconfig.json",
},
},
},
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname",
],
projects: [
{
preset: 'ts-jest',
displayName: 'browser',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/tests/**/*.ts?(x)'],
preset: "ts-jest",
displayName: "browser",
testEnvironment: "jsdom",
testMatch: ["<rootDir>/tests/**/*.ts?(x)"],
testPathIgnorePatterns: [
'meilisearch-test-utils',
'env/',
'token.test.ts',
"meilisearch-test-utils",
"env/",
"token.test.ts",
],
// make sure built-in Node.js fetch doesn't get replaced for consistency
globals: { fetch: global.fetch, AbortController: global.AbortController },
},
{
preset: 'ts-jest',
displayName: 'node',
testEnvironment: 'node',
testMatch: ['<rootDir>/tests/**/*.ts?(x)'],
testPathIgnorePatterns: ['meilisearch-test-utils', 'env/'],
preset: "ts-jest",
displayName: "node",
testEnvironment: "node",
testMatch: ["<rootDir>/tests/**/*.ts?(x)"],
testPathIgnorePatterns: ["meilisearch-test-utils", "env/"],
},
],
};
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "25.0.2",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "15.1.0",
"@rollup/plugin-commonjs": "28.0.0",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "15.3.0",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
Expand All @@ -94,16 +94,16 @@
"jest-watch-typeahead": "^2.2.2",
"kleur": "^4.1.5",
"lint-staged": "15.2.10",
"nodemon": "^2.0.16",
"nodemon": "^3.1.7",
"prettier": "^3.3.3",
"prettier-plugin-jsdoc": "^1.3.0",
"pretty-bytes": "^5.6.0",
"rollup": "^2.79.1",
"rollup": "^4.22.5",
"rollup-plugin-terser": "^7.0.0",
"rollup-plugin-typescript2": "^0.36.0",
"shx": "^0.3.2",
"ts-jest": "^29.2.5",
"typedoc": "^0.25.13",
"typedoc": "^0.26.7",
"typescript": "^5.4.5"
},
"packageManager": "yarn@1.22.22"
Expand Down
34 changes: 17 additions & 17 deletions playgrounds/javascript/src/app.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { MeiliSearch } from '../../../src';
import { MeiliSearch } from "../../../src";

const config = {
host: 'http://127.0.0.1:7700',
apiKey: 'masterKey',
host: "http://127.0.0.1:7700",
apiKey: "masterKey",
};

const client = new MeiliSearch(config);
const indexUid = 'movies';
const indexUid = "movies";

const addDataset = async () => {
await client.deleteIndex(indexUid);
Expand All @@ -16,16 +16,16 @@ const addDataset = async () => {
const documents = await client.index(indexUid).getDocuments();

const dataset = [
{ id: 1, title: 'Carol', genres: ['Romance', 'Drama'] },
{ id: 2, title: 'Wonder Woman', genres: ['Action', 'Adventure'] },
{ id: 3, title: 'Life of Pi', genres: ['Adventure', 'Drama'] },
{ id: 1, title: "Carol", genres: ["Romance", "Drama"] },
{ id: 2, title: "Wonder Woman", genres: ["Action", "Adventure"] },
{ id: 3, title: "Life of Pi", genres: ["Adventure", "Drama"] },
{
id: 4,
title: 'Mad Max: Fury Road',
genres: ['Adventure', 'Science Fiction'],
title: "Mad Max: Fury Road",
genres: ["Adventure", "Science Fiction"],
},
{ id: 5, title: 'Moana', genres: ['Fantasy', 'Action'] },
{ id: 6, title: 'Philadelphia', genres: ['Drama'] },
{ id: 5, title: "Moana", genres: ["Fantasy", "Action"] },
{ id: 6, title: "Philadelphia", genres: ["Drama"] },
];
if (documents.results.length === 0) {
const { taskUid } = await client.index(indexUid).addDocuments(dataset);
Expand All @@ -37,24 +37,24 @@ const addDataset = async () => {
try {
await addDataset();
const indexes = await client.getRawIndexes();
document.querySelector('.indexes').innerText = JSON.stringify(
document.querySelector(".indexes").innerText = JSON.stringify(
indexes,
null,
1,
);
const resp = await client.index(indexUid).search('', {
attributesToHighlight: ['title'],
const resp = await client.index(indexUid).search("", {
attributesToHighlight: ["title"],
});
console.log({ resp });
console.log({ hit: resp.hits[0] });
document.querySelector('.hits').innerText = JSON.stringify(
document.querySelector(".hits").innerText = JSON.stringify(
resp.hits.map((hit) => hit.title),
null,
1,
);
document.querySelector('.errors_title').style.display = 'none';
document.querySelector(".errors_title").style.display = "none";
} catch (e) {
console.error(e);
document.querySelector('.errors').innerText = JSON.stringify(e, null, 1);
document.querySelector(".errors").innerText = JSON.stringify(e, null, 1);
}
})();
Loading

0 comments on commit c5be7e2

Please sign in to comment.