-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
281 additions
and
38 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,117 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`rule with accepted autofix should display errors before and code after fix 1`] = ` | ||
"Original code: | ||
======================== | ||
const namedFooSecond = 'fixed' | ||
~~~~~~~~~~~~~~ [1] | ||
[1] variable name 'namedFooSecond' should not include 'foo'. | ||
Code after applying fixes: | ||
========================== | ||
const namedBarSecond = 'fixed' | ||
" | ||
`; | ||
|
||
exports[`rule with nested reports and accepted autofix should display errors before and code after fix 1`] = ` | ||
"Original code: | ||
======================== | ||
class SomethingFooSecond { | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~ [1] | ||
multiline() { | ||
~~~~~~~~~~~~~~~~~ [1] | ||
const foo = 42; | ||
~~~~~~~~~~~~~~~~~~~~~~~ [1] | ||
~~~ [2] | ||
} | ||
~~~~~ [1] | ||
} | ||
~ [1] | ||
[1] class name 'SomethingFooSecond' should not include 'foo'. | ||
[2] variable name 'foo' should not include 'foo'. | ||
Code after applying fixes: | ||
========================== | ||
class SomethingBarSecond { | ||
multiline() { | ||
const bar = 42; | ||
} | ||
} | ||
" | ||
`; | ||
|
||
exports[`rule with nested reports and unaccepted autofix should display errors normally 1`] = ` | ||
" | ||
class SomethingFooFirst { | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ [1] | ||
multiline() { | ||
~~~~~~~~~~~~~~~~~ [1] | ||
const foo = 42; | ||
~~~~~~~~~~~~~~~~~~~~~~~ [1] | ||
~~~ [2] | ||
} | ||
~~~~~ [1] | ||
} | ||
~ [1] | ||
[1] class name 'SomethingFooFirst' should not include 'foo'. | ||
[2] variable name 'foo' should not include 'foo'." | ||
`; | ||
|
||
exports[`rule with unaccepted autofix should display errors normally 1`] = ` | ||
" | ||
const namedFooFirst = 'not fixed' | ||
~~~~~~~~~~~~~ [1] | ||
[1] variable name 'namedFooFirst' should not include 'foo'." | ||
`; | ||
|
||
exports[`rule with unstable fix should show remaining errors after applying fix 1`] = ` | ||
"Original code: | ||
======================== | ||
class SomethingFooThird { | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ [1] | ||
multiline() { | ||
~~~~~~~~~~~~~~~~~ [1] | ||
const foo = 42; | ||
~~~~~~~~~~~~~~~~~~~~~~~ [1] | ||
~~~ [2] | ||
} | ||
~~~~~ [1] | ||
} | ||
~ [1] | ||
[1] class name 'SomethingFooThird' should not include 'foo'. | ||
[2] variable name 'foo' should not include 'foo'. | ||
Code after applying fixes: | ||
========================== | ||
class SomethingFooBarBarBarBarBarBarBarBarBarBarThird { | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [1] | ||
multiline() { | ||
~~~~~~~~~~~~~~~~~ [1] | ||
const foobarbarbarbarbarbarbarbarbarbar = 42; | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [1] | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [2] | ||
} | ||
~~~~~ [1] | ||
} | ||
~ [1] | ||
[1] class name 'SomethingFooBarBarBarBarBarBarBarBarBarBarThird' should not include 'foo'. | ||
[2] variable name 'foobarbarbarbarbarbarbarbarbarbar' should not include 'foo'." | ||
`; |
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,40 @@ | ||
/** | ||
* @test rule with unaccepted autofix should display errors normally | ||
*/ | ||
const namedFooFirst = 'not fixed' | ||
|
||
/** | ||
* @test rule with accepted autofix should display errors before and code after fix | ||
* @acceptFix | ||
*/ | ||
const namedFooSecond = 'fixed' | ||
|
||
/** | ||
* @test rule with nested reports and unaccepted autofix should display errors normally | ||
*/ | ||
class SomethingFooFirst { | ||
multiline() { | ||
const foo = 42; | ||
} | ||
} | ||
|
||
/** | ||
* @test rule with nested reports and accepted autofix should display errors before and code after fix | ||
* @acceptFix | ||
*/ | ||
class SomethingFooSecond { | ||
multiline() { | ||
const foo = 42; | ||
} | ||
} | ||
|
||
/** | ||
* @test rule with unstable fix should show remaining errors after applying fix | ||
* @ruleOptions [{ "badFix": true }] | ||
* @acceptFix | ||
*/ | ||
class SomethingFooThird { | ||
multiline() { | ||
const foo = 42; | ||
} | ||
} |
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 @@ | ||
import { runLintFixtureTests } from '../ruleSnapshotTester' | ||
import { noFooAllowed } from './rules/no-foo-allowed' | ||
|
||
runLintFixtureTests({ | ||
rule: noFooAllowed, | ||
ruleName: 'autofix', | ||
}) |
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