Skip to content

Commit 43e5e1e

Browse files
committed
add type NewLineInsertOptions
1 parent 2c0ab7b commit 43e5e1e

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/instance.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import NodeMutation, {
2626
RemoveOptions,
2727
Adapter as MutationAdapter,
2828
} from "@synvert-hq/node-mutation";
29-
import { Parser } from "./types/options";
29+
import { Parser, NewLineInsertOptions } from "./types/options";
3030
import { TestResultExt } from "./types/result";
3131
import * as HtmlEngine from "./engines/html";
3232
import * as RailsErbEngine from "./engines/rails_erb";
@@ -938,7 +938,7 @@ class Instance<T> {
938938
* @param {boolean} [options.andSpace] - insert additional space
939939
* @param {boolean} [options.fixIndent] - fix indent of the code
940940
*/
941-
insertAfter(code: string, options: InsertOptions = {}): void {
941+
insertAfter(code: string, options: NewLineInsertOptions = {}): void {
942942
const column = " ".repeat(
943943
this.currentMutation.adapter.getStartLoc(this.currentNode, options.to)
944944
.column,
@@ -974,7 +974,7 @@ class Instance<T> {
974974
* @param {boolean} [options.andSpace] - insert additional space
975975
* @param {boolean} [options.fixIndent] - fix indent of the code
976976
*/
977-
insertBefore(code: string, options: InsertOptions = {}): void {
977+
insertBefore(code: string, options: NewLineInsertOptions = {}): void {
978978
const column = " ".repeat(
979979
this.currentMutation.adapter.getStartLoc(this.currentNode, options.to)
980980
.column,

src/types/options.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { InsertOptions } from "@synvert-hq/node-mutation";
2+
13
// This is for espree
24
export enum SourceType {
35
MODULE = "module",
@@ -16,3 +18,7 @@ export type RewriterOptions = {
1618
runInstance?: boolean;
1719
writeToFile?: boolean;
1820
};
21+
22+
export interface NewLineInsertOptions extends InsertOptions {
23+
fixIndent?: boolean;
24+
}

0 commit comments

Comments
 (0)