Skip to content

Commit

Permalink
Merge #1696
Browse files Browse the repository at this point in the history
1696: Remove `.editorconfig` r=curquiza a=flevi29

# Pull Request

## Why?
`.editorconfig` was added on the very first commit of this repository, but since then `prettier` has replaced it. Except it wasn't removed. There's no point in having multiple configurations for formatting. Related #1659, in which I wanted to remove all custom options, but didn't know why things still didn't work as they should, and now I know that `prettier` also takes `.editorconfig` into consideration.

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: F. Levi <[email protected]>
  • Loading branch information
meili-bors[bot] and flevi29 authored Oct 2, 2024
2 parents 7699115 + 96ad083 commit 0204a2d
Show file tree
Hide file tree
Showing 63 changed files with 2,200 additions and 2,222 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
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
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 0204a2d

Please sign in to comment.