jgardella / compat Goto Github PK
View Code? Open in Web Editor NEWStatic analysis tool for detecting browser compatibility issues in JavaScript and HTML.
License: MIT License
Static analysis tool for detecting browser compatibility issues in JavaScript and HTML.
License: MIT License
Implement detection for ES2016+ features:
2016 features
2016 misc
2017 features
2017 misc
Trying to run it in my project and get this error:
Failed to create JS table: Error: Cannot find module './data-common'
No previous compatibility table. Exiting.
I'm trying to use this on a linux OS and I'm getting the following error:
$ compat --target assets/js/
/usr/bin/env: ‘node\r’: No such file or directory
I think it's coming from:
Line 1 in 5b749e5
I debugged with
$od -c index.js | head
and I got:
0000000 # ! / u s r / b i n / e n v
0000020 n o d e \r \n l e t y a r g s
So, I'm guessing my shell doesn't like these windows(?) line endings?
If incompatibilities are detected, the program does not indicate failure by returning a non-zero status. Fixing this would make it easier to use this in CI settings.
Furthermore, the errors are not printed to stderr. It might be a good idea to print the errors to stderr.
On the following line:
we check for binary literal by matching 'b' in the lowercase version of the number.
However, 0xb is a valid ES5 hexadecimal literal. We should not check for existence of b, but that b exists after the initial 0.
Example:
IE11 does not support Element.prototype.remove
.
From reading some of the source code, it doesn't look like that's a goal of this library, but I wanted to confirm.
Thanks for writing this!
Compat uses the CanIUse repository to validate feature compatibility by grabbing the latest git commit.
This is hardcoded at line 181 from createTable.js: getLatestCommitSHA('fyrd', 'caniuse', 'heads/master')
In recent changes, the "master" branches got renamed to "main" to follow BLM movement, a seen here. Thus, it can no longer resolve and running compat now fails with an error:
stderr: (node:40588) UnhandledPromiseRejectionWarning: Error: Failed to load latest commit
at ClientRequest.<anonymous> ([MyPath]\node_modules\compat-cli\src\tableUpdater\createTable.js:158:16)
No issues are found from compat, as the list fetching is never properly resolved. This makes the library's result unreliable (/unusable).
The easiest fix would be to hardcode the new main branch 'heads/main'
. Maybe a better approach might be to have it fixed as the default but allow a config parameter url/branch name to be passed in case the repo or structure change in the future?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.