Giter Site home page Giter Site logo

Comments (8)

tankers746 avatar tankers746 commented on July 17, 2024 1

Just tested, works great!

from eslint-plugin-total-functions.

danielnixon avatar danielnixon commented on July 17, 2024

Have you bumped into #16 ?

from eslint-plugin-total-functions.

danielnixon avatar danielnixon commented on July 17, 2024

https://github.com/danielnixon/eslint-plugin-total-functions/blob/master/src/rules/no-array-subscript.test.ts#L284-L296

from eslint-plugin-total-functions.

tankers746 avatar tankers746 commented on July 17, 2024

I have not yet, but would prefer that subscript access be split up into an array rule and an object rule. The rule for arrays, while not perfect, solves a pain point in typescript. I'm less concerned about object indexing which at least in my codebase is far more common than array indexing.

from eslint-plugin-total-functions.

danielnixon avatar danielnixon commented on July 17, 2024

would prefer that subscript access be split up into an array rule and an object rule

That's a fair point. PR welcome, otherwise I'll get to it soonish.

from eslint-plugin-total-functions.

danielnixon avatar danielnixon commented on July 17, 2024

For the object and array decoupling: #28

from eslint-plugin-total-functions.

danielnixon avatar danielnixon commented on July 17, 2024

The explanation for this issue:

There's a limitation in the rule such that it won't consider non-literal keys (even if the key's type is keyof typeof ... or const).

So this won't (currently) pass the rule:

const period: keyof typeof periods = 'oneDay';
periods[period];

but this will:

periods['oneDay'];

This is the object cousin of the array limitation in #16.

Happy to accept a PR, otherwise I'll fix this soonish too.

from eslint-plugin-total-functions.

danielnixon avatar danielnixon commented on July 17, 2024

This might be fixed by the latest release. Please update and let me know @tankers746

from eslint-plugin-total-functions.

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.