initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
node_modules
*.log
src
test

View File

@@ -0,0 +1,59 @@
# babel-plugin-check-es2015-constants
Validate ES2015 constants (prevents reassignment of const variables).
## Example
**In**
```js
const a = 1;
a = 2;
```
**Out**
```bash
repl: "a" is read-only
1 | const a = 1;
> 2 | a = 2;
| ^
```
[Try in REPL](http://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=es2015&experimental=false&loose=false&spec=false&code=const%20a%20%3D%201%3B%0Aa%20%3D%202%3B&playground=true)
## Installation
```sh
npm install --save-dev babel-plugin-check-es2015-constants
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["check-es2015-constants"]
}
```
### Via CLI
```sh
babel --plugins check-es2015-constants script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["check-es2015-constants"]
});
```
## Note
This check will only validate consts. If you need it to compile down to `var` then you must also install and enable [`transform-es2015-block-scoping`](http://babeljs.io/docs/plugins/transform-es2015-block-scoping/).

View File

@@ -0,0 +1,45 @@
"use strict";
exports.__esModule = true;
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
exports.default = function (_ref) {
var messages = _ref.messages;
return {
visitor: {
Scope: function Scope(_ref2) {
var scope = _ref2.scope;
for (var name in scope.bindings) {
var binding = scope.bindings[name];
if (binding.kind !== "const" && binding.kind !== "module") continue;
for (var _iterator = binding.constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
var _ref3;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref3 = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref3 = _i.value;
}
var violation = _ref3;
throw violation.buildCodeFrameError(messages.get("readOnly", name));
}
}
}
}
};
};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = exports["default"];

View File

@@ -0,0 +1,93 @@
{
"_args": [
[
"babel-plugin-check-es2015-constants@^6.8.0",
"/home/bernhard/freifunk-app/node_modules/babel-preset-fbjs"
]
],
"_from": "babel-plugin-check-es2015-constants@>=6.8.0 <7.0.0",
"_id": "babel-plugin-check-es2015-constants@6.22.0",
"_inCache": true,
"_installable": true,
"_location": "/babel-plugin-check-es2015-constants",
"_nodeVersion": "6.9.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/babel-plugin-check-es2015-constants-6.22.0.tgz_1484872418811_0.9349760548211634"
},
"_npmUser": {
"email": "hi@henryzoo.com",
"name": "hzoo"
},
"_npmVersion": "3.10.10",
"_phantomChildren": {},
"_requested": {
"name": "babel-plugin-check-es2015-constants",
"raw": "babel-plugin-check-es2015-constants@^6.8.0",
"rawSpec": "^6.8.0",
"scope": null,
"spec": ">=6.8.0 <7.0.0",
"type": "range"
},
"_requiredBy": [
"/babel-preset-fbjs",
"/babel-preset-react-native"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz",
"_shasum": "35157b101426fd2ffd3da3f75c7d1e91835bbf8a",
"_shrinkwrap": null,
"_spec": "babel-plugin-check-es2015-constants@^6.8.0",
"_where": "/home/bernhard/freifunk-app/node_modules/babel-preset-fbjs",
"dependencies": {
"babel-runtime": "^6.22.0"
},
"description": "Compile ES2015 constants to ES5",
"devDependencies": {
"babel-helper-plugin-test-runner": "^6.22.0"
},
"directories": {},
"dist": {
"shasum": "35157b101426fd2ffd3da3f75c7d1e91835bbf8a",
"tarball": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz"
},
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"maintainers": [
{
"name": "amasad",
"email": "amjad.masad@gmail.com"
},
{
"name": "hzoo",
"email": "hi@henryzoo.com"
},
{
"name": "jmm",
"email": "npm-public@jessemccarthy.net"
},
{
"name": "loganfsmyth",
"email": "loganfsmyth@gmail.com"
},
{
"name": "sebmck",
"email": "sebmck@gmail.com"
},
{
"name": "thejameskyle",
"email": "me@thejameskyle.com"
}
],
"name": "babel-plugin-check-es2015-constants",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-check-es2015-constants"
},
"scripts": {},
"version": "6.22.0"
}