Open SquidDev opened 5 years ago
We check trailing whitespace on commas on 1a7300d7d05d0ef6f732f99006e04f833211abb0, but doing it generally is going to be harder. The token linter pass really needs a way to get the previous and next node, or at least their whitespace.
It'd be really nice to have a series of linters which nitpick about minor formatting. For instance, ensuring spaces are in the correct places, enforcing a variable name convention, etc... Ideally many of these could have automatic fixers too, allowing for a form of automatic error correction.
,
, but allow;
).,
/;
on multi-line tables.camelCase
for functions (even if local ones), andsnake_case
for variables.{}
(i.e. forbid{foo }
but allow{foo}
and{ foo }
).{ ["foo"] = 1, bar = 2 }
).x["foo"]
→x.foo
). Might be nice to have a reverse refactoring too when we work that out."
vs'
)"
and prefer'
". Prefer a kind of quote, but allow the other when you have strings like'foo "bar"'
.=
s in long strings.One thing bearing in mind is how to handle alignment within tables and assignments. For instance, ideally we'd require a single spaces around tokens, but allow for cases such as follows, where people are trying to align expressions up: