From 9e753447d33fac1af23729ff27da32dfbc6a55b4 Mon Sep 17 00:00:00 2001
From: rswiat
Date: Thu, 15 Mar 2018 07:55:41 +0000
Subject: [PATCH] InjectByTag not working with interior comma, fix + some
eslint fixes
---
.eslintrc | 132 +-
README.md | 10 +-
demo/dist/index-bundle.js | 7 +-
demo/package.json | 39 +-
demo/src/index.html | 3 +
demo/webpack.conf.js | 46 +-
dist/WebpackAutoInjectVersion.js | 24390 ++++------------
package.json | 6 +-
src/components/inject-by-tag/inject-by-tag.js | 14 +-
src/config.js | 19 +-
src/main.js | 9 +-
tools/webpack.conf.js | 19 +-
12 files changed, 6440 insertions(+), 18254 deletions(-)
diff --git a/.eslintrc b/.eslintrc
index 65d0b19..f6dcb28 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,27 +1,24 @@
{
"parser": "babel-eslint",
"extends": "airbnb",
+ "plugins": [
+ "jsdoc",
+ "import",
+ "filenames"
+ ],
"env": {
"browser": true,
"node": true,
- "es6": true,
+ "es6": true
},
- "ecmaFeatures": {
- "arrowFunctions": true,
- "blockBindings": true,
- "classes": true,
- "defaultParams": true,
- "destructuring": true,
- "jsx": true,
- "modules": true,
- "objectLiteralComputedProperties": true,
- "objectLiteralShorthandMethods": true,
- "objectLiteralShorthandProperties": true,
- "spread": true,
- "templateStrings": true
+ "parserOptions": {
+ "ecmaFeatures": {
+ "jsx": true
+ }
},
"globals": {
"__DEV__": true,
+ "test": true,
"describe": true,
"it": true,
"beforeEach": true,
@@ -30,44 +27,81 @@
"browser": true,
"by": true,
"element": true,
- "jasmine": true
+ "jasmine": true,
+ "If": true,
+ "For": true,
+ "When": true,
+ "Choose": true,
+ "cy": true
+ },
+ "settings": {
+ "jsdoc": {
+ "tagNamePreference": {
+ "param": "param",
+ "returns": "return"
+ }
+ }
},
- "plugins": [
- "react"
- ],
"rules": {
- "no-unneeded-ternary" : "off",
+ "spaced-comment": "off",
+ "no-unused-expressions": "off",
+ "func-names": "off",
+ "new-parens": "off",
+ "no-continue": "off",
+ "one-var": ["error", "never"],
+ "class-methods-use-this": "off",
+ "no-restricted-syntax": "off",
+ "no-underscore-dangle": "off",
+ "consistent-return": "off",
"no-console": "off",
- "object-curly-spacing": ["error", "always", {
- "objectsInObjects": false,
- "arraysInObjects": false
+ "guard-for-in": "off",
+ "no-param-reassign": "off",
+ "arrow-body-style": "off",
+ "prefer-destructuring": "off",
+ "max-len": ["error", 140],
+ "no-unused-vars": ["error", { "vars": "all", "args": "none" }],
+ "arrow-parens": ["error", "always"],
+ "padded-blocks": "off",
+ "indent": ["error", 2, { "SwitchCase": 1 }],
+ "no-new": "off",
+ "new-cap": "off",
+ "function-paren-newline": "off",
+ "no-mixed-operators": "off",
+ "no-await-in-loop": "off",
+ "no-plusplus": "off",
+ "newline-per-chained-call": "off",
+ "no-restricted-globals": "off",
+ "object-curly-newline":"off",
+ "array-callback-return": "off",
+
+ "import/no-dynamic-require": "off",
+ "import/prefer-default-export": "off",
+ "import/first": "off",
+ "import/no-extraneous-dependencies": "off",
+ "import/extensions": "off",
+ "import/no-unresolved": "off",
+ "import/no-mutable-exports": "off",
+ "import/order": ["error", {
+ "groups": ["builtin", "external", "internal", "sibling", "parent", "index"],
+ "newlines-between": "always-and-inside-groups"
}],
- "comma-dangle": ["error", "never"],
- "max-len": ["error", 100, 4, {"ignoreUrls": true}],
- "space-before-function-paren": ["error", "never"],
- "no-multiple-empty-lines": ["error", {max: 1}],
- "no-use-before-define": 0,
- "global-require": 0,
- "no-else-return": "error",
- "no-param-reassign": 0,
- "prefer-const": 0,
- "func-names": 0,
- "arrow-body-style": 0,
- "react/jsx-no-bind": [2, {
- "ignoreRefs": false,
- "allowArrowFunctions": true,
- "allowBind": true
- }],
- "guard-for-in": 0,
- "react/jsx-key": 2,
- "react/jsx-no-undef": 0,
- "react/prefer-stateless-function": 0,
- "react/jsx-closing-bracket-location": 0,
- "no-undef": "error",
- "one-var": 0,
- "no-extra-semi": "error",
- "semi": "error",
- "prefer-arrow-callback": "error",
- "new-cap": "off"
+
+ "jsdoc/check-param-names": 2,
+ "jsdoc/check-tag-names": 2,
+ "jsdoc/check-types": 2,
+ "jsdoc/newline-after-description": 0,
+ "jsdoc/require-description-complete-sentence": 0,
+ "jsdoc/require-example": 0,
+ "jsdoc/require-hyphen-before-param-description": 2,
+ "jsdoc/require-param": 2,
+ "jsdoc/require-param-description": 0,
+ "jsdoc/require-param-name": 2,
+ "jsdoc/require-param-type": 0,
+ "jsdoc/require-returns-description": 0,
+ "jsdoc/require-returns-type": 2,
+
+ "filenames/match-regex": [2, "^(_){0,1}([a-zA-Z0-9])[0-9a-z-.]+$"],
+ "filenames/match-exported": [2, "kebab", "_" ],
+ "filenames/no-index": "off"
}
}
diff --git a/README.md b/README.md
index d8a2a3a..3d3516c 100644
--- a/README.md
+++ b/README.md
@@ -24,8 +24,6 @@ Auto Inject Version (AIV) can:
- auto increase package.json version by --env.major, --env.minor, --env.patch passed into webpack
-
-
# How to use
It's easy to set it up, all you need is:
* use WebpackAutoInject in webpack plugins
@@ -56,6 +54,8 @@ module.exports = {
plugins: [
new WebpackAutoInject({
NAME: 'AIV custom name',
+ // specify the name of the tag in the outputed files eg
+ // bundle.js: [SHORT] Version: 0.13.36 ...
SHORT: 'CUSTOM',
SILENT: false,
PACKAGE_JSON_PATH: './package.json',
@@ -74,6 +74,9 @@ module.exports = {
},
InjectByTag: {
fileRegex: /\.+/,
+ // regexp to find [AIV] tag inside html, if you tag contains unallowed characters you can adjust the regex
+ // but also you can change [AIV] tag to anything you want
+ AIVTagRegexp: /(\[AIV])(([a-zA-Z{} ,:;!()_@\-"'\\\/])+)(\[\/AIV])/g,
dateFormat: 'h:MM:ss TT'
}
},
@@ -100,6 +103,9 @@ module.exports = {
[AIV]V:{version} Date:{date}[/AIV]
+
+ [AIV]Version {version} , {date}[/AIV]
+
0.13.36 Friday, August 25th, 2017, 1:56:17 PM 0.13.36_Friday, August 25th, 2017, 1:56:17 PM V:0.13.36 Date:Friday, August 25th, 2017, 1:56:17 PM
```
diff --git a/demo/dist/index-bundle.js b/demo/dist/index-bundle.js
index 5061265..913bda0 100644
--- a/demo/dist/index-bundle.js
+++ b/demo/dist/index-bundle.js
@@ -1,5 +1,4 @@
-// [AIV] Version: 0.13.36 - Friday, August 25th, 2017, 1:56:17 PM
- /******/ (function(modules) { // webpackBootstrap
+/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
@@ -88,7 +87,7 @@ test(myVariable);
/* 1 */
/***/ (function(module, exports) {
-module.exports = "