2.15.1 • Published 8 months ago
samadhi v2.15.1
Samadhi

Samadhi (Sanskrit, समाधि) is a state of meditative consciousness.
🧘🏽Samadhi linter finds and fixes syntax errors.
Install
npm i samadhi --save
Available fixes
-function parse(source) => {
+function parse(source) {
return source;
}-const a = 'hello;
+const a = 'hello';
-const b = ‘hello world’;
+const b = 'hello world';
-x('hello);
+x('hello');
const m = {
- z: x('hello
+ z: x('hello'),
}-if a > 5 {
+if (a > 5) {
alert();
}-const {code, places} await samadhi(source);
+const {code, places} = await samadhi(source);-import hello from hello;
+import hello from 'hello';function x() {
- return 'hello',
+ return 'hello';
}
-const a = 5,
+const a = 5;const a = {
- b: 'hello',,
+ b: 'hello',
}const a = {
- b: 'hello';
+ b: 'hello',
}const a = class {
- b() {},
+ b() {}
}-const a = from 'a';
+const a = require('a');-export x = () => {};
+export const x = () => {};-import a from 'a');
+import a from 'a';API
lint(source: string, options: Options)
Possible options:
interface Options {
isJSX: boolean;
isTS: boolean;
startLine: number;
}Here is example:
import {lint} from 'samadhi';
const source = `
function x() => {
return 'hello';
}
`;
const [code, places] = await lint(source);
// places:
[{
rule: 'parser (quick-lint-js)',
message: `functions/methods should not have '=>'`,
position: {
line: 2,
column: 8,
},
}];You can also fix results:
const [code] = await lint(source, {
fix: true,
});
// returns
function x() {
return 'hello';
}License
MIT
2.11.0
11 months ago
2.12.0
10 months ago
2.15.0
9 months ago
2.14.1
9 months ago
2.15.1
8 months ago
2.13.0
10 months ago
2.14.0
9 months ago
2.13.1
10 months ago
2.10.0
1 year ago
2.9.3
1 year ago
2.9.2
1 year ago
2.9.1
1 year ago
2.9.0
1 year ago
2.8.0
1 year ago
2.7.0
1 year ago
2.6.0
1 year ago
2.5.1
1 year ago
2.5.0
1 year ago
2.4.0
1 year ago
2.3.0
1 year ago
2.2.0
1 year ago
2.1.0
1 year ago
2.0.0
1 year ago
1.3.0
1 year ago
1.2.0
1 year ago
1.1.1
1 year ago
1.0.0
1 year ago