forked from eslint/eslint-transforms
-
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.
Chore: refactor so adding transforms is easier (fixes eslint#9)
To add a new transform: 1. Create a directory under tests/fixtures/transforms 2. Add the test fixtures (*.input.js, *.output.js, and *.md) 3. Implement the transform in lib/transforms There's no need to create new (Mocha) test file. At this point, documenting the transform is still manual, but it could be easily automated.
- Loading branch information
Patrick McElhaney
authored and
Patrick McElhaney
committed
Dec 31, 2017
1 parent
1dc288b
commit a4514ad
Showing
30 changed files
with
87 additions
and
35 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
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
tests/fixtures/transforms/new-rule-format/already-transformed.input.md
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 that the transform doesn't fail if the rule was already in the new format |
File renamed without changes.
File renamed without changes.
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 that the transform also works when the rule definition is an arrow function |
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
tests/fixtures/transforms/new-rule-format/custom-identifier-context.md
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,5 @@ | ||
tests that the transform can handle rules that use an identifier for the "context" object that is not "context", e.g.: | ||
|
||
```js | ||
customContextName.report({ ... }); | ||
``` |
File renamed without changes.
File renamed without changes.
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 that the transform can detect that a rule is fixable |
File renamed without changes.
File renamed without changes.
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 that the transform can handle rules that have no schema being exported |
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
tests/fixtures/transforms/new-rule-format/schema-uses-variables.md
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 that the transform can handle rules that have a schema definition that depends on variables that were declared above it |
File renamed without changes.
File renamed without changes.
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 basic functionality of the transform |
File renamed without changes.
File renamed without changes.
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 that the transform can handle comments in different nodes that will be moved around |
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions
7
tests/fixtures/transforms/new-rule-format/wrapped-in-function.md
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 @@ | ||
tests that the transform works when the rule definition is wrapped in a function: | ||
|
||
```js | ||
module.exports = doSomething(function(context) { | ||
return { ... }; | ||
}); | ||
``` |
File renamed without changes.
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