forked from un-ts/eslint-plugin-import-x
-
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.
Initial config files + a hello-world-y test rule to get my feet wet.
- Loading branch information
Showing
6 changed files
with
73 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[*] | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.js] | ||
indent_style = space | ||
end_of_line = lf |
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,3 @@ | ||
--- | ||
env: | ||
node: 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,3 @@ | ||
exports.rules = { | ||
"test-import-visitor": require("./lib/rules/test-import-visitor") | ||
}; |
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 @@ | ||
module.exports = function (context) { | ||
return { | ||
"ImportDeclaration": function (node) { | ||
context.report(node, "This is an import!"); | ||
} | ||
}; | ||
}; |
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,33 @@ | ||
{ | ||
"name": "eslint-plugin-import", | ||
"version": "0.0.1", | ||
"description": "Import with sanity.", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"scripts": { | ||
"test": "mocha --recursive tests/" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/benmosher/eslint-plugin-import" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"eslintplugin", | ||
"es6", | ||
"jsnext" | ||
], | ||
"author": "Ben Mosher (me@benmosher.com)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/benmosher/eslint-plugin-import/issues" | ||
}, | ||
"homepage": "https://github.com/benmosher/eslint-plugin-import", | ||
"devDependencies": { | ||
"eslint": "^0.17.0", | ||
"eslint-tester": "^0.6.0", | ||
"mocha": "^2.2.1" | ||
} | ||
} |
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,19 @@ | ||
"use strict"; | ||
|
||
var linter = require("eslint").linter, | ||
ESLintTester = require("eslint-tester"), | ||
eslintTester = new ESLintTester(linter); | ||
|
||
eslintTester.addRuleTest("lib/rules/test-import-visitor", { | ||
valid: [ | ||
"var validVariable = true;", | ||
], | ||
|
||
invalid: [ | ||
{ | ||
code: "import foo from 'bar'", | ||
ecmaFeatures: { modules: true }, | ||
errors: [ { message: "This is an import!" } ] | ||
} | ||
] | ||
}); |