Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a20aff8
Update to typescript
bidoubiwa Jan 31, 2021
c9ff2c2
Simplify typings
bidoubiwa Feb 2, 2021
79f3956
Remove useless ts env
bidoubiwa Feb 2, 2021
9cbdd7c
Remove test packages
bidoubiwa Feb 2, 2021
a02c00d
Add typescript node env
bidoubiwa Feb 2, 2021
f69698a
Fix js and html playgrounds
bidoubiwa Feb 2, 2021
597f4ff
Update lib in tsconfig
bidoubiwa Feb 2, 2021
fb38662
Finish typing of IM
bidoubiwa Feb 2, 2021
859b4f4
Update vue
bidoubiwa Feb 3, 2021
28345c3
Update react playground
bidoubiwa Feb 3, 2021
ce8440f
Update configuration and remove useless packages
bidoubiwa Feb 3, 2021
0f12cc7
Remove vue parcel config
bidoubiwa Feb 4, 2021
f08d14b
Change vue playground to typescript
bidoubiwa Feb 4, 2021
3c07bcf
Remove unecessary eslint files
bidoubiwa Feb 4, 2021
10f2c17
Update main eslint file
bidoubiwa Feb 4, 2021
23488c0
Update typescript linting
bidoubiwa Feb 4, 2021
db9a230
Fixes linting issues
bidoubiwa Feb 4, 2021
41dd810
Fixes react linting issues
bidoubiwa Feb 4, 2021
ed0f9d7
Rename react-parcel playground to react playground
bidoubiwa Feb 4, 2021
553ceed
Removed unused env
bidoubiwa Feb 4, 2021
b0b9a32
Update scripts and remove unecessary lines
bidoubiwa Feb 4, 2021
9709db9
Add automatic opener for playgrounds
bidoubiwa Feb 4, 2021
252ada1
Add node tests
bidoubiwa Feb 4, 2021
957cdb7
Add node tests to jest config
bidoubiwa Feb 4, 2021
b6ea92f
Add dom and node tests
bidoubiwa Feb 4, 2021
22bd286
Update types and config
bidoubiwa Feb 9, 2021
704040f
Update vue playground
bidoubiwa Feb 9, 2021
4dac1ab
Update express tests
bidoubiwa Feb 9, 2021
fd79bc2
Update package to build before env tests
bidoubiwa Feb 9, 2021
928d9cc
Add babel
bidoubiwa Feb 9, 2021
9010f67
Remove unecessary comment
bidoubiwa Feb 9, 2021
da8274f
Update method names to be more clear
bidoubiwa Feb 9, 2021
674bc28
Make playgrounds readme's up to date with changes
bidoubiwa Feb 9, 2021
0c04882
Add ts env to env tests
bidoubiwa Feb 9, 2021
3b59f2a
Remove unecessary package scripts
bidoubiwa Feb 9, 2021
c8bc06a
Clean and make consistent eslint
bidoubiwa Feb 10, 2021
bd90b5c
Improve types naming
bidoubiwa Feb 10, 2021
7435773
Fixes test:all in package.json
bidoubiwa Feb 10, 2021
adf0d18
Improve types naming
bidoubiwa Feb 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
node_modules
dist
examples
scripts
tests/env
build

