Skip to content

Commit d0277b3

Browse files
authored
fix multiple etl errors (#240)
1 parent 6e71c00 commit d0277b3

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/main/kotlin/com/emberjs/hbs/linter/ember-template-lint/TemplateLintExternalAnnotator.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2+
import com.dmarcotte.handlebars.file.HbFileType
23
import com.dmarcotte.handlebars.file.HbFileViewProvider
4+
import com.emberjs.gts.GtsFileType
35
import com.emberjs.gts.GtsFileViewProvider
46
import com.emberjs.icons.EmberIcons
57
import com.intellij.lang.annotation.AnnotationHolder
@@ -37,8 +39,8 @@ class TemplateLintExternalAnnotator(onTheFly: Boolean = true) : JSLinterExternal
3739
return (f.name.endsWith(".hbs")
3840
|| (f.name.endsWith(".js") && supportsJS)
3941
|| (f.name.endsWith(".ts") && supportsJS)
40-
|| f.name.endsWith(".gjs")
41-
|| f.name.endsWith(".gts"))
42+
|| (f.name.endsWith(".gjs") && f.fileType === HbFileType.INSTANCE)
43+
|| (f.name.endsWith(".gts") && f.fileType === HbFileType.INSTANCE))
4244
&& !f.name.endsWith(".d.ts")
4345
}
4446

@@ -48,6 +50,7 @@ class TemplateLintExternalAnnotator(onTheFly: Boolean = true) : JSLinterExternal
4850
res = TemplateLintExternalRunner(this.isOnTheFly).highlight(input)
4951
} catch (ex: Exception) {
5052
res = null
53+
println(ex)
5154
}
5255

5356
val errors: MutableList<JSLinterError> = mutableListOf()

src/main/kotlin/com/emberjs/hbs/linter/ember-template-lint/TemplateLintFixAction.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
import com.dmarcotte.handlebars.file.HbFileType
23
import com.dmarcotte.handlebars.file.HbFileViewProvider
34
import com.emberjs.gts.GtsFileViewProvider
45
import com.emberjs.icons.EmberIcons
@@ -66,8 +67,8 @@ class TemplateLintFixAction : JSLinterFixAction(
6667
return (f.name.endsWith(".hbs")
6768
|| (f.name.endsWith(".js") && supportsJS)
6869
|| (f.name.endsWith(".ts") && supportsJS)
69-
|| f.name.endsWith(".gjs")
70-
|| f.name.endsWith(".gts"))
70+
|| (f.name.endsWith(".gjs") && f.fileType == HbFileType.INSTANCE)
71+
|| (f.name.endsWith(".gts") && f.fileType == HbFileType.INSTANCE))
7172
&& !f.name.endsWith(".d.ts")
7273
}
7374

src/main/kotlin/com/emberjs/hbs/linter/ember-template-lint/TemplateLintUtil.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@ class TemplateLintUtil {
77
companion object {
88
const val PACKAGE_NAME = "ember-template-lint"
99
const val CLI_PACKAGE_NAME = "ember-cli-template-lint"
10-
const val CONFIG_FILE_NAME = ".template-lintrc.js"
10+
const val CONFIG_FILE_NAME = ".template-lintrc"
1111

1212
fun findWorkingDirectory(fileToLint: VirtualFile): VirtualFile? {
1313
val parent = fileToLint.parent ?: return null
1414

15-
val configFile = JSLinterConfigFileUtil.findFileUpToFileSystemRoot(parent, CONFIG_FILE_NAME)
15+
val configFile = JSLinterConfigFileUtil.findFileUpToFileSystemRoot(parent, "$CONFIG_FILE_NAME.js") ?:
16+
JSLinterConfigFileUtil.findFileUpToFileSystemRoot(parent, "$CONFIG_FILE_NAME.cjs")
1617
val configFileParent = configFile?.parent
1718
return ObjectUtils.chooseNotNull(configFileParent, parent) as VirtualFile
1819
}
1920

2021
fun getPossibleConfigs(dir: VirtualFile): Collection<VirtualFile?> {
2122
return SmartList(
22-
JSLinterConfigFileUtil.findFileUpToFileSystemRoot(dir, CONFIG_FILE_NAME)
23-
)
23+
JSLinterConfigFileUtil.findFileUpToFileSystemRoot(dir, "$CONFIG_FILE_NAME.js"),
24+
JSLinterConfigFileUtil.findFileUpToFileSystemRoot(dir, "$CONFIG_FILE_NAME.cjs"),
25+
).filterNotNull()
2426
}
2527

2628
fun isTemplateLintConfigFile(file: VirtualFile): Boolean {
27-
return file.name == CONFIG_FILE_NAME
29+
return file.name == "$CONFIG_FILE_NAME.js" || file.name == "$CONFIG_FILE_NAME.cjs"
2830
}
2931
}
3032
}

0 commit comments

Comments
 (0)