-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property case conversion #44
Comments
@jpradelle Thanks for checking out Web-Types! First of all, the configuration under Second, there are two issues I've noticed in WebStorm:
There is also one more thing - the |
Thank you for this awesome project ! I've been dreaming of that for few years :) Thanks for your answer, IDE restart was part of the problem, I was able to enable case conversion with one more thing that I don't want to do: As needed, I added framework configuration: Updated {
"name": "web-types-case-test",
"version": "0.1.0",
"web-types": [
"./framework-web-types.json",
"./component-web-types.json"
],
"dependencies": {
"@polymer/polymer": "^3.4.1"
}
} I added framework configuration in {
...
"framework": "@polymer/polymer",
"framework-config": {
"enable-when": {
"node-packages": [
"@polymer/polymer"
]
},
"canonical-names": {
"/js/properties": "kebab-case"
},
"name-variants": {
"/js/properties": [
"kebab-case"
]
}
},
... But that's not enough to have type conversion enabled for components described in {
...
"framework": "@polymer/polymer",
...
} And for that last part I think I should not have to do that: For the last one ( <demo-test foo-bar="foo" foo-baz="[[foo]]"></demo-test> In a LitElement context: <demo-test foo-bar="foo" .fooBaz="${this.foo}"></demo-test>
The idea is to have static files that describe frameworks syntaxes, and generate component description independently from framework. |
To illustrate my point, in this project in which I only generated web-types files of a component library, I had to duplicate web-types files, one for polymer and one for lit, where the only difference is the framework property. And due to that I don't support other frameworks. I think it would be awesome if every web-component project released web-types files in it. But for that I think framework constraint needs to be solved. |
@jpradelle I've finally got some time to look at the issue. Unfortunately, you're right and there is no way to workaround at this point. I will need to figure out a solution, where framework rules affect framework-less Web-Types, when queried in framework context :) The solution will be present in 2022.1 at earliest. |
Hey, why am I getting error when I use array of paths "web-types": [
"./framework-web-types.json",
"./component-web-types.json"
] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array |
@kloshar4o Which IDE and in which version are you using? |
@jpradelle I've pushed fixes for the issues and they will be present in the next 2022.1 EAP, which will be released at latest next week. Additionally, I've added support for rules per reference, so for instance you'll be able to use: {
"name": "framework-web-types",
"js-types-syntax": "typescript",
"version": "0.1.0",
"framework": "@polymer/polymer",
"framework-config": {
"enable-when": {
"node-packages": [
"@polymer/polymer"
]
}
},
"contributions": {
"html": {
"attributes": [
{
"name": "Properties",
"description": "Properties expression",
"value": {
"kind": "expression",
"type": "any"
},
"pattern": {
"items": {
"path": "/js/properties",
"name-conversion": {
"canonical-names": "kebab-case",
"match-names": [
"as-is"
],
"name-variants": [
"kebab-case"
]
}
},
"template": [
"#item:property name"
]
}
}
]
}
}
} instead of global rules, which I think is much better, as there might be some libraries, which make use of |
I can confirm this is working exactly as expected with version 2022.1 EAP (ideaIU-221.4501.155) |
Hi,
I'm trying to apply js property case conversion for PolymerJS web-types definition and generation based on modified version of marcobeierer's web-component-analyzer fork #25 (comment)
I don't get how to make it work
On IntelliJ 2021.3.1 I get that:
On following project, I expect
forBaz
to be not recognized andfoo-baz
recognized, I get the opposite.Here is the full project:
package.json
Framework generic definition
framework-web-types.json
Generated web-components definitions
component-web-types.json
index.html
The text was updated successfully, but these errors were encountered: