Comments (8)
One strategy I've taken before for ambiguous code which couldn't be accurately code-modded correctly was to add a comment outlining the problem to bring it to people's attention.
These comments might get lost in a sea of other changes in the resultant diff. Perhaps we could emit a log file or console messages instead?
from ember-angle-brackets-codemod.
@GavinJoyce @tylerturdenpants We could follow a similar pattern to ember-modules-codemod which wrote a log file if it discovered unknown modules during the transform
from ember-angle-brackets-codemod.
@patocallaghan Is this off of master or the latest release?
from ember-angle-brackets-codemod.
@tylerturdenpants This is on latest master. I've a failing test here https://github.com/rajasegar/ember-angle-brackets-codemod/pull/37
from ember-angle-brackets-codemod.
@tylerturdenpants I'm just getting to grips with Angle Bracket syntax and this looks like it's somewhat expected. Angle Bracket components don't support positional params and should instead be keyed properties
See this discuss answer https://discuss.emberjs.com/t/how-to-use-positionalparams-with-angle-bracket-invocation/15739
I'm not entirely sure what we should do here as we'll never know the correct key value, and I don't think the {{array}}
helper can be assumed to be installed.
One strategy I've taken before for ambiguous code which couldn't be accurately code-modded correctly was to add a comment outlining the problem to bring it to people's attention.
from ember-angle-brackets-codemod.
The fact that this has tripped me up while working on the codemod makes me feel like this is a really good idea. The only downside would be the clutter we could unnecessarily cause as a result. Maybe just a console message instead?
@rajasegar @GavinJoyce @rwjblue what do you think?
from ember-angle-brackets-codemod.
As a first step, here's a PR which skips and emits a simple console warning: https://github.com/rajasegar/ember-angle-brackets-codemod/pull/42
I think we should improve the warning feedback though, it's easy to miss at the moment:
from ember-angle-brackets-codemod.
I think the fix in https://github.com/rajasegar/ember-angle-brackets-codemod/pull/42 is sufficient. There is basically no way for us to know what to refactor this into. For certain built-in components like link-to
it's okay to build special handling code, but I don't think it's worth the time to attempt that for every addon component like that that we encounter 😅
from ember-angle-brackets-codemod.
Related Issues (20)
- Incorrect transformation of use of contextual component variable into a component invocation HOT 3
- Why is component that has positional parameters got skipped? HOT 1
- skipAttributesThatMatchRegex config needs to use strings in JSON HOT 1
- Update debugging workflow in README
- Nodes whose data attributes are valueless are excluded from codemod HOT 4
- running codemod on rendering tests breaks on < character HOT 6
- Possible to run offline (not using puppeteer / dev server)? HOT 6
- Async error HOT 7
- Error transforming component with a helper that does not use positional params as an attribute
- Is this supposed to work in addons? HOT 1
- Making Telemetry optional instead of default HOT 4
- Error: Protocol error (Page.navigate): Cannot navigate to invalid URL HOT 4
- Can I convert a single component at a time? HOT 6
- Trouble installing on Mac M1 (arm64 arch) machine
- link-to conversion drops params HOT 4
- Incorrect handling of block param properties in iterable helpers HOT 2
- Puppeteer errors with hard to decipher reason HOT 1
- Errors with 5.1.0: Cannot read property 'originalPositionFor' of undefined
- Add disambiguation of helpers (wrapping in round brackets) HOT 7
- Move helper disambiguation to a flag that is off by default
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-angle-brackets-codemod.