This repository has been archived by the owner on Sep 28, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from JamesHenry/master
Update ESLint peerDependency and add support for auto-fixing Close #64
- Loading branch information
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
var test = require("tape") | ||
var webpack = require("webpack") | ||
var assign = require("object-assign") | ||
var conf = require("./utils/conf") | ||
var fs = require("fs") | ||
|
||
// clone the "fixable" file, so that we do not lose the original contents | ||
// when the fixes are applied to disk | ||
test("setup", function(t) { | ||
fs | ||
.createReadStream("./test/fixtures/fixable.js") | ||
.pipe(fs.createWriteStream("./test/fixtures/fixable-clone.js")) | ||
|
||
t.end() | ||
}) | ||
|
||
test("loader doesn't throw error if file ok after auto-fixing", function(t) { | ||
webpack(assign({}, | ||
conf, | ||
{ | ||
entry: "./test/fixtures/fixable-clone.js", | ||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.js$/, | ||
loader: "./index?fix=true", | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
} | ||
), | ||
function(err, stats) { | ||
if (err) { | ||
throw err | ||
} | ||
// console.log(stats.compilation.errors) | ||
t.notOk(stats.hasErrors(), "a good file doesn't give any error") | ||
// console.log(stats.compilation.warnings) | ||
t.notOk(stats.hasWarnings(), "a good file doesn't give any warning") | ||
t.end() | ||
}) | ||
}) | ||
|
||
// remove the clone | ||
test("teardown", function(t) { | ||
fs.unlinkSync("./test/fixtures/fixable-clone.js") | ||
t.end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
function foo() { | ||
return true; | ||
} | ||
|
||
foo(); |