# temporary fix
playgrounds/vanilla-js
.cache
219 changes: 160 additions & 59 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,165 @@
module.exports = {
env: {
browser: true,
es2020: true,
'jest/globals': true,
},
globals: {
page: true, // for jest/puppeteer tests in examples/express
browser: true, // for jest/puppeteer tests in examples/express
context: true, // for jest/puppeteer tests in examples/express
jestPuppeteer: true, // for jest/puppeteer tests in examples/express
},
extends: [
'standard',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
'prettier/@typescript-eslint',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: ['tsconfig.eslint.json'],
projectFolderIgnoreList: ['dist'],
},
plugins: ['jsdoc', '@typescript-eslint', 'prettier', 'jest'],
rules: {
'no-dupe-class-members': 'off', // Off due to conflict with typescript overload functions
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
'@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
'@typescript-eslint/return-await': 'off',
'jsdoc/check-alignment': 'error',
'jsdoc/check-indentation': 'error',
'@typescript-eslint/space-before-function-paren': 0,
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-throw-literal': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-module-boundary-types': 'off',
'@typescript-eslint/prefer-regexp-exec': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none', // 'none' or 'semi' or 'comma'
requireLast: true,
root: true,
overrides: [
{
/*
* REACT
*/
files: ['playgrounds/react/**/*.js'],
env: {
es2020: true,
commonjs: true, // Needed to avoid import is reserved error
node: true,
browser: true,
jest: true,
},
parser: 'babel-eslint',
extends: ['eslint:recommended', 'plugin:react/recommended'],
plugins: ['react', 'import', 'react-hooks'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
singleline: {
delimiter: 'semi', // 'semi' or 'comma'
requireLast: false,
ecmaVersion: 2020,
sourceType: 'module',
},
rules: {
'react/prop-types': 0,
},
settings: {
react: {
version: 'latest',
},
},
],
'comma-dangle': 'off',
},
},
{
/*
* JS
*/
files: ['**/*.js'],
env: {
browser: true,
es2020: true,
'jest/globals': true,
node: true,
},
globals: {
instantsearch: true,
instantMeiliSearch: true,
page: true, // for jest/puppeteer tests in examples/express
browser: true, // for jest/puppeteer tests in examples/express
context: true, // for jest/puppeteer tests in examples/express
jestPuppeteer: true, // for jest/puppeteer tests in examples/express
},
extends: [
'standard',
'plugin:prettier/recommended',
'eslint:recommended',
],
plugins: ['jest'],
parserOptions: {
ecmaVersion: 2020,
},
rules: {},
},
{
/*
* VUE FILES
*/

files: ['playgrounds/vue/**/*.vue'],
env: {
browser: true,
commonjs: true,
es6: true,
},
extends: [
'plugin:prettier/recommended',
'prettier/vue',
'plugin:vue/essential',
'plugin:vue/base',
],
parser: 'vue-eslint-parser',
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
plugins: ['vue', 'prettier', 'jsdoc'],
rules: {},
},
{
/*
* TYPESCRIPT
*/
files: ['*.ts'],
env: {
browser: true,
es2020: true,
'jest/globals': true,
},
globals: {
page: true, // for jest/puppeteer tests in examples/express
browser: true, // for jest/puppeteer tests in examples/express
context: true, // for jest/puppeteer tests in examples/express
jestPuppeteer: true, // for jest/puppeteer tests in examples/express
},
extends: [
'standard',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
'prettier/@typescript-eslint',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: ['tsconfig.eslint.json'],
projectFolderIgnoreList: ['dist'],
},

plugins: ['jsdoc', '@typescript-eslint', 'prettier', 'jest'],
rules: {
'@typescript-eslint/no-empty-interface': 'off', // Due to vue-instantsearch not having typings
'no-dupe-class-members': 'off', // Off due to conflict with typescript overload functions
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
'@typescript-eslint/array-type': ['warn', { default: 'array-simple' }],
'@typescript-eslint/return-await': 'off',
'jsdoc/check-alignment': 'error',
'jsdoc/check-indentation': 'error',
'@typescript-eslint/space-before-function-paren': 0,
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-throw-literal': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-module-boundary-types': 'off',
'@typescript-eslint/prefer-regexp-exec': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none', // 'none' or 'semi' or 'comma'
requireLast: true,
},
singleline: {
delimiter: 'semi', // 'semi' or 'comma'
requireLast: false,
},
},
],
'comma-dangle': 'off',
},
},
],
}
19 changes: 16 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
module.exports = {
verbose: true,
modulePathIgnorePatterns: ['<rootDir>/tests/env'],
testMatch: ['<rootDir>/tests/**/*.ts?(x)'],
preset: 'ts-jest',
projects: [
{
preset: 'ts-jest',
displayName: 'dom',
// We are using jest-environment-jsdom 25 until we stop supporting node 10
// jest-environment-jsdom 25 uses jsdom 15 which still supports node 10
testEnvironment: 'jest-environment-jsdom',
testPathIgnorePatterns: ['<rootDir>/tests/env/express'],
},
{
preset: 'ts-jest',
displayName: 'node',
testEnvironment: 'node',
testPathIgnorePatterns: ['<rootDir>/tests/env/express'],
},
],
}
24 changes: 14 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
"description": "The search client to use MeiliSearch with InstantSearch.",
"scripts": {
"cleanup": "shx rm -rf dist/",
"test": "jest",
"test:all": "yarn test && yarn test:env && test:playgrounds",
"test:env": "yarn build && yarn test:env:browser && yarn test:env:nodejs && yarn test:env:esm",
"test": "yarn build && jest",
"test:all": "yarn test && yarn test:env && yarn test:playgrounds",
"test:env": "yarn build && yarn test:env:browser && yarn test:env:nodejs && yarn test:env:esm && yarn test:env:ts",
"test:env:browser": "yarn --cwd tests/env/express && yarn --cwd tests/env/express test",
"test:env:nodejs": "node tests/env/node/index.js",
"test:env:esm": "yarn --cwd tests/env/esm && yarn --cwd tests/env/esm start",
"test:playgrounds": "yarn build && yarn build:playground:vue && yarn build:playground:react && yarn build:playground:javascript && yarn build:playground:html",
"test:env:ts": "yarn --cwd tests/env/typescript-node && yarn --cwd tests/env/typescript-node start",
"test:playgrounds": "yarn build:playground:vue && yarn build:playground:react && yarn build:playground:javascript && yarn build:playground:html",
"build:playground:vue": "yarn --cwd ./playgrounds/vue && yarn --cwd ./playgrounds/vue build",
"build:playground:react": "yarn --cwd ./playgrounds/react && yarn --cwd ./playgrounds/react build",
"build:playground:javascript": "yarn --cwd ./playgrounds/javascript && yarn --cwd ./playgrounds/javascript build",
Expand All @@ -23,9 +24,9 @@
"postbuild": "yarn typingsheader",
"typingsheader": "node scripts/build.js",
"build": "yarn cleanup && rollup -c rollup.config.js && rollup --environment NODE_ENV:production -c rollup.config.js ",
"dev": "rollup -c rollup.config.js --watch",
"lint": "eslint --ext .js,.ts,.tsx,.vue .",
"lint:fix": "eslint --ext .js,.ts,.tsx,.vue --fix .",

"lint:fix": "eslint --ext .js,.ts,.tsx,.vue --fix ."
},
"main": "./dist/instant-meilisearch.umd.js",
"module": "./dist/instant-meilisearch.esm.js",
Expand Down Expand Up @@ -59,18 +60,19 @@
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.0.0",
"@babel/core": "^7.0.0-0",
"@babel/preset-env": "^7.10.4",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^4.14.0",
"@vue/eslint-config-typescript": "^7.0.0",
"@vue/eslint-plugin": "^4.2.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.1.0",
"cssnano": "^4.1.10",
"eslint": "^7.19.0",
"eslint-config-prettier": "^7.2.0",
"eslint-config-react-app": "^6.0.0",
"eslint-config-standard": "^16.0.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.0",
Expand All @@ -80,11 +82,13 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.5.0",
"jest": "^26.1.0",
"instantsearch.js": "^4.14.0",
"jest": "^26.6.3",
"jest-environment-jsdom": "25.5",
"jest-watch-typeahead": "^0.6.0",
"prettier": "^2.0.0",
"regenerator-runtime": "^0.13.7",
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/html/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ yarn install

### Compile and hot-reload for development
```
yarn serve
yarn start
```

### Compile and minify for production
Expand Down
1 change: 0 additions & 1 deletion playgrounds/html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "parcel serve ./public/index.html --global instantMeiliSearch --open",
"build": "parcel build ./public/index.html --global instantMeiliSearch"
},
Expand Down
2 changes: 1 addition & 1 deletion playgrounds/html/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
To use this browser build, please change the following script tag with this CDN
<script src="https://cdn.jsdelivr.net/npm/@meilisearch/instant-meilisearch/dist/instant-meilisearch.umd.min.js"></script>
-->
<script src="../../../src/index.js"></script>
<script src="../../../src/index.ts"></script>
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
<script>
// This is due to parcel not accepting globals on html files.
Expand Down
6 changes: 0 additions & 6 deletions playgrounds/javascript/.eslintrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions playgrounds/react/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-react"],
"plugins": ["@babel/plugin-syntax-jsx"]
}
1 change: 0 additions & 1 deletion playgrounds/react/.env

This file was deleted.

2 changes: 2 additions & 0 deletions playgrounds/react/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.cache/
Loading