Giter VIP home page Giter VIP logo

Comments (7)

patricklx avatar patricklx commented on June 24, 2024 1

Oh, right.
Does it make a difference of its a gts or gjs file?

from eslint-plugin-ember.

davidtaylorhq avatar davidtaylorhq commented on June 24, 2024 1

This fails ❌

<template>
  {{#each array as |item index|}}
    {{index}}
  {{/each}}
</template>

This passes ✅

someFunction((item, index) => console.log(index));

Conceptually, they are the same, so the eslint result should be the same for both examples.

Eslint docs say

unused positional arguments that occur before the last used argument will not be checked, but all named arguments and all positional arguments after the last used argument will be checked.

from eslint-plugin-ember.

NullVoxPopuli avatar NullVoxPopuli commented on June 24, 2024 1

Ah! Thanks for that clarification! I didn't know they differentiate with prior positionals!

from eslint-plugin-ember.

patricklx avatar patricklx commented on June 24, 2024

Does _item also get reported as unused?

from eslint-plugin-ember.

davidtaylorhq avatar davidtaylorhq commented on June 24, 2024

Underscores don't seem to make any difference out-the-box. Calling it _item, or _ doesn't make any difference

If I configure an eslint argsIgnorePattern, then underscored variables can be ignored:

/*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/

const array = [];

<template>
  {{#each array as |_item index|}}
    {{index}}
  {{/each}}
</template>

^^ this passes ✅

But this argsIgnorePattern is not default eslint behaviour, so I imagine most projects rely on the default 'args: after-used'' behaviour.

from eslint-plugin-ember.

davidtaylorhq avatar davidtaylorhq commented on June 24, 2024

Same issue in both gjs and gts 😓

from eslint-plugin-ember.

NullVoxPopuli avatar NullVoxPopuli commented on June 24, 2024

Isn't this correct behavior tho?
(Am i missing something? 😅)

from eslint-plugin-ember.

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.