Javascript: Autoformat qls

This commit is contained in:
Anders Schack-Mulligen
2019-02-12 14:29:19 +01:00
parent 25469637db
commit 1182fca665
19 changed files with 39 additions and 45 deletions

View File

@@ -1,5 +1,4 @@
import javascript
from HTML::ScriptElement e
select e, e.getScript()
select e, e.getScript()

View File

@@ -1,6 +1,8 @@
import javascript
abstract class Violation extends ASTNode { abstract string reason(); }
abstract class Violation extends ASTNode {
abstract string reason();
}
/**
* Holds for tuples of form `[X, "name1"]` where `X` is a simple type access

View File

@@ -10,9 +10,7 @@ string getTokenStringAtLine(File file, int line) {
result = concat(Token tok |
tok = getATokenAtLine(file, line)
|
tok.toString().replaceAll(" ", "~") + " "
order by
tok.getLocation().getStartColumn()
tok.toString().replaceAll(" ", "~") + " " order by tok.getLocation().getStartColumn()
)
}

View File

@@ -1,6 +1,8 @@
import javascript
abstract class Violation extends ASTNode { abstract string reason(); }
abstract class Violation extends ASTNode {
abstract string reason();
}
class MissingContainer extends Violation, TypeExpr {
MissingContainer() { not exists(getContainer()) }

View File

@@ -3,7 +3,10 @@ import javascript
string getKind(ImportTypeExpr imprt) {
if imprt.isTypeAccess()
then result = "type"
else if imprt.isNamespaceAccess() then result = "namespace" else result = "value"
else
if imprt.isNamespaceAccess()
then result = "namespace"
else result = "value"
}
from ImportTypeExpr imprt

View File

@@ -1,3 +1,3 @@
import javascript
select any(Vue::Instance i)
select any(Vue::Instance i)

View File

@@ -1,4 +1,4 @@
import javascript
from Vue::Instance i, string name
select i, name, i.getAPropertyValue(name)
select i, name, i.getAPropertyValue(name)

View File

@@ -1,4 +1,4 @@
import javascript
from Vue::Instance i, string name
select i, name, i.getOption(name)
select i, name, i.getOption(name)