├── .babelrc ├── src ├── index.ts ├── validator.ts └── validator.spec.ts ├── .eslintignore ├── .prettierrc ├── config └── test │ └── jest.json ├── .editorconfig ├── .gitignore ├── typings └── index.d.ts ├── examples ├── ts │ ├── tsconfig.json │ ├── index.html │ ├── package.json │ ├── readme.md │ └── src │ │ └── index.ts └── js │ ├── index.html │ ├── package.json │ ├── readme.md │ └── src │ └── index.js ├── .circleci └── config.yml ├── .eslintrc.js ├── tsconfig.json ├── .vscode └── launch.json ├── LICENSE ├── rollup.config.js ├── README.md └── package.json /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"] 3 | } 4 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import * as bic from './validator'; 2 | 3 | export { bic }; 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .rpt2_cache 3 | .vscode 4 | config 5 | dist 6 | *.spec.ts 7 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "es5", 4 | "endOfLine": "auto" 5 | } 6 | -------------------------------------------------------------------------------- /config/test/jest.json: -------------------------------------------------------------------------------- 1 | { 2 | "rootDir": "../../", 3 | "preset": "ts-jest", 4 | "restoreMocks": true 5 | } 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | dist/ 4 | *.orig 5 | .idea/ 6 | */src/**/*.js.map 7 | *.log 8 | package-lock.json 9 | coverage/ 10 | .awcache/ 11 | .rpt2_cache 12 | react-app-env.d.ts 13 | .cache 14 | -------------------------------------------------------------------------------- /typings/index.d.ts: -------------------------------------------------------------------------------- 1 | import { FieldValidationFunctionSync } from '@lemoncode/fonk'; 2 | 3 | export namespace bic { 4 | export const validator: FieldValidationFunctionSync; 5 | export function setErrorMessage(message: string | string[]): void; 6 | } 7 | -------------------------------------------------------------------------------- /examples/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "jsx": "preserve", 5 | "esModuleInterop": true, 6 | "sourceMap": true, 7 | "allowJs": true, 8 | "lib": ["es6", "dom"], 9 | "rootDir": "src", 10 | "moduleResolution": "node" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | fonk-bic-validator, javascript example 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/ts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | fonk-bic-validator, typescript example 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | working_directory: ~/test-ci-code 5 | docker: 6 | - image: circleci/node:10 7 | steps: 8 | - checkout 9 | - run: 10 | name: install 11 | command: 'npm install' 12 | - run: 13 | name: validate 14 | command: 'npm run validate' 15 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', 3 | extends: [ 4 | 'plugin:@typescript-eslint/recommended', 5 | 'prettier/@typescript-eslint', 6 | 'plugin:prettier/recommended', 7 | ], 8 | plugins: ['@typescript-eslint', 'prettier'], 9 | rules: { 10 | '@typescript-eslint/no-explicit-any': 'off', 11 | '@typescript-eslint/explicit-function-return-type': 'off', 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "es6", 5 | "moduleResolution": "node", 6 | "declaration": false, 7 | "noImplicitAny": false, 8 | "sourceMap": true, 9 | "jsx": "react", 10 | "noLib": false, 11 | "allowJs": true, 12 | "suppressImplicitAnyIndexErrors": true, 13 | "skipLibCheck": true, 14 | "esModuleInterop": true 15 | }, 16 | "include": ["./src/**/*"] 17 | } 18 | -------------------------------------------------------------------------------- /examples/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fonk-bic-validator-js-example", 3 | "version": "1.0.0", 4 | "description": "fonk-bic-validator, javascript example", 5 | "main": "index.html", 6 | "scripts": { 7 | "start": "parcel index.html --open" 8 | }, 9 | "dependencies": { 10 | "@lemoncode/fonk": "latest", 11 | "@lemoncode/fonk-bic-validator": "latest" 12 | }, 13 | "devDependencies": { 14 | "@babel/core": "^7.6.0", 15 | "parcel-bundler": "^1.6.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fonk-bic-validator-ts-example", 3 | "version": "1.0.0", 4 | "description": "fonk-bic-validator, typescript example", 5 | "main": "index.html", 6 | "scripts": { 7 | "start": "parcel index.html --open" 8 | }, 9 | "dependencies": { 10 | "@lemoncode/fonk": "latest", 11 | "@lemoncode/fonk-bic-validator": "latest" 12 | }, 13 | "devDependencies": { 14 | "@babel/core": "^7.6.0", 15 | "parcel-bundler": "^1.6.1" 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "node", 6 | "request": "launch", 7 | "name": "Jest selected file", 8 | "program": "${workspaceRoot}/node_modules/jest/bin/jest.js", 9 | "args": [ 10 | "${fileBasenameNoExtension}", 11 | "-c", 12 | "./config/test/jest.json", 13 | "--verbose", 14 | "-i", 15 | "--no-cache", 16 | "--watchAll" 17 | ], 18 | "console": "integratedTerminal", 19 | "internalConsoleOptions": "neverOpen" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /examples/js/readme.md: -------------------------------------------------------------------------------- 1 | # fonk-bic-validator example 2 | 3 | Example using `fonk-bic-validator`. 4 | 5 | [![See fonk-bic-validator example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/lemoncode/fonk-bic-validator/tree/master/examples/js) 6 | 7 | # About Basefactor + Lemoncode 8 | 9 | We are an innovating team of Javascript experts, passionate about turning your ideas into robust products. 10 | 11 | [Basefactor, consultancy by Lemoncode](http://www.basefactor.com) provides consultancy and coaching services. 12 | 13 | [Lemoncode](http://lemoncode.net/services/en/#en-home) provides training services. 14 | 15 | For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend 16 | -------------------------------------------------------------------------------- /examples/ts/readme.md: -------------------------------------------------------------------------------- 1 | # fonk-bic-validator example 2 | 3 | Example using `fonk-bic-validator`. 4 | 5 | [![See fonk-bic-validator example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/lemoncode/fonk-bic-validator/tree/master/examples/ts) 6 | 7 | # About Basefactor + Lemoncode 8 | 9 | We are an innovating team of Javascript experts, passionate about turning your ideas into robust products. 10 | 11 | [Basefactor, consultancy by Lemoncode](http://www.basefactor.com) provides consultancy and coaching services. 12 | 13 | [Lemoncode](http://lemoncode.net/services/en/#en-home) provides training services. 14 | 15 | For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend 16 | -------------------------------------------------------------------------------- /src/validator.ts: -------------------------------------------------------------------------------- 1 | import { 2 | FieldValidationFunctionSync, 3 | parseMessageWithCustomArgs, 4 | } from '@lemoncode/fonk'; 5 | 6 | // TODO: Add validator type 7 | const VALIDATOR_TYPE = ''; 8 | 9 | // TODO: Add default message 10 | let defaultMessage = ''; 11 | export const setErrorMessage = message => (defaultMessage = message); 12 | 13 | const isDefined = value => value !== void 0 && value !== null && value !== ''; 14 | 15 | export const validator: FieldValidationFunctionSync = fieldValidatorArgs => { 16 | const { value, message = defaultMessage, customArgs } = fieldValidatorArgs; 17 | 18 | // TODO: Add validator 19 | const succeeded = !isDefined(value) || ...; 20 | 21 | return { 22 | succeeded, 23 | message: succeeded 24 | ? '' 25 | : // TODO: Use if it has custom args 26 | parseMessageWithCustomArgs( 27 | (message as string) || defaultMessage, 28 | customArgs 29 | ), 30 | type: VALIDATOR_TYPE, 31 | }; 32 | }; 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Lemoncode 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/js/src/index.js: -------------------------------------------------------------------------------- 1 | import { createFormValidation } from '@lemoncode/fonk'; 2 | import { bic } from '@lemoncode/fonk-bic-validator'; 3 | 4 | const validationSchema = { 5 | field: { 6 | myField: [bic.validator], 7 | }, 8 | }; 9 | 10 | const formValidation = createFormValidation(validationSchema); 11 | 12 | // TODO: Update example values 'test' and/or 10 if needed 13 | Promise.all([ 14 | formValidation.validateField('myField', 'test'), 15 | formValidation.validateField('myField', 10), 16 | ]).then(([failedResult, succeededResult]) => { 17 | document.getElementById('app').innerHTML = ` 18 |
19 |

Example with failed result:

20 | 21 |
22 |   formValidation.validateField('myField', 'test')
23 | 
24 | 25 |

Result:

26 |
27 | ${JSON.stringify(failedResult, null, 2)}
28 | 
29 |
30 | 31 |
32 |

Example with succeeded result:

33 | 34 |
35 | formValidation.validateField('myField', 10)
36 | 
37 | 38 |

Result:

39 |
40 | ${JSON.stringify(succeededResult, null, 2)}
41 | 
42 |
43 | `; 44 | }); 45 | -------------------------------------------------------------------------------- /examples/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ValidationSchema, 3 | createFormValidation, 4 | } from '@lemoncode/fonk'; 5 | import { bic } from '@lemoncode/fonk-bic-validator'; 6 | 7 | const validationSchema: ValidationSchema = { 8 | field: { 9 | myField: [bic.validator], 10 | }, 11 | }; 12 | 13 | const formValidation = createFormValidation(validationSchema); 14 | 15 | // TODO: Update example values 'test' and/or 10 if needed 16 | Promise.all([ 17 | formValidation.validateField('myField', 'test'), 18 | formValidation.validateField('myField', 10), 19 | ]).then(([failedResult, succeededResult]) => { 20 | document.getElementById('app').innerHTML = ` 21 |
22 |

Example with failed result:

23 | 24 |
25 |   formValidation.validateField('myField', 'test')
26 | 
27 | 28 |

Result:

29 |
30 | ${JSON.stringify(failedResult, null, 2)}
31 | 
32 |
33 | 34 |
35 |

Example with succeeded result:

36 | 37 |
38 | formValidation.validateField('myField', 10)
39 | 
40 | 41 |

Result:

42 |
43 | ${JSON.stringify(succeededResult, null, 2)}
44 | 
45 |
46 | `; 47 | }); 48 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import resolve from 'rollup-plugin-node-resolve'; 2 | import babel from 'rollup-plugin-babel'; 3 | import commonjs from 'rollup-plugin-commonjs'; 4 | import typescript from 'rollup-plugin-typescript2'; 5 | import { terser } from 'rollup-plugin-terser'; 6 | import { DEFAULT_EXTENSIONS } from '@babel/core'; 7 | import pkg from './package.json'; 8 | 9 | const builds = [ 10 | { format: 'esm', minify: false }, 11 | { format: 'cjs', minify: false }, 12 | { format: 'umd', minify: false }, 13 | { format: 'umd', minify: true }, 14 | ]; 15 | const extensions = [...DEFAULT_EXTENSIONS, '.ts']; 16 | 17 | export default builds.map(({ format, minify }) => { 18 | const minExtension = minify ? '.min' : ''; 19 | return { 20 | input: 'src/index.ts', 21 | output: { 22 | name: pkg.name, 23 | exports: 'named', 24 | file: `dist/${pkg.name}.${format}${minExtension}.js`, 25 | format, 26 | globals: { 27 | '@lemoncode/fonk': 'Fonk', 28 | }, // Necessary for externals libraries and umd format 29 | }, 30 | external: Object.keys(pkg.peerDependencies || {}), 31 | plugins: [ 32 | resolve(), 33 | commonjs(), 34 | typescript({ 35 | tsconfig: 'tsconfig.json', 36 | rollupCommonJSResolveHack: true, // To be compatible with commonjs plugin 37 | }), 38 | babel({ 39 | extensions, 40 | exclude: 'node_modules/**', 41 | }), 42 | minify ? terser() : null, 43 | ], 44 | }; 45 | }); 46 | -------------------------------------------------------------------------------- /src/validator.spec.ts: -------------------------------------------------------------------------------- 1 | import { validator, setErrorMessage } from './validator'; 2 | 3 | // TODO: Add specs 4 | describe('fonk-bic-validator specs', () => { 5 | it('should return succeeded validation when it feeds value equals undefined', () => { 6 | // Arrange 7 | const value = void 0; 8 | 9 | // Act 10 | const result = validator({ value }); 11 | 12 | // Assert 13 | expect(result).toEqual({ 14 | succeeded: true, 15 | message: '', 16 | type: '', 17 | }); 18 | }); 19 | 20 | it('should return succeeded validation when it feeds value equals null', () => { 21 | // Arrange 22 | const value = null; 23 | 24 | // Act 25 | const result = validator({ value }); 26 | 27 | // Assert 28 | expect(result).toEqual({ 29 | succeeded: true, 30 | message: '', 31 | type: '', 32 | }); 33 | }); 34 | 35 | it('should return succeeded validation when it feeds value equals empty string', () => { 36 | // Arrange 37 | const value = ''; 38 | 39 | // Act 40 | const result = validator({ value }); 41 | 42 | // Assert 43 | expect(result).toEqual({ 44 | succeeded: true, 45 | message: '', 46 | type: '', 47 | }); 48 | }); 49 | 50 | it('should overwrite default message when it feeds value and message', () => { 51 | // Arrange 52 | const value = 'test'; 53 | const message = 'other message'; 54 | 55 | // Act 56 | const result = validator({ value, message }); 57 | 58 | // Assert 59 | expect(result).toEqual({ 60 | succeeded: false, 61 | message: 'other message', 62 | type: '', 63 | }); 64 | }); 65 | 66 | it('should overwrite default message when it feeds value and calls to setErrorMessage', () => { 67 | // Arrange 68 | const value = 'test'; 69 | 70 | setErrorMessage('other message'); 71 | 72 | // Act 73 | const result = validator({ value }); 74 | 75 | // Assert 76 | expect(result).toEqual({ 77 | succeeded: false, 78 | message: 'other message', 79 | type: '', 80 | }); 81 | }); 82 | }); 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fonk-bic-validator 2 | 3 | [![CircleCI](https://badgen.net/github/status/Lemoncode/fonk-bic-validator/master?icon=circleci&label=circleci)](https://circleci.com/gh/Lemoncode/fonk-bic-validator/tree/master) 4 | [![NPM Version](https://badgen.net/npm/v/@lemoncode/fonk-bic-validator?icon=npm&label=npm)](https://www.npmjs.com/package/@lemoncode/fonk-bic-validator) 5 | [![bundle-size](https://badgen.net/bundlephobia/min/@lemoncode/fonk-bic-validator)](https://bundlephobia.com/result?p=@lemoncode/fonk-bic-validator) 6 | 7 | This is a [fonk](https://github.com/Lemoncode/fonk) microlibrary that brings validation capabilities to: 8 | 9 | // TODO: Update description and example. 10 | 11 | - Validate if a field of a form .... 12 | 13 | How to install it: 14 | 15 | ```bash 16 | npm install @lemoncode/fonk-bic-validator --save 17 | ``` 18 | 19 | How to add it to an existing form validation schema: 20 | 21 | We have the following form model: 22 | 23 | ``` 24 | const myFormValues = { 25 | product: 'shoes', 26 | price: 20, 27 | } 28 | ``` 29 | 30 | We can add a bic validation to the myFormValues 31 | 32 | ```javascript 33 | import { bic } from '@lemoncode/fonk-bic-validator'; 34 | 35 | const validationSchema = { 36 | field: { 37 | price: [bic.validator], 38 | }, 39 | }; 40 | ``` 41 | 42 | You can customize the error message displayed in two ways: 43 | 44 | - Globally, replace the default error message in all validationSchemas (e.g. porting to spanish): 45 | 46 | ```javascript 47 | import { bic } from '@lemoncode/fonk-bic-validator'; 48 | 49 | bic.setErrorMessage('El campo debe de ser numérico'); 50 | ``` 51 | 52 | - Locally just override the error message for this validationSchema: 53 | 54 | ```javascript 55 | import { bic } from '@lemoncode/fonk-bic-validator'; 56 | 57 | const validationSchema = { 58 | field: { 59 | price: [ 60 | { 61 | validator: bic.validator, 62 | message: 'Error message only updated for the validation schema', 63 | }, 64 | ], 65 | }, 66 | }; 67 | ``` 68 | 69 | Please, refer to [fonk](https://github.com/Lemoncode/fonk) to know more. 70 | 71 | ## License 72 | 73 | [MIT](./LICENSE) 74 | 75 | # About Basefactor + Lemoncode 76 | 77 | We are an innovating team of Javascript experts, passionate about turning your ideas into robust products. 78 | 79 | [Basefactor, consultancy by Lemoncode](http://www.basefactor.com) provides consultancy and coaching services. 80 | 81 | [Lemoncode](http://lemoncode.net/services/en/#en-home) provides training services. 82 | 83 | For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend 84 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@lemoncode/fonk-bic-validator", 3 | "version": "0.1.0", 4 | "description": "// TODO: Update description: This is a [fonk](https://github.com/Lemoncode/fonk) microlibrary that brings validation capabilities to validate if a field of a form ...", 5 | "main": "dist/@lemoncode/fonk-bic-validator.cjs.js", 6 | "module": "dist/@lemoncode/fonk-bic-validator.esm.js", 7 | "typings": "typings/index.d.ts", 8 | "files": [ 9 | "dist", 10 | "typings" 11 | ], 12 | "scripts": { 13 | "build": "npm run clean && rollup --config", 14 | "clean": "rimraf dist .rpt2_cache package-lock.json", 15 | "validate": "npm run lint && npm run build && npm run test && npm run test:size", 16 | "lint": "eslint src --ext .ts ", 17 | "lint:fix": "npm run lint -- --fix", 18 | "test": "jest -c ./config/test/jest.json --verbose", 19 | "test:watch": "jest -c ./config/test/jest.json --verbose --watchAll -i", 20 | "test:size": "bundlesize", 21 | "deploy": "npm run validate && np", 22 | "deploy:beta": "npm run validate && np --tag=beta --any-branch" 23 | }, 24 | "bundlesize": [ 25 | { 26 | "path": "./dist/**/*.js", 27 | "maxSize": "1kB" 28 | } 29 | ], 30 | "repository": { 31 | "type": "git", 32 | "url": "git+https://github.com/Lemoncode/fonk-bic-validator.git" 33 | }, 34 | "keywords": [ 35 | "bic", 36 | "validator", 37 | "fonk", 38 | "form validation", 39 | "validate", 40 | "sync validation" 41 | ], 42 | "author": "Lemoncode", 43 | "license": "MIT", 44 | "bugs": { 45 | "url": "https://github.com/Lemoncode/fonk-bic-validator/issues" 46 | }, 47 | "homepage": "https://github.com/Lemoncode/fonk-bic-validator#readme", 48 | "peerDependencies": { 49 | "@lemoncode/fonk": "latest" 50 | }, 51 | "devDependencies": { 52 | "@babel/cli": "^7.5.5", 53 | "@babel/core": "^7.5.5", 54 | "@babel/preset-env": "^7.5.5", 55 | "@lemoncode/fonk": "latest", 56 | "@types/jest": "^24.0.18", 57 | "@typescript-eslint/eslint-plugin": "^2.0.0", 58 | "@typescript-eslint/parser": "^2.0.0", 59 | "bundlesize": "0.18.0", 60 | "eslint": "^6.2.1", 61 | "eslint-config-prettier": "^6.1.0", 62 | "eslint-plugin-prettier": "^3.1.0", 63 | "husky": "^3.0.4", 64 | "jest": "^24.9.0", 65 | "lint-staged": "^9.2.3", 66 | "np": "^5.0.3", 67 | "prettier": "^1.18.2", 68 | "pretty-quick": "^1.11.1", 69 | "rimraf": "^3.0.0", 70 | "rollup": "^1.20.0", 71 | "rollup-plugin-babel": "^4.3.3", 72 | "rollup-plugin-commonjs": "^10.0.2", 73 | "rollup-plugin-node-resolve": "^5.2.0", 74 | "rollup-plugin-terser": "^5.1.1", 75 | "rollup-plugin-typescript2": "^0.22.1", 76 | "ts-jest": "^24.0.2", 77 | "typescript": "^3.5.3" 78 | }, 79 | "husky": { 80 | "hooks": { 81 | "pre-commit": "lint-staged" 82 | } 83 | }, 84 | "lint-staged": { 85 | "src/**/*.{ts,tsx}": [ 86 | "npm run lint:fix", 87 | "pretty-quick — staged", 88 | "git add" 89 | ] 90 | }, 91 | "publishConfig": { 92 | "registry": "https://registry.npmjs.org/", 93 | "access": "public" 94 | } 95 | } 96 | --------------------------------------------------------------------------------