{"_id":"@duvholt/tslint-yield","_rev":"2-27a6dc561b1995ab390192da159a6bad","name":"@duvholt/tslint-yield","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@duvholt/tslint-yield","version":"0.0.1","description":"TSLint rule that requires a strict return type for Yield Expressions when result is used.","main":"tslint-base.json","publishConfig":{"access":"public"},"scripts":{"build":"tsc --p tsconfig.json","clean":"rimraf dist","build:clean":"npm run clean && npm run build","test":"jest --config jest.config.json"},"repository":{"type":"git","url":"git+https://github.com/duvholt/tslint-yield.git"},"keywords":["ServiceTitan","tslint","typescript"],"author":{"name":"ServiceTitan"},"license":"Apache-2.0","bugs":{"url":"https://github.com/duvholt/tslint-yield/issues"},"homepage":"https://github.com/duvholt/tslint-yield#readme","devDependencies":{"@types/jest":"21.1.10","tslint":"^5.11.0","typescript":"^3.1.1","rimraf":"^2.6.1","jest":"22.4.4","ts-jest":"21.2.4","coveralls":"^3.0.2"},"peerDependencies":{"tslint":"^5.11.0","typescript":"^3.1.1"},"gitHead":"4b34dfcfb12a9a74612befdbd9df74f3097e4d1c","_id":"@duvholt/tslint-yield@0.0.1","_npmVersion":"6.5.0","_nodeVersion":"11.6.0","_npmUser":{"name":"duvholt","email":"christian@duvholt.net"},"dist":{"integrity":"sha512-pfeaJ+O8m4GbcdObnp8LELODRCjUQRTYvjF2mz9cqQcv/vWr4reW0PlY+eahlWXzbQFSCMW6OH28TSZD/M8jZw==","shasum":"8753c09c4b5c42f15405ab7a5577c935624d6d3b","tarball":"https://registry.npmjs.org/@duvholt/tslint-yield/-/tslint-yield-0.0.1.tgz","fileCount":9,"unpackedSize":20324,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcK+7hCRA9TVsSAnZWagAAwYkP/iP26YfTAD7ketXvCBlt\nuL3MjzMoGoJiO8O2qfyRFkjEYWCfKXzM2FVLUktDTh8ed2B3Qu3MNCOmXhT+\n3o7leP0mzwJUWhQFi0iN/J+jyWTkl4eE482ovnJ1z1Xgu3kCuT18Kmwx4TyD\nJo6uIn8odoTw9tg+mxPQAoGgxyaD/pEG0jZupg3vHIr93mK0lzxcFQKX30dL\n6l86BxVnlhykOCHh/zvgxuSTc3pegb8So2hge56BO1fmPsLukn/MrZ5M2Flr\n1ber0CtX/CCEDQGGqsBPtBRWV+zqWSIeWuD4sUpOhRN1Dt+7+sW6jV2SkjUD\nNGL1HhhEJZ96oprKpBNlvsNbQ+NE+vcp/8I+Oe922pFd0kKkKG02d57B+9eh\n03rtx1SbT/TmOxtuGRi7CHV8aeQxdM5qb339tsORJCfbEGclbn28g5n3nONw\n0h1Iwu1bdNTUiBPUqqzqV69WIZalCZ7v1drlnMnJAepm6Ml+727Rjm+rc2YQ\nGwWkZp6alwIwH0IgyzHw7ZhMGvPuriCU0Dv2Bs3ba/wH9GLp9NSOFQnDU0Ul\nUvAavHX78IDdnHk04hojDuqps1jmYEPhnC9t0puRDTzeYy2DlhF1yf2Ir/Fb\nK0qrrmu59JkTFu7lPJCIX8LtJh25v6ykt5RS2/oKj5W3TFX6QaJ+fSaldVCA\niNX6\r\n=GFYm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGB9idk8dxCPkglOnWnBTPIsKULLxilavxbZ8zTUdibcAiArnOe70ckG10eu5dDjAWuL6clpDVGNoe9wX/TtomnZCw=="}]},"maintainers":[{"name":"duvholt","email":"christian@duvholt.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tslint-yield_0.0.1_1546383073234_0.5109895110046845"},"_hasShrinkwrap":false},"0.0.2":{"name":"@duvholt/tslint-yield","version":"0.0.2","description":"TSLint rule that requires a strict return type for Yield Expressions when result is used.","main":"tslint-base.json","publishConfig":{"access":"public"},"scripts":{"build":"tsc --p tsconfig.json","clean":"rimraf dist","build:clean":"npm run clean && npm run build","test":"jest --config jest.config.json"},"repository":{"type":"git","url":"git+https://github.com/duvholt/tslint-yield.git"},"keywords":["ServiceTitan","tslint","typescript"],"author":{"name":"ServiceTitan"},"license":"Apache-2.0","bugs":{"url":"https://github.com/duvholt/tslint-yield/issues"},"homepage":"https://github.com/duvholt/tslint-yield#readme","devDependencies":{"@types/jest":"21.1.10","tslint":"^5.11.0","typescript":"^3.1.1","rimraf":"^2.6.1","jest":"22.4.4","ts-jest":"21.2.4","coveralls":"^3.0.2"},"peerDependencies":{"tslint":"^5.11.0","typescript":"^3.1.1"},"gitHead":"803d7738d3569c460486715e3dd1cfc4e3464b2e","_id":"@duvholt/tslint-yield@0.0.2","_npmVersion":"6.5.0","_nodeVersion":"11.6.0","_npmUser":{"name":"duvholt","email":"christian@duvholt.net"},"dist":{"integrity":"sha512-Sj8vwIo6RSu1e7o6uVnetyGNix/XvnlQTfTg2IEngKFIx0Eee+kvHb/b1e+pHcYY/RBdB6shgwQL7yw1pHEUWg==","shasum":"06616aa2dd329c3b8006edb49a082f22128d0602","tarball":"https://registry.npmjs.org/@duvholt/tslint-yield/-/tslint-yield-0.0.2.tgz","fileCount":9,"unpackedSize":20539,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcK/BiCRA9TVsSAnZWagAAl5IP+QDTL6hpvCYirRbyaWFe\nY6fQ3BQx4RfaT8WPxx8H+B5nLeRnQl1VVMTIdQnNbPtHsKoV+c2MJSmtFZoy\nPojk0n+AdRJXB9rfNqrBwbtYUt+JC7gv7+2zHuwQEyeWTQQMI6Y3xbTQxBJw\nFVOoeLYtZwZZwBY7mL/pHvVx0jluej4FrgS6hJOVD6rIg/xLtRHBZZ0vSl5L\nWzyx5B52vDsYmgeRHd408g8Ft5i4tjSrqrLGzo+wgJuTEBRahpnotge5tnki\n+AFjk2q/gf059D6zd76UDoeGCpzstyKUpiDWMHzgecTDs2CvHTJmRkFxNJPf\nHVdokuBAdybR9FmRIt8SB+L5p9I0hh5Gs6g3dM2d25yduxwg4kNdG+KB3Yxd\no6E3YiJ3N2OmbEcpZgpfvDRsYr4oT2ADooa4uenU9b0dzth2WkFmgJ7ew0Jk\n6eH9i/K+pNStPDg6JIK/VgNRqRRtzmtUJZVZRRxesVeT8GMfe5FeCH2TIMKt\n0mhkIB7XSgzbsbGsrxVD+9Ns2LUdlHdXW003IvsS7iXMAcBF5WZfA6Bf3rQf\n5Hrm/RTaSTHFUGg5WFkVgfXUB0ieY8/zbQThRkzmlz4d0uUsik8dSBX1EI8s\niTi/gpEivuLqBZsc1jLyCyQY5qxif2D1XFOh+Qe1J79nCvdAad1XnTaOfRog\neNTN\r\n=YJ57\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICoADuywISwXeRPnNe9mvP+/XSeJ/AqeQwQaHhwDR3MpAiBGpCKHshDwBmwJ8HaVp4hIpYRsPywn6hX4Da2Smh8j1w=="}]},"maintainers":[{"name":"duvholt","email":"christian@duvholt.net"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tslint-yield_0.0.2_1546383457895_0.2901957055331901"},"_hasShrinkwrap":false}},"time":{"created":"2019-01-01T22:51:13.057Z","0.0.1":"2019-01-01T22:51:13.357Z","modified":"2022-04-05T06:09:39.245Z","0.0.2":"2019-01-01T22:57:38.029Z"},"maintainers":[{"name":"duvholt","email":"christian@duvholt.net"}],"description":"TSLint rule that requires a strict return type for Yield Expressions when result is used.","homepage":"https://github.com/duvholt/tslint-yield#readme","keywords":["ServiceTitan","tslint","typescript"],"repository":{"type":"git","url":"git+https://github.com/duvholt/tslint-yield.git"},"author":{"name":"ServiceTitan"},"bugs":{"url":"https://github.com/duvholt/tslint-yield/issues"},"license":"Apache-2.0","readme":"[![npm version](https://badge.fury.io/js/%40servicetitan%2Ftslint-yield.svg)](https://badge.fury.io/js/%40servicetitan%2Ftslint-yield)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Build Status](https://travis-ci.org/servicetitan/tslint-yield.svg?branch=master)](https://travis-ci.org/servicetitan/tslint-yield)\n[![Coverage Status](https://coveralls.io/repos/github/servicetitan/tslint-yield/badge.svg?branch=master)](https://coveralls.io/github/servicetitan/tslint-yield?branch=master)\n\nYield Rule\n======\n\nLint rule that requires a strict return type for Yield Expressions when result is used for [TSLint](https://github.com/palantir/tslint/).\n\n\n### Usage\n\ntslint-yield has peer dependencies on TSLint and TypeScript.\n\nTo use these lint rule with the default preset, use configuration inheritance via the `extends` keyword.\nHere's a sample configuration where `tslint.json` lives adjacent to your `node_modules` folder:\n\n```js\n{\n  \"extends\": [\"@servicetitan/tslint-yield\"],\n  \"rules\": {\n    // turn on tslint-yield rule here\n    \"yield\": true\n  }\n}\n```\n\nTo lint your `.ts` **and** `.tsx` files you can simply run `tslint -c tslint.json 'src/**/*.{ts,tsx}'`.\n\n### Rule\n\nrequires a strict return type for Yield Expressions when result is used in cases:\n \n##### Property Access Expressions\n```ts\n//Fail\n(yield getData()).result;\n\n//Good\n((yield getData()) as ResultType).result;\n```\n##### Variable Statement\n```ts\n//Fail\nvar result = yield getData();\n\n//Good\nvar result = (yield getData()) as ResultType;\n```\n##### Binary Expression\n```ts\n//Fail\nvar result = null;\nresult = yield getData();\n\n//Good\nvar result = null;\nresult = (yield getData()) as ResultType;\n```\n```ts\n//Fail\nvar result = { data: null };\nresult.data = yield getData();\n\n//Good\nvar result = { data: null };\nresult.data = (yield getData()) as ResultType;\n```\n##### Any is not allowed\n```ts\n//Fail\n(yield getData()) as any).result\n\n//Good\n((yield getData()) as ResultType).result;\n```\n##### Yield Type and casting type should be equal\n```ts\nconst getData = () => new Promise<number>(() => {});\n\n//Fail - string !== number\n(yield getData()) as string).result\n\n//Good\n((yield getData()) as number).result;\n```\n##### Yield Type should be Promise\n```ts\nconst getData = () => new Promise<number>(() => {});\n\n//Fail\nlet result = (yield number) as number)\n\n//Good\nlet result = ((yield getData()) as number);\n```","readmeFilename":"README.md"}