Code Monkey home page Code Monkey logo

Comments (8)

GavinJoyce avatar GavinJoyce commented on June 5, 2024 1

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.

patocallaghan avatar patocallaghan commented on June 5, 2024 1

@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.

tylerturdenpants avatar tylerturdenpants commented on June 5, 2024

@patocallaghan Is this off of master or the latest release?

from ember-angle-brackets-codemod.

patocallaghan avatar patocallaghan commented on June 5, 2024

@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.

patocallaghan avatar patocallaghan commented on June 5, 2024

@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

// EXPECTED
<VerticalCollection @items=items @tagName="ul" @estimateHeight="50" as |item i|>
...
</VerticalCollection>

// or
<VerticalCollection @params={{array items}} @tagName="ul" @estimateHeight="50" as |item i|>
...
</VerticalCollection>

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.

tylerturdenpants avatar tylerturdenpants commented on June 5, 2024

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.

GavinJoyce avatar GavinJoyce commented on June 5, 2024

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:

Screen Shot 2019-04-26 at 09 56 38

from ember-angle-brackets-codemod.

Turbo87 avatar Turbo87 commented on June 5, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.