Skip to content

Commit dfe18a2

Browse files
authored
Merge branch 'main' into fix-empty-glint-config
2 parents 1106663 + 630c894 commit dfe18a2

File tree

6 files changed

+35
-8
lines changed

6 files changed

+35
-8
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# Changelog
22

33

4+
## v2024.3.7 (2025-03-21)
5+
6+
#### :bug: Bug Fix
7+
* [#225](https://github.com/patricklx/intellij-emberjs-experimental/pull/225) limit ember template lint processing to correct files ([@patricklx](https://github.com/patricklx))
8+
9+
#### :house: Internal
10+
* [#208](https://github.com/patricklx/intellij-emberjs-experimental/pull/208) Delete GlintStatusBarWidget ([@alexander-doroshko](https://github.com/alexander-doroshko))
11+
12+
#### Committers: 2
13+
- Alexander Doroshko ([@alexander-doroshko](https://github.com/alexander-doroshko))
14+
- Patrick Pircher ([@patricklx](https://github.com/patricklx))
15+
16+
417

518

619

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ plugins {
2222

2323

2424
group = "com.emberjs"
25-
version = "2024.3.6"
25+
version = "2024.3.7"
2626

2727
dependencies {
2828
testImplementation("org.jetbrains.kotlin:kotlin-test")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TemplateLintConfiguration(project: Project) : JSLinterConfiguration<Templa
2424

2525
return state.copy(
2626
myInterpreterRef = this.myPackage.interpreter,
27-
myTemplateLintPackage = constantPackage
27+
myTemplateLintPackage = this.myPackage.getPackage().constantPackage
2828
)
2929
}
3030

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ class TemplateLintExternalAnnotator(onTheFly: Boolean = true) : JSLinterExternal
3232

3333
override fun acceptPsiFile(file: PsiFile): Boolean {
3434
val f = file
35-
return f.viewProvider is GtsFileViewProvider || f.viewProvider is HbFileViewProvider || file is JSFile
35+
val pkg = TemplateLintConfiguration.getInstance(file.project).extendedState.state.templateLintPackage
36+
val supportsJS = pkg.version?.let { it.major < 8 } ?: false
37+
return (f.name.endsWith(".hbs")
38+
|| (f.name.endsWith(".js") && supportsJS)
39+
|| (f.name.endsWith(".ts") && supportsJS)
40+
|| f.name.endsWith(".gjs")
41+
|| f.name.endsWith(".gts"))
42+
&& !f.name.endsWith(".d.ts")
3643
}
3744

3845
override fun annotate(input: JSLinterInput<TemplateLintState>): JSLinterAnnotationResult? {

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,15 @@ class TemplateLintFixAction : JSLinterFixAction(
6060
}
6161

6262
override fun isFileAccepted(project: Project, file: VirtualFile): Boolean {
63-
val f = PsiManager.getInstance(project).findFile(file)
64-
return f?.viewProvider is GtsFileViewProvider || f?.viewProvider is HbFileViewProvider || f is JSFile
63+
val f = PsiManager.getInstance(project).findFile(file) ?: return false
64+
val pkg = TemplateLintConfiguration.getInstance(project).extendedState.state.templateLintPackage
65+
val supportsJS = pkg.version?.let { it.major < 8 } ?: false
66+
return (f.name.endsWith(".hbs")
67+
|| (f.name.endsWith(".js") && supportsJS)
68+
|| (f.name.endsWith(".ts") && supportsJS)
69+
|| f.name.endsWith(".gjs")
70+
|| f.name.endsWith(".gts"))
71+
&& !f.name.endsWith(".d.ts")
6572
}
6673

6774
private fun fixFile(psiFile: PsiFile) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import com.intellij.lang.javascript.linter.JSNpmLinterState
66

77
data class TemplateLintState(
88
private val myInterpreterRef: NodeJsInterpreterRef,
9-
private val myTemplateLintPackage: NodePackage,
9+
private val myTemplateLintPackage: NodePackage?,
1010
val isRunOnSave: Boolean,
1111
) : JSNpmLinterState<TemplateLintState> {
1212

@@ -23,12 +23,12 @@ data class TemplateLintState(
2323
}
2424

2525
override fun getNodePackageRef(): NodePackageRef {
26-
return this.myPackageRef
26+
return this.myPackageRef!!
2727
}
2828

2929
val templateLintPackage: NodePackage
3030
get() {
31-
return this.myTemplateLintPackage
31+
return this.myTemplateLintPackage!!
3232
}
3333

3434
companion object {

0 commit comments

Comments
 (0)