{"name":"samadhi","version":"2.13.0","keywords":["linter","js"],"author":{"url":"https://github.com/coderaiser","name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"license":"MIT","_id":"samadhi@2.13.0","homepage":"http://github.com/coderaiser/samadhi","bugs":{"url":"https://github.com/coderaiser/samadhi/issues"},"dist":{"shasum":"6910b7c7a1ff4cc3c7b5dd8e0db40fb6669da0aa","tarball":"http://registry-npm.ywwl.com/samadhi/download/samadhi-2.13.0.tgz","fileCount":7,"integrity":"sha512-REb+/6KT4PdFiIAWHGpVMGADH6l9ymiWoOIL5k+BVdcSF2sXGxw0xg6Dy5vuUOMMJQPGI+lkr19lLr/BhWq0BQ==","signatures":[{"sig":"MEYCIQCsPrOajLbRMXyGcROkpjkHKqhw0oeDfZI6Q/caAsM3ygIhANAO25/AhD6UGsEY60d7kDJGIdez588TpzzgBN7GEzaa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10065,"size":3982,"noattachment":false,"key":"/samadhi/-/samadhi-2.13.0.tgz"},"main":"lib/samadhi.js","type":"commonjs","engines":{"node":">=18"},"gitHead":"2d8eff01e43a32aa59efde1a1e2f3f3c74371ec3","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":"10.9.0","description":"Linter that fixes syntax errors","directories":{},"_nodeVersion":"22.12.0","dependencies":{"flatlint":"^1.21.2","goldstein":"^5.16.0","js-tokens":"^9.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":"^10.0.1","montag":"^1.2.1","putout":"^37.0.1","nodemon":"^3.1.0","supertape":"^10.5.0","try-to-catch":"^3.0.1","eslint-plugin-putout":"^23.3.0"},"_npmOperationalInternal":{"tmp":"tmp/samadhi_2.13.0_1736517335570_0.4162471201489888","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":1736517335765,"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_cnpm_publish_time":1736517335765,"dist-tags":{"latest":"4.0.4"}}