Giter Club home page Giter Club logo

Comments (3)

dotnetCarpenter avatar dotnetCarpenter commented on May 17, 2024

Hmm I just found another project that tries to accomplish this - I haven't tried it though.
https://www.npmjs.com/package/es-feature-detection

from es-check.

yowainwright avatar yowainwright commented on May 17, 2024

How did you write the script you tested with @dotnetCarpenter?
What version of ES Check were you using?

^ Questions asked to ensure it's not a potential feature that needs to be added.

ES-check is built on acorn.js. I trust it. There are new features that are popping up though. So perhaps feature detection will become a thing that es-check supports.

Es-feature-detection provides some interesting things that could potentially be provided by ES-Check. Thanks for sharing.

from es-check.

Artoria2e5 avatar Artoria2e5 commented on May 17, 2024

The ones for globals like Map and Set will require some keeping track of the variables. For a single file, this can probably be done by walking the syntax tree with acorn-walker or something similar and looking for uses while making sure that they are not shadowed by something else in the scope. Stuff in ESTree like Function, BlockStatement, WithStatement, VariableDeclaration, AssignmentExpression, Expression will need to be checked.

The story about new methods like Array.prototype.flatmap is a bit more frightening, since they are going to require type deduction and checking. An example of doing so is in the no-for-in-array rule of typescript-eslint. (Some more complex ones like await-thenable requries the tsutils package.) Acorn will not do: this linter uses a ESTree parser generated by consuming typescript AST to achieve that. On the other hand typescript compiler may be good for keeping track of global variables for you too, but it sure is a lot slower.

from es-check.

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.