Skip to content

Commit f30f52c

Browse files
authored
fix: resolve no-this-alias lint error in ts parser (#51)
## Changed - Replaced `this` aliasing with arrow function in AST traversal visitor - Bumped version to 1.1.2
1 parent e73c936 commit f30f52c

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@translated/lara-cli",
33
"type": "module",
4-
"version": "1.1.1",
4+
"version": "1.1.2",
55
"description": "CLI tool for automated i18n file translation using Lara Translate",
66
"repository": {
77
"type": "git",

src/parsers/ts.parser.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,13 @@ export class TsParser implements Parser<Record<string, unknown>, TsParserOptions
9999
});
100100

101101
let messagesObject: Record<string, unknown> | null = null;
102-
const self = this;
103102

104103
// Traverse the AST to find the messages declaration
105104
traverse(ast, {
106-
VariableDeclarator(path: NodePath<t.VariableDeclarator>) {
105+
VariableDeclarator: (path: NodePath<t.VariableDeclarator>) => {
107106
const { node } = path;
108107
if (t.isIdentifier(node.id) && node.id.name === 'messages' && node.init) {
109-
messagesObject = self.extractObjectFromAST(node.init);
108+
messagesObject = this.extractObjectFromAST(node.init);
110109
path.stop();
111110
}
112111
},

0 commit comments

Comments
 (0)