Comments (13)
@patricklx, @NullVoxPopuli seems like the only reason why even direct linting of a
gts
file works, is becausetypescript-eslint
internally overrides thereadFile
method of it'sCompilerHost
to use the code we provide as the first argument to itsparseForEslint
method, instead of the actual file on disk.But unfortunatelly this means it will only treat that one file like that, and for the rest it will read from disk, which means it will try to import
gts
files which it doesn't know how to read.Maybe asking
typescript-eslint
repo for a feature to provide an option as an argument where we could provide our ownreadFile
implementation will be enough?
Such feature might be beneficial not only to us, but seems like vue has same issue right now
vuejs/vue-eslint-parser#104
from eslint-plugin-ember.
from eslint-plugin-ember.
@NullVoxPopuli i remember you tried something with glint ts program? Maybe that would work for this?
from eslint-plugin-ember.
well, to use type-are lints, you may not use @typescript-eslint/parser
on gts files, you must use the parser provided by eslint-plugin-ember
@patricklx for the glint ts program thing, I don't recall if that was for linting or not
from eslint-plugin-ember.
@NullVoxPopuli in my reproduction, I am using gjs-gts-parser
for the gts
files, see here.
But still there is the issue, unless I am missing something
from eslint-plugin-ember.
The issue is when gts is imported, not linted directly. But for typed linting the parser also needs to load the imported files. Internally that is done by typescript-eslint parser
from eslint-plugin-ember.
Maybe we need a small ts plugin for this? Like for vue
https://github.com/sandersn/vue-ts-plugin/blob/master/lib/index.ts
from eslint-plugin-ember.
@patricklx, @NullVoxPopuli seems like the only reason why even direct linting of a gts
file works, is because typescript-eslint
internally overrides the readFile
method of it's CompilerHost
to use the code we provide as the first argument to its parseForEslint
method, instead of the actual file on disk.
But unfortunatelly this means it will only treat that one file like that, and for the rest it will read from disk, which means it will try to import gts
files which it doesn't know how to read.
Maybe asking typescript-eslint
repo for a feature to provide an option as an argument where we could provide our own readFile
implementation will be enough?
from eslint-plugin-ember.
If we could tell it to use glint instead of tsc of 'the program', i think that could help, as it also has its own read file ...
If it weren't for this
internally overrides the readFile method of it's CompilerHost
🙈
from eslint-plugin-ember.
If we could tell it to use glint instead of tsc of 'the program', i think that could help, as it also has its own read file ...
If it weren't for this
internally overrides the readFile method of it's CompilerHost
🙈
@NullVoxPopuli well if we pass it glints TS program, then it won't override anything it just uses the program as it's given
from eslint-plugin-ember.
Glint just maybe seems a bit overkill for this, if we could just override readFile
that typescript-eslint
is using by asking them to provide a new option for it, we can the just use transformForEslint method as the override, it would solve the problem I think and not have us depend on glint.
But it is just a theory, I can test it out tomorrow and if it works I can raise a feature request to typescript-eslint
. Wdyt?
But in case they won't be willing to let us override it we probably will need to use glint or something
from eslint-plugin-ember.
Maybe we can use this?
https://github.com/typescript-eslint/typescript-eslint/blob/fadc7940b456f1903a282a4b5085daf1b8367b16/packages/parser/src/index.ts#L7
Patch it and pass it as program parser option? but it would be better to transform directly with content tag,
from eslint-plugin-ember.
Glint just maybe seems a bit overkill for this, if we could just override
readFile
thattypescript-eslint
is using by asking them to provide a new option for it, we can the just use transformForEslint method as the override, it would solve the problem I think and not have us depend on glint.But it is just a theory, I can test it out tomorrow and if it works I can raise a feature request to
typescript-eslint
. Wdyt? But in case they won't be willing to let us override it we probably will need to use glint or something
I tried a few things, but for now I just can't seem to get it to work :(, I'll keep trying next couple of days, but maybe someone else will have more luck with this
from eslint-plugin-ember.
Related Issues (20)
- config files in readme should not encourage top level config. overrides only.
- ESLint couldn't find the config "plugin:ember/gts-recommended" to extend from HOT 4
- false positives for `no-unused-vars` in `gjs` files, when using `<Component as |something|>` HOT 3
- gjs/gts Incorrect token mapping after handlebars HOT 1
- "service" import not treated the same as "inject as service" HOT 1
- no-unused-expressions HOT 4
- Plan v13 Release HOT 4
- new "flat" configs contain invalid parser key HOT 19
- `@typescript-eslint` breaks after update to `eslint-plugin-ember` v12 HOT 19
- ember/template-no-let-reference HOT 4
- ember/no-runloop HOT 4
- New rule: prevent assignment of existing properties on a service (important for tests)
- @typescript-eslint/eslint-recommended not applicable to `*.gts` files HOT 1
- Should we provide a config that disables some rules from `@typescript-eslint/eslint-plugin`? HOT 11
- no-unused-vars firing incorrectly on args inside template-tag HOT 7
- Lint against shadowed keywords
- eslint v9 support
- `no-pause-test` rule doesn't work for test files with `.gts` or `.gjs` extension HOT 5
- `ember/no-runloop` brings false positive error with function name `hasOwnProperty` HOT 4
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 eslint-plugin-ember.