{"name":"samadhi","version":"3.0.2","keywords":["linter","js"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"samadhi@3.0.2","maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"homepage":"http://github.com/coderaiser/samadhi","bugs":{"url":"https://github.com/coderaiser/samadhi/issues"},"dist":{"shasum":"fb76abcc1da74cde4ff0fa83f1a95354411db39b","tarball":"http://registry-npm.ywwl.com/samadhi/download/samadhi-3.0.2.tgz","fileCount":7,"integrity":"sha512-1Pfi76K57pn4oJouv100+7rM/qSqpX3ca8mVxLkg9EZF866AvQy0cDKt7nEbr2UsjYbT6Cq425V6M2hlL1KQfA==","signatures":[{"sig":"MEYCIQDy1Dr5GOaOadB8pSrCPp26/5xULLV0Ywx5hrywmpbfEAIhANQXoHY4w05WZLYJjoTR0kexhxE42uGqgSbb8TYr/WF0","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11152,"size":4317,"noattachment":false,"key":"/samadhi/-/samadhi-3.0.2.tgz"},"main":"lib/samadhi.js","type":"module","engines":{"node":">=20"},"gitHead":"3a1aa9844c8ea5428510f4d0bc03d8cae9bcfcb7","scripts":{"lint":"madrun lint","test":"madrun test","report":"madrun report","watcher":"madrun watcher","coverage":"madrun coverage","fix:lint":"madrun fix:lint","watch:lint":"madrun watch:lint","watch:test":"madrun watch:test","update:dist":"madrun update:dist"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"repository":{"url":"git+https://github.com/coderaiser/samadhi.git","type":"git"},"_npmVersion":"11.1.0","description":"Linter that fixes syntax errors","directories":{},"_nodeVersion":"20.19.0","dependencies":{"flatlint":"^2.0.0","goldstein":"^6.0.0","try-catch":"^3.0.1","@putout/quick-lint":"^1.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.0.0","eslint":"^9.1.1","madrun":"^11.0.0","montag":"^1.2.1","putout":"^39.1.0","nodemon":"^3.1.0","supertape":"^11.0.4","try-to-catch":"^3.0.1","eslint-plugin-putout":"^26.1.0"},"_npmOperationalInternal":{"tmp":"tmp/samadhi_3.0.2_1743025306552_0.9888915515704821","host":"s3://npm-registry-packages-npm-production"},"readme":"# Samadhi [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/samadhi.svg?style=flat\n[BuildStatusURL]: https://github.com/coderaiser/samadhi/actions/workflows/nodejs.yml \"Build Status\"\n[BuildStatusIMGURL]: https://github.com/coderaiser/samadhi/actions/workflows/nodejs.yml/badge.svg\n[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat\n[NPMURL]: https://npmjs.org/package/samadhi \"npm\"\n[LicenseURL]: https://tldrlegal.com/license/mit-license \"MIT License\"\n[CoverageURL]: https://coveralls.io/github/coderaiser/samadhi?branch=master\n[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/samadhi/badge.svg?branch=master&service=github\n\n> **Samadhi** (Sanskrit, समाधि) *is a state of meditative consciousness.*\n\n<img width=\"214\" alt=\"image\" src=\"https://github.com/coderaiser/samadhi/assets/1573141/c95fb001-e535-4a07-b28f-a22c520fc042\">\n\n🧘🏽**Samadhi** linter finds and fixes syntax errors.\n\n## Install\n\n`npm i samadhi --save`\n\n## Available fixes\n\n<details><summary>function declaration half converted from arrow expression</summary>\n\n```diff\n-function parse(source) => {\n+function parse(source) {\n    return source;\n}\n```\n\n</details>\n\n<details><summary>broken string</summary>\n\n```diff\n-const a = 'hello;\n+const a = 'hello';\n\n-const b = ‘hello world’;\n+const b = 'hello world';\n\n\n-x('hello);\n+x('hello');\nconst m = {\n-    z: x('hello\n+    z: x('hello'),\n}\n```\n\n</details>\n\n<details><summary>forgotten round braces in if statement</summary>\n\n```diff\n-if a > 5 {\n+if (a > 5) {\n    alert();\n}\n```\n\n</details>\n\n<details><summary>missing initializer</summary>\n\n```diff\n-const {code, places} await samadhi(source);\n+const {code, places} = await samadhi(source);\n```\n\n</details>\n\n<details><summary>import identifier</summary>\n\n```diff\n-import hello from hello;\n+import hello from 'hello';\n```\n\n</details>\n\n<details><summary>comma after statement</summary>\n\n```diff\nfunction x() {\n-    return 'hello',\n+    return 'hello';\n}\n\n-const a = 5,\n+const a = 5;\n```\n\n</details>\n\n<details><summary>useless comma</summary>\n\n```diff\nconst a = {\n-    b: 'hello',,\n+    b: 'hello',\n}\n```\n\n</details>\n\n<details><summary>useless semicolon</summary>\n\n```diff\nconst a = {\n-    b: 'hello';\n+    b: 'hello',\n}\n```\n\n</details>\n\n<details><summary>useless coma</summary>\n\n```diff\nconst a = class {\n-    b() {},\n+    b() {}\n}\n```\n\n</details>\n\n<details><summary>assign from</summary>\n\n```diff\n-const a = from 'a';\n+const a = require('a');\n```\n\n</details>\n\n<details><summary>export without const</summary>\n\n```diff\n-export x = () => {};\n+export const x = () => {};\n```\n\n</details>\n\n<details><summary>wrong brace</summary>\n\n```diff\n-import a from 'a');\n+import a from 'a';\n```\n\n</details>\n\n## API\n\n### lint(source: string, options: Options)\n\nPossible options:\n\n```ts\ninterface Options {\n    isJSX: boolean;\n    isTS: boolean;\n    startLine: number;\n}\n```\n\nHere is example:\n\n```js\nimport {lint} from 'samadhi';\n\nconst source = `\n    function x() => {\n        return 'hello';\n    }\n`;\n\nconst [code, places] = await lint(source);\n\n// places:\n[{\n    rule: 'parser (quick-lint-js)',\n    message: `functions/methods should not have '=>'`,\n    position: {\n        line: 2,\n        column: 8,\n    },\n}];\n```\n\nYou can also `fix` results:\n\n```js\nconst [code] = await lint(source, {\n    fix: true,\n});\n\n// returns\nfunction x() {\n    return 'hello';\n}\n```\n\n## License\n\nMIT\n","publish_time":1743025306752,"_cnpm_publish_time":1743025306752,"dist-tags":{"latest":"4.0.4"}}