Comments (13)
I agree that this would be nice, but it is not obvious where a given error ends. For example, for an indentation error is the error with all text on that line or just the first char?
from ember-template-lint.
@rwjblue I know that e.g. jshint reports these as the whole line being wrong. Ultimately the decision for those cases is just bikeshedding. In other cases this would add a lot of value.
from ember-template-lint.
ya, I definitely want to end up using this for editor highlighting. I'll dig into how eslint does this a bit...
from ember-template-lint.
I believe that @binhums and @mmun were also thinking about adding range support. I'd definitely love their feedback....
from ember-template-lint.
@MattEddy and I are working on an atom linter. We definitely agree with the motivation, e.g. in our first stab we had a go inferring ranges - it didn't go so well
It would appear that ESLint does not provide ranges. There is code in the ESLint atom package about ranges but I believe this is actually about auto-fixing rule violations.
But the Atom plugin looks fine highlighting the entire line:
The question for me is, for what rules would highlighting a range be more useful than highlighting an entire line. E.g. an invalid attribute or an inappropriate MustacheStatement rather than a missing attribute.
@MattEddy anything I missed here?
from ember-template-lint.
My concern is that this may be difficult for rule writers to provide. A rule writer is chiefly concerned with AST rather than the source code itself. The AST provides the start and end locations of the node.
I'd be interested in seeing a rule converted to return a meaning range. For example getting the block-indentation
rule to return the range of the end block.
If we did provide ranges would we want to allow falling back to a [line, column] location if implementation a range is difficult for a given rule?
from ember-template-lint.
@binhums I understand and agree. I think it's better to have an approximate range for most rules than no range at all. In my opinion those rules can just report the whole line. It's always possible to improve later.
from ember-template-lint.
Having some rules with range and others without seems pretty annoying to me
from ember-template-lint.
Also, I don't see folks having issues with editor integration with ESLint, and they do not provide range information. Am I just not paying attention to the right GitHub repos to see those issues, or is it a non-issue for them?
from ember-template-lint.
It sounds like we're in agreement here, any comments @mmun, @MattEddy?
from ember-template-lint.
Nope. I'm not sure how the atom ESlint package manages to determine ranges, but having them on the result object seems ideal.
from ember-template-lint.
I spoke with @mmun about this - he told me about the one true god that is Rust. There are linters that provide ranges which are very useful e.g.
<anon>:6:5: 6:12 error: re-assignment of immutable variable `foo` [E0384]
<anon>:6 foo = 3;
^~~~~~~
<anon>:6:5: 6:12 help: see the detailed explanation for E0384
<anon>:2:9: 2:12 note: prior assignment occurs here
<anon>:2 let foo = 1;
^~~
error: aborting due to previous error
playpen: application terminated with error code 101
If I were designing this in a vacuum (e.g. without the precedent of ESLint) I'd have a range in the API.
To summarise from the point of view of the people involved:
- Template authors benefit from having precise instructions over just highlighted lines
- Rule authors suffer from having to write logic to determine ranges
- ember-template-lint maintainers suffer from having to maintain an expanded API
- Integrations (e.g. ember-cli / atom) benefit from having complete metadata available and potentially suffer from writing fallback logic for a single line-column location
I've ordered those groups by how important I think they are. I feel like similar arguments apply for other metadata in the rule API such as source
and fix
.
from ember-template-lint.
After looking out for this more, I saw something that looks like a range in ESLint:
It's straight up inferred from the position of the error and fills to the end of the line...
from ember-template-lint.
Related Issues (20)
- CI fails with JavaScript heap out of memory error HOT 6
- Check embedded templates by default
- Valid menu/sub-menu pattern is reporting errors HOT 6
- require-context-role incorrectly requires elements to be direct children of their context element HOT 1
- no-negated-condition rule could detect `(not (not ...))`
- Change `maxHelpers` default for `simple-unless` rule?
- `no-negated-condition` rule wrongly marks and autofix case when `not` have multiple parameters
- `require-presentational-children` fails for named blocks
- `no-negated-condition` rule could detect and fix `(not (eq...` and others HOT 5
- `no-restricted-invocations` doesn't support modifiers HOT 4
- embedded templates not working properly HOT 11
- Rule request: no-forbidden-keywords / no-forbidden-property-names / no-restricted-syntax
- Report which WCAG success criteria relate to a11y rules HOT 3
- Parse error when applying a helper/modifier conditionally HOT 6
- `--fix` is broken with `.gts` files HOT 7
- `--fix` for `attribute-order` breaks `@tagName=""` HOT 2
- `--fix` for `attribute-order` moves around comments HOT 2
- no-unknown-arguments-for-builtin-components: Argument "@route" or "@query" is required for <LinkTo /> component HOT 2
- Attribute Order Breaks For Link Components HOT 3
- Plan v6 Release
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-template-lint.