From a2ecd6970df20c6754dc847fbd71635ba4964467 Mon Sep 17 00:00:00 2001 From: Will Farley Date: Sun, 24 Jul 2016 11:57:52 -0400 Subject: [PATCH 1/2] :shirt: Appease the linter --- example/fixtures/file.js | 2 +- example/karma-complex.conf.js | 142 +++++++++++++++++----------------- example/karma.conf.js | 124 ++++++++++++++--------------- example/test/aTest.js | 2 +- example/test/index.js | 2 +- example/test/separate.js | 2 +- mocha-env-loader.js | 5 +- 7 files changed, 140 insertions(+), 139 deletions(-) diff --git a/example/fixtures/file.js b/example/fixtures/file.js index 62027015..e12f1fe5 100644 --- a/example/fixtures/file.js +++ b/example/fixtures/file.js @@ -1 +1 @@ -exports.ok = true; \ No newline at end of file +exports.ok = true; diff --git a/example/karma-complex.conf.js b/example/karma-complex.conf.js index efb792c2..b7bc623f 100644 --- a/example/karma-complex.conf.js +++ b/example/karma-complex.conf.js @@ -12,104 +12,104 @@ var configSettings = { }; module.exports = function(config) { - config.set({ + config.set({ - // base path, that will be used to resolve files and exclude - basePath: '', + // base path, that will be used to resolve files and exclude + basePath: '', - // frameworks to use - frameworks: ['mocha'], + // frameworks to use + frameworks: ['mocha'], - // list of files / patterns to load in the browser - files: [ - 'test/index.js', - 'test/separate.js', - ], + // list of files / patterns to load in the browser + files: [ + 'test/index.js', + 'test/separate.js', + ], - // list of preprocessors - preprocessors: { - 'test/*': ['webpack'] - }, + // list of preprocessors + preprocessors: { + 'test/*': ['webpack'] + }, - webpack: Object.keys(configSettings).map(function(name) { - var config = { - name: name, - resolve: { - extensions: ["", ".js", ".coffee"] - }, - module: { - loaders: [ - { test: /\.coffee$/, loader: "coffee-loader" } - ] - } - }; - Object.keys(configSettings[name]).forEach(function(key) { - config[key] = configSettings[name][key] - }); - return config; - }), + webpack: Object.keys(configSettings).map(function(name) { + var config = { + name: name, + resolve: { + extensions: ["", ".js", ".coffee"] + }, + module: { + loaders: [ + { test: /\.coffee$/, loader: "coffee-loader" } + ] + } + }; + Object.keys(configSettings[name]).forEach(function(key) { + config[key] = configSettings[name][key] + }); + return config; + }), - webpackMiddleware: { - stats: { - colors: true - } - }, + webpackMiddleware: { + stats: { + colors: true + } + }, - // test results reporter to use - // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' - reporters: ['spec'], + // test results reporter to use + // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' + reporters: ['spec'], - // web server port - port: 9876, + // web server port + port: 9876, - // enable / disable colors in the output (reporters and logs) - colors: true, + // enable / disable colors in the output (reporters and logs) + colors: true, - // level of logging - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_INFO, + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, - // enable / disable watching file and executing tests whenever any file changes - autoWatch: true, + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera (has to be installed with `npm install karma-opera-launcher`) - // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) - // - PhantomJS - // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) - browsers: ['Chrome'], + // Start these browsers, currently available: + // - Chrome + // - ChromeCanary + // - Firefox + // - Opera (has to be installed with `npm install karma-opera-launcher`) + // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) + // - PhantomJS + // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) + browsers: ['Chrome'], - // If browser does not capture in given timeout [ms], kill it - captureTimeout: 60000, + // If browser does not capture in given timeout [ms], kill it + captureTimeout: 60000, - // Continuous Integration mode - // if true, it capture browsers, run tests and exit - singleRun: true, + // Continuous Integration mode + // if true, it capture browsers, run tests and exit + singleRun: true, - // List plugins explicitly, since autoloading karma-webpack - // won't work here - plugins: [ - require("karma-mocha"), - require("karma-spec-reporter"), - require("karma-chrome-launcher"), - require("../") - ] - }); + // List plugins explicitly, since autoloading karma-webpack + // won't work here + plugins: [ + require("karma-mocha"), + require("karma-spec-reporter"), + require("karma-chrome-launcher"), + require("../") + ] + }); }; diff --git a/example/karma.conf.js b/example/karma.conf.js index 3ecd14a7..373274cd 100644 --- a/example/karma.conf.js +++ b/example/karma.conf.js @@ -12,96 +12,96 @@ var configSettings = { }; module.exports = function(config) { - config.set({ + config.set({ - // base path, that will be used to resolve files and exclude - basePath: '', + // base path, that will be used to resolve files and exclude + basePath: '', - // frameworks to use - frameworks: ['mocha'], + // frameworks to use + frameworks: ['mocha'], - // list of files / patterns to load in the browser - files: [ - 'test/index.js' - ], + // list of files / patterns to load in the browser + files: [ + 'test/index.js' + ], - // list of preprocessors - preprocessors: { - 'test/*': ['webpack'] - }, + // list of preprocessors + preprocessors: { + 'test/*': ['webpack'] + }, - webpack: { - resolve: { - extensions: ["", ".js", ".coffee"] + webpack: { + resolve: { + extensions: ["", ".js", ".coffee"] + }, + module: { + loaders: [ + { test: /\.coffee$/, loader: "coffee-loader" } + ] + } }, - module: { - loaders: [ - { test: /\.coffee$/, loader: "coffee-loader" } - ] - } - }, - webpackMiddleware: { - stats: { - colors: true - } - }, + webpackMiddleware: { + stats: { + colors: true + } + }, - // test results reporter to use - // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' - reporters: ['spec'], + // test results reporter to use + // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' + reporters: ['spec'], - // web server port - port: 9876, + // web server port + port: 9876, - // enable / disable colors in the output (reporters and logs) - colors: true, + // enable / disable colors in the output (reporters and logs) + colors: true, - // level of logging - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_INFO, + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, - // enable / disable watching file and executing tests whenever any file changes - autoWatch: true, + // enable / disable watching file and executing tests whenever any file changes + autoWatch: true, - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera (has to be installed with `npm install karma-opera-launcher`) - // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) - // - PhantomJS - // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) - browsers: ['Chrome'], + // Start these browsers, currently available: + // - Chrome + // - ChromeCanary + // - Firefox + // - Opera (has to be installed with `npm install karma-opera-launcher`) + // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`) + // - PhantomJS + // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`) + browsers: ['Chrome'], - // If browser does not capture in given timeout [ms], kill it - captureTimeout: 60000, + // If browser does not capture in given timeout [ms], kill it + captureTimeout: 60000, - // Continuous Integration mode - // if true, it capture browsers, run tests and exit - singleRun: false, + // Continuous Integration mode + // if true, it capture browsers, run tests and exit + singleRun: false, - // List plugins explicitly, since autoloading karma-webpack - // won't work here - plugins: [ - require("karma-mocha"), - require("karma-spec-reporter"), - require("karma-chrome-launcher"), - require("../") - ] - }); + // List plugins explicitly, since autoloading karma-webpack + // won't work here + plugins: [ + require("karma-mocha"), + require("karma-spec-reporter"), + require("karma-chrome-launcher"), + require("../") + ] + }); }; diff --git a/example/test/aTest.js b/example/test/aTest.js index 692630fa..e32e2a77 100644 --- a/example/test/aTest.js +++ b/example/test/aTest.js @@ -21,4 +21,4 @@ describe("a-test", function() { }); if(!test) throw new Error("Chunk should be async"); }); -}); \ No newline at end of file +}); diff --git a/example/test/index.js b/example/test/index.js index fb813a40..1740381a 100644 --- a/example/test/index.js +++ b/example/test/index.js @@ -1,2 +1,2 @@ var testsContext = require.context(".", true, /Test$/); -testsContext.keys().forEach(testsContext); \ No newline at end of file +testsContext.keys().forEach(testsContext); diff --git a/example/test/separate.js b/example/test/separate.js index 8926fff4..e2cd89df 100644 --- a/example/test/separate.js +++ b/example/test/separate.js @@ -2,4 +2,4 @@ describe("separate-test", function() { it("should run the test", function() { var ok = 1; }); -}); \ No newline at end of file +}); diff --git a/mocha-env-loader.js b/mocha-env-loader.js index fcca33cd..6545cf18 100644 --- a/mocha-env-loader.js +++ b/mocha-env-loader.js @@ -5,14 +5,15 @@ var loaderUtils = require("loader-utils"); module.exports = function(content, map) { this.cacheable(); + var sourceNode; var id = this.options.name; if(!id) this.callback(null, content, map); if(map) { - var sourceNode = SourceNode.fromSourceWithMap(content, map); + sourceNode = SourceNode.fromSourceWithMap(content, map); } else { var fileName = loaderUtils.getRemainingRequest(this); - var sourceNode = new SourceNode(null, null, null); + sourceNode = new SourceNode(null, null, null); content.split("\n").forEach(function(line, idx) { sourceNode.add(new SourceNode(idx + 1, 0, fileName, line + "\n")); }) From ff7d9a1ecb52f5485dbee255f04f1b9517e5e16f Mon Sep 17 00:00:00 2001 From: Will Farley Date: Sun, 24 Jul 2016 12:01:20 -0400 Subject: [PATCH 2/2] Fix eslint path --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c5b16088..d9864da0 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "scripts": { "pretest": "npm run lint && npm run beautify-lint", - "lint": "eslint lib", + "lint": "eslint example index.js mocha-env-loader.js", "beautify-lint": "beautify-lint *.js" }, "license": "MIT",