Add editor config, fix unnecessary .default suffix

This commit is contained in:
radswiat 2017-04-12 22:11:59 +01:00
parent 26e84f49fd
commit 2a38901fae
6 changed files with 111 additions and 8 deletions

20
.editorconfig Normal file
View file

@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 2
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

72
.eslintrc Normal file
View file

@ -0,0 +1,72 @@
{
"parser": "babel-eslint",
"extends": "airbnb",
"env": {
"browser": true,
"node": 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
},
"globals": {
"__DEV__": true,
"describe": true,
"it": true,
"beforeEach": true,
"afterEach": true,
"expect": true,
"browser": true,
"by": true,
"element": true,
"jasmine": true
},
"plugins": [
"react"
],
"rules": {
"no-unneeded-ternary" : "off",
"object-curly-spacing": ["error", "always", {
"objectsInObjects": false,
"arraysInObjects": false
}],
"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"
}
}

View file

@ -13,9 +13,7 @@
"devDependencies": { "devDependencies": {
"html-minify-loader": "^1.1.0", "html-minify-loader": "^1.1.0",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
"webpack": "^2.3.3" "webpack": "^2.3.3",
}, "webpack-auto-inject-version": "^0.5.10"
"dependencies": {
"webpack-auto-inject-version": "^0.5.5"
} }
} }

View file

@ -1,8 +1,8 @@
var path = require('path'); var path = require('path');
// Require WebpackAutoInject from npm installed modules ( preferred ) // Require WebpackAutoInject from npm installed modules ( preferred )
// var WebpackAutoInject = require('webpack-auto-inject-version').default; var WebpackAutoInject = require('webpack-auto-inject-version');
// Require WebpackAutoInject from dist - dev purpose only ( do not use the below line ) // Require WebpackAutoInject from dist - dev purpose only ( do not use the below line )
var WebpackAutoInject = require('../dist/WebpackAutoInjectVersion').default; // var WebpackAutoInject = require('../dist/WebpackAutoInjectVersion');
module.exports = { module.exports = {
entry: { entry: {

View file

@ -4993,7 +4993,7 @@ module.exports = require("os");
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
var __WEBPACK_AMD_DEFINE_RESULT__;
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
@ -5260,6 +5260,12 @@ WebpackAutoInject.protectedConfig = {
}; };
exports.default = WebpackAutoInject; exports.default = WebpackAutoInject;
!(__WEBPACK_AMD_DEFINE_RESULT__ = function (Foo) {
return WebpackAutoInject;
}.call(exports, __webpack_require__, exports, module),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
/***/ }), /***/ }),
/* 158 */ /* 158 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {

View file

@ -104,3 +104,10 @@ export default class WebpackAutoInject{
await this.executeComponent(components); await this.executeComponent(components);
} }
} }
// webpack hack to export class directly,
// - instead of using 'new WebpackAutoInject.default()',
// - with this you can just use WebpackAutoInject();
define(() => {
return WebpackAutoInject;
});