Skip to content

Commit

Permalink
[added] 'lodash-compat' into the check list
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKVal committed Sep 21, 2015
1 parent b3b77e0 commit 938d144
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Finally, enable all of the rules that you would like to use.

# List of supported rules

* [import](docs/rules/import.md): Prevent importing the entire lodash library.
* [import](docs/rules/import.md): Prevent importing the entire lodash (or lodash-compat) library.

## To Do

Expand Down
2 changes: 1 addition & 1 deletion src/rules/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
export default function(context) {
return {
ImportDeclaration(node) {
if (node.source.value === 'lodash') {
if (node.source.value === 'lodash' || node.source.value === 'lodash-compat') {
context.report(node.source, 'Importing the entire lodash library is not permitted, please import the specific functions you need');
}
}
Expand Down
7 changes: 7 additions & 0 deletions test/rules/import.Spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ ruleTester.run('lodash/import', rule, {
message: 'Importing the entire lodash library is not permitted, please import the specific functions you need'
}]
},
{
code: 'import "lodash-compat"',
parser: 'babel-eslint',
errors: [{
message: 'Importing the entire lodash library is not permitted, please import the specific functions you need'
}]
},
{
code: 'import _ from "lodash"',
parser: 'babel-eslint',
Expand Down

0 comments on commit 938d144

Please sign in to comment.