Skip to content

Commit

Permalink
Merge fc4e0af into d9cd884
Browse files Browse the repository at this point in the history
  • Loading branch information
hartzis committed Jul 18, 2020
2 parents d9cd884 + fc4e0af commit 19c2858
Show file tree
Hide file tree
Showing 23 changed files with 1,218 additions and 1,289 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
lib
examples
54 changes: 22 additions & 32 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,41 +1,31 @@
{
"parser": "babel-eslint",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.all.json"
},
"extends": [
"eslint:recommended",
"plugin:import/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
"prettier",
"prettier/@typescript-eslint"
],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
"plugins": ["@typescript-eslint", "react-hooks"],
"settings": {
"react": {
"version": "detect"
}
},
"env": {
"browser": true,
"mocha": true,
"node": true
},
"rules": {
"prettier/prettier": [
"error",
{
"singleQuote": true,
"semi": false,
"printWidth": 100
}
],
"valid-jsdoc": 2,
"react/jsx-uses-react": 1,
"react/jsx-no-undef": 2,
"react/jsx-wrap-multilines": 2,
"react/no-string-refs": 0,
"react/prop-types": 0,
"react-hooks/rules-of-hooks": 2,
"react-hooks/exhaustive-deps": 1
},
"plugins": ["import", "react", "react-hooks"]
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "_" }],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"react/no-unescaped-entities": "off",
"react/prop-types": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
TODO
*.log
.DS_Store
lib
dist
examples/static
coverage
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package.json
node_modules
/lib
/dist
/coverage
/examples
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
19 changes: 19 additions & 0 deletions __tests__/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {MockedSwipeFunctions} from '../useSwipeable.spec';

const expectSwipingDir = (fns: jest.Mock, dir: string) => {
fns.mock.calls.forEach((call) => {
expect(call[0].dir).toBe(dir);
});
};

export const expectSwipeFuncsDir = (sf: MockedSwipeFunctions, dir: string): void => {
Object.keys(sf).forEach((s) => {
if (s.endsWith(dir) || s === "onSwiped") {
expect(sf[s as keyof MockedSwipeFunctions]).toHaveBeenCalled();
} else if (s === "onSwiping") {
expectSwipingDir(sf[s], dir);
} else {
expect(sf[s as keyof MockedSwipeFunctions]).not.toHaveBeenCalled();
}
});
}

0 comments on commit 19c2858

Please sign in to comment.