{"name":"@putout/plugin-declare","version":"6.0.0","keywords":["putout","putout-plugin","plugin","declare-undefined-variables"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"@putout/plugin-declare@6.0.0","maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"homepage":"https://github.com/coderaiser/putout/tree/master/packages/plugin-declare#readme","bugs":{"url":"https://github.com/coderaiser/putout/issues"},"tag":false,"dist":{"shasum":"c102bbf3fefee577f03e0f90c82308dd20e90edf","tarball":"http://registry-npm.ywwl.com/@putout/plugin-declare/download/@putout/plugin-declare-6.0.0.tgz","fileCount":8,"integrity":"sha512-k3AhfgzxSl85kEx8SC/v4t0Sy9ciTj+7lZ2KyWQ0JGP8//j1g/oV9u+ef7sgcCePoWlPnNqzRt6Wp9SGuqgcLg==","signatures":[{"sig":"MEYCIQD44KlgrQEf7Pn2pZA3gLN13aXk5jCBh1z7L9aOMl1NTwIhAOTzCQOqsUvNy+JXqmsEPyBDWD/nwsu6SQDt5g6hSA5B","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8335,"size":3122,"noattachment":false,"key":"/@putout/plugin-declare/-/@putout/plugin-declare-6.0.0.tgz"},"main":"lib/index.js","type":"module","engines":{"node":">=20"},"gitHead":"e418c2ef86af79a89849a987a5cb720ce433cc4f","release":false,"scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","coverage":"madrun coverage","fix:lint":"madrun fix:lint","fresh:lint":"madrun fresh:lint","lint:fresh":"madrun lint:fresh","watch:test":"madrun watch:test"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"changelog":false,"repository":{"url":"git+https://github.com/coderaiser/putout.git","type":"git"},"_npmVersion":"11.4.2","description":"🐊Putout plugin adds ability to declare variables","directories":{},"_nodeVersion":"24.8.0","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","eslint":"^9.0.0","madrun":"^11.0.0","montag":"^1.2.1","nodemon":"^3.0.1","supertape":"^11.0.3","@putout/test":"^14.0.0","eslint-plugin-n":"^17.0.0","@putout/eslint-flat":"^3.0.0","eslint-plugin-putout":"^28.0.0","@putout/plugin-strict-mode":"*","@putout/plugin-remove-unused-expressions":"*"},"peerDependencies":{"putout":">=40"},"_npmOperationalInternal":{"tmp":"tmp/plugin-declare_6.0.0_1757877008149_0.6261872200964165","host":"s3://npm-registry-packages-npm-production"},"readme":"# @putout/plugin-declare [![NPM version][NPMIMGURL]][NPMURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/@putout/plugin-declare.svg?style=flat&longCache=true\n[NPMURL]: https://npmjs.org/package/@putout/plugin-declare \"npm\"\n\n🐊[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to declare variable that was not defined before, including:\n\n- [maybe](https://github.com/coderaiser/putout/tree/master/packages/plugin-maybe#readme): `maybeArray`, `maybeFn`, `maybeEmptyArray`;\n- wrap: `not`,`id`, `returns`, `callWith`;\n- set: `difference`;\n- fresh-import: `freshImport`, `freshImportDefault`;\n- `fixtures`: `readFixture`;\n- properties of `Object`;\n- properties of `String` + `addQuotes`;\n- [wraptile](https://github.com/coderaiser/wraptile);\n- [fullstore](https://github.com/coderaiser/fullstore);\n- [currify](https://github.com/coderaiser/currify);\n- [pipe-io](https://github.com/coderaiser/pipe-io);\n- [pullout](https://github.com/coderaiser/pullout);\n- [wait](https://github.com/iocmd/wait);\n- [chalk](https://www.npmjs.com/package/chalk);\n- [jessy](https://www.npmjs.com/package/jessy);\n- [nessy](https://www.npmjs.com/package/nessy);\n- [rendy](https://www.npmjs.com/package/rendy);\n- [table](https://www.npmjs.com/package/table);\n\n## Install\n\n```\nnpm i putout @putout/plugin-declare -D\n```\n\nAdd `.putout.json` with:\n\n```json\n{\n    \"plugins\": {\n        \"declare\": \"on\"\n    }\n}\n```\n\n## Rules\n\nUse options:\n\n- ✅ `dismiss` for variables you don't want to declare;\n- ✅ `declarations` to declare variables;\n\n```json\n{\n    \"rules\": {\n        \"declare\": [\"on\", {\n            \"declarations\": {\n                \"hello\": \"import {hello} from 'world'\"\n            },\n            \"dismiss\": [\n                \"assert\",\n                \"entries\",\n                \"parse\",\n                \"stringify\",\n                \"defineProperty\",\n                \"noop\",\n                \"join\",\n                \"keys\",\n                \"values\",\n                \"stopAll\",\n                \"once\",\n                \"putout\"\n            ]\n        }]\n    }\n}\n```\n\n## `assign`\n\n### ❌ Example of incorrect code\n\n```js\nconst hello = 'world';\nconst object = {};\n\nassign(object, {\n    hello,\n});\n```\n\n### ✅ Example of correct code\n\n```js\nconst hello = 'world';\nconst object = {};\nconst {assign} = Object;\n\nassign(object, {\n    hello,\n});\n```\n\n## `keys`\n\n### ❌ Example of incorrect code\n\n```js\nconst hello = 'world';\nconst object = {};\n\nconst allKeys = keys(object);\n```\n\n### ✅ Example of correct code\n\n```js\nconst hello = 'world';\nconst object = {};\nconst {keys} = Object;\n\nconst allKeys = keys(object);\n```\n\n## `values`\n\n### ❌ Example of incorrect code\n\n```js\nconst object = {};\nconst allValues = values(object);\n```\n\n## ✅ Example of correct code\n\n```js\nconst {values} = Object;\n\nconst object = {};\nconst allValues = values(object);\n```\n\n## `noop`\n\n### ❌ Example of incorrect code\n\n```js\nnoop();\n```\n\n### ✅ Example of correct code\n\n```js\nconst noop = () => {};\nnoop();\n```\n\n## Types\n\n### ❌ Example of incorrect code\n\n```js\nconst isFn = (a) => typeof a === 'function';\n\nif (isFn(fn))\n    fn();\n```\n\n### ✅ Example of correct code\n\n```js\nconst isFn = (a) => typeof a === 'function';\n\nif (isFn(fn))\n    fn();\n```\n\n## Maybe\n\n### ❌ Example of incorrect code\n\n```js\nconst a = maybeArray(b);\n```\n\n### ✅ Example of correct code\n\n```js\nconst {isArray} = Array;\nconst maybeArray = (a) => isArray(a) ? a : [a];\n\nconst a = maybeArray(b);\n```\n\n## `entries`\n\n### ❌ Example of incorrect code\n\n```js\nentries([1, 2, 3]);\n```\n\n### ✅ Example of correct code\n\n```js\nconst {entries} = Object;\n\nentries([1, 2, 3]);\n```\n\n## `fromEntries`\n\n### ❌ Example of incorrect code\n\n```js\nfromEntries(['hello', 'world']);\n```\n\n### ✅ Example of correct code\n\n```js\nconst {fromEntries} = Object;\n\nfromEntries(['hello', 'world']);\n```\n\n## `fromCharCode`\n\n### ❌ Example of incorrect code\n\n```js\nconst encoded = new TextEncoder().encode(str);\nfromCharCode(...encoded);\n```\n\n### ✅ Example of correct code\n\n```js\nconst {fromCharCode} = String;\nconst encoded = new TextEncoder().encode(str);\n\nfromCharCode(...encoded);\n```\n\n## License\n\nMIT\n","publish_time":1757877008343,"_cnpm_publish_time":1757877008343,"dist-tags":{"latest":"8.4.0"}}