-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The eslint CLI has a `--max-warnings` option which allows a user to specify the maximun number of warnings after which the lint should fail. This adds this same feature to esprint.
- Loading branch information
1 parent
b597e94
commit fcdc007
Showing
8 changed files
with
61 additions
and
3 deletions.
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
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 @@ | ||
__tests__/* |
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,9 @@ | ||
{ | ||
"rules": { | ||
"no-var": 1 | ||
}, | ||
"env": { | ||
"es6": true | ||
}, | ||
"root": true | ||
} |
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,12 @@ | ||
|
||
{ | ||
"port": 5004 , | ||
"paths": [ | ||
"fixture.js" | ||
], | ||
|
||
"ignored": [ | ||
"**/node_modules/**/*" | ||
], | ||
"maxWarnings": 0 | ||
} |
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,28 @@ | ||
const path = require('path'); | ||
const runEsprint = require('../../runEsprint.js'); | ||
const killProcess = require('../../killProcess.js'); | ||
const getPid = require('../../getPid.js'); | ||
|
||
beforeEach(() => { | ||
killProcess(); | ||
}); | ||
|
||
afterEach(() => { | ||
killProcess(); | ||
}); | ||
|
||
test('Properly lints and returns errors with server', () => { | ||
const results = runEsprint(path.join(__dirname, '..')); | ||
const expectedError = expect.stringContaining('warning Unexpected var, use let or const instead no-var'); | ||
expect(results.error).toBeDefined(); | ||
expect(results.error.stdout.toString()).toEqual(expectedError); | ||
expect(getPid()).toBeDefined(); | ||
}); | ||
|
||
test('Properly lints and returns errors without server', () => { | ||
const results = runEsprint(path.join(__dirname, '..'), 'check'); | ||
const expectedError = expect.stringContaining('warning Unexpected var, use let or const instead no-var'); | ||
expect(results.error).toBeDefined(); | ||
expect(results.error.stdout.toString()).toEqual(expectedError); | ||
expect(getPid()).toBeUndefined(); | ||
}); |
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,2 @@ | ||
var x=0; | ||
console.log(x); |