{"name":"samadhi","version":"2.15.1","type":"commonjs","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"Linter that fixes syntax errors","homepage":"http://github.com/coderaiser/samadhi","main":"lib/samadhi.js","repository":{"type":"git","url":"git+https://github.com/coderaiser/samadhi.git"},"keywords":["linter","js"],"scripts":{"test":"madrun test","coverage":"madrun coverage","lint":"madrun lint","fix:lint":"madrun fix:lint","report":"madrun report","watcher":"madrun watcher","watch:test":"madrun watch:test","watch:lint":"madrun watch:lint","update:dist":"madrun update:dist"},"license":"MIT","devDependencies":{"c8":"^10.0.0","eslint":"^9.1.1","eslint-plugin-putout":"^24.0.0","madrun":"^10.0.1","montag":"^1.2.1","nodemon":"^3.1.0","putout":"^38.0.5","supertape":"^10.5.0","try-to-catch":"^3.0.1"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"dependencies":{"@putout/quick-lint":"^1.2.0","flatlint":"^2.0.0","goldstein":"^5.16.0","try-catch":"^3.0.1"},"_id":"samadhi@2.15.1","gitHead":"78e5cf050c17c483f38e1230e3b08c2e8b02b56c","bugs":{"url":"https://github.com/coderaiser/samadhi/issues"},"_nodeVersion":"22.14.0","_npmVersion":"11.1.0","dist":{"integrity":"sha512-lqisprJcRKWHR+NWlOFBhoT0OF3zyqyqDsRfBklDGDEOkUzCG2rc7XA8/qg2sKYTA/uM5hJBfBaK5obzl1sHqg==","shasum":"30ac0661a0d7201a746f1681fd6bb9ef9d129999","tarball":"http://registry-npm.ywwl.com/samadhi/download/samadhi-2.15.1.tgz","fileCount":7,"unpackedSize":10818,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCBRspPS5CdPBSDZKKIn04mxYl12Eh9Qkf0ZQnOggH3HAIgIsGGWGQdGIXyiBWClREBgg7m7ObMNlU4ZuZmV0wmjl0="}],"size":4191,"noattachment":false,"key":"/samadhi/-/samadhi-2.15.1.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/samadhi_2.15.1_1739815283900_0.99379926852313"},"_hasShrinkwrap":false,"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":1739815284085,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1739815284085,"dist-tags":{"latest":"4.0.4"}}