Comments (3)
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.
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.
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)
- 'includes' pass check
- [feature request] wrapper command for "minimum ES version" for a file
- Update or remove dependency on cycle package HOT 1
- Quite mode doesn't work HOT 2
- update acorn version to latest HOT 5
- [issue]: terminal pipeline
- Object.assign() passes es5 check HOT 1
- Make --module,--allow-hash-bang, and `--verbose` flags HOT 4
- [Feature request] Entering a wrong ES version should fail
- Allowing validating ES5 code with module=true HOT 7
- An in-range update of conventional-changelog-cli is breaking the build 🚨 HOT 5
- Expose a JS API HOT 5
- ignore node_modules HOT 1
- Also test dependencies HOT 1
- Interpreting the output HOT 1
- Feature: Your code will run on 95% of all browsers
- bug HOT 2
- es-check fails on async arrow function HOT 2
- Command failed with exit code 1
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 es-check.