Skip to content

Commit 69e3433

Browse files
author
Chuck Dumont
authored
Merge pull request #164 from chuckdumont/master
Use es5 linting for runtime module
2 parents 178c200 + c17c2f9 commit 69e3433

8 files changed

+54
-8
lines changed

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
if (!Object.entries) require("object.entries").shim(); // for node < 7
17-
module.exports = require("./lib/DojoAMDPlugin");
16+
module.exports = require("./lib/DojoAMDPlugin");

lib/DojoAMDMainTemplatePlugin.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
const util = require('util');
2525
const Template = require("webpack/lib/Template");
2626
const stringify = require("node-stringify");
27+
const runtime = require("../runtime/DojoAMDMainTemplate.runtime");
2728
const {getAsString, getIndent, getRequireExtensionsHookName, needChunkLoadingCode, preWebpackV4} = require("./compat");
2829
const {reg, tap, pluginName, callSyncBail, callSyncWaterfall} = require("./pluginCompat").for("dojo-webpack-plugin");
2930

@@ -84,7 +85,7 @@ module.exports = class DojoAMDMainTemplatePlugin {
8485

8586
dojoRequireExtensions(source, chunk, ...rest) {
8687
const {mainTemplate} = this.compilation;
87-
const runtimeSource = Template.getFunctionContent(require("./DojoAMDMainTemplate.runtime.js").main)
88+
const runtimeSource = Template.getFunctionContent(runtime.main)
8889
.replace(/__webpack_require__/g, mainTemplate.requireFn);
8990
const buf = [];
9091
buf.push(runtimeSource);
@@ -142,9 +143,9 @@ but the loader specified at ${this.embeddedLoaderFilename} was built without the
142143
buf.push("['baseUrl','has','rawConfig','on','signal'].forEach(function(name) {req[name] = loaderScope.require[name]})");
143144
const loaderConfig = callSyncBail(this.compiler, "get dojo config");
144145
if (loaderConfig.has && loaderConfig.has['dojo-undef-api']) {
145-
buf.push("req.undef = " + Template.getFunctionContent(require("./DojoAMDMainTemplate.runtime.js").undef));
146+
buf.push("req.undef = " + Template.getFunctionContent(runtime.undef));
146147
}
147-
const makeDeprecatedReq = Template.getFunctionContent(require("./DojoAMDMainTemplate.runtime.js").makeDeprecatedReq)
148+
const makeDeprecatedReq = Template.getFunctionContent(runtime.makeDeprecatedReq)
148149
.replace(/__webpack_require__\.dj/g, djProp);
149150
return this.asString([
150151
source,

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"dojo": "1.13.0",
3636
"dojo-util": "1.13.0",
3737
"eslint": "^4.17.0",
38+
"eslint-plugin-es5": "^1.3.1",
3839
"eslint-plugin-json": "^1.2.0",
3940
"eslint-plugin-markdown": "^1.0.0-beta.7",
4041
"fs-extra": "^4.0.2",

package.webpack2.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dojo-webpack-plugin",
3-
"version": "2.6.0",
3+
"version": "2.7.2",
44
"author": "Chuck Dumont",
55
"description": "Supports using webpack with Dojo 1.x applications",
66
"scripts": {
@@ -35,6 +35,7 @@
3535
"dojo": "1.13.0",
3636
"dojo-util": "1.13.0",
3737
"eslint": "^4.17.0",
38+
"eslint-plugin-es5": "^1.3.1",
3839
"eslint-plugin-json": "^1.2.0",
3940
"eslint-plugin-markdown": "^1.0.0-beta.7",
4041
"fs-extra": "^4.0.2",

package.webpack3.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dojo-webpack-plugin",
3-
"version": "2.6.0",
3+
"version": "2.7.2",
44
"author": "Chuck Dumont",
55
"description": "Supports using webpack with Dojo 1.x applications",
66
"scripts": {
@@ -35,6 +35,7 @@
3535
"dojo": "1.13.0",
3636
"dojo-util": "1.13.0",
3737
"eslint": "^4.17.0",
38+
"eslint-plugin-es5": "^1.3.1",
3839
"eslint-plugin-json": "^1.2.0",
3940
"eslint-plugin-markdown": "^1.0.0-beta.7",
4041
"fs-extra": "^4.0.2",

runtime/.eslintrc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"parserOptions": {
3+
"sourceType": "module",
4+
},
5+
"env": {
6+
"browser": true,
7+
"amd": true,
8+
"node": false,
9+
"es6": false,
10+
},
11+
"rules": {
12+
# "camelcase": 2,
13+
"comma-dangle": 2,
14+
"no-dupe-args": 2,
15+
"no-dupe-keys": 2,
16+
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
17+
"no-shadow": 2,
18+
"no-trailing-spaces": 2,
19+
"no-undef": 2,
20+
"semi": 2,
21+
"no-debugger": "error",
22+
# Helps ensure we don't require unused modules.
23+
"no-unused-vars": [2, {
24+
"args": "all",
25+
"argsIgnorePattern": "^(e|err|error)$|__$",
26+
}],
27+
# Prevents usage of things before they're defined (except for hoisted function declarations).
28+
"no-use-before-define": [2, "nofunc"]
29+
},
30+
"plugins": [
31+
"es5"
32+
],
33+
"extends": [
34+
"plugin:es5/no-es2015",
35+
"plugin:es5/no-es2016"
36+
]
37+
}

lib/DojoAMDMainTemplate.runtime.js renamed to runtime/DojoAMDMainTemplate.runtime.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
/* globals loaderScope __webpack_require__ installedModules globalRequireContext */
16+
/* globals module loaderScope __webpack_require__ installedModules globalRequireContext */
1717

1818
module.exports = {
1919
main: function() {

0 commit comments

Comments
 (0)