Skip to content

Commit 938d144

Browse files
committed
[added] 'lodash-compat' into the check list
1 parent b3b77e0 commit 938d144

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Finally, enable all of the rules that you would like to use.
4444

4545
# List of supported rules
4646

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

4949
## To Do
5050

src/rules/import.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
export default function(context) {
88
return {
99
ImportDeclaration(node) {
10-
if (node.source.value === 'lodash') {
10+
if (node.source.value === 'lodash' || node.source.value === 'lodash-compat') {
1111
context.report(node.source, 'Importing the entire lodash library is not permitted, please import the specific functions you need');
1212
}
1313
}

test/rules/import.Spec.js

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ ruleTester.run('lodash/import', rule, {
3939
message: 'Importing the entire lodash library is not permitted, please import the specific functions you need'
4040
}]
4141
},
42+
{
43+
code: 'import "lodash-compat"',
44+
parser: 'babel-eslint',
45+
errors: [{
46+
message: 'Importing the entire lodash library is not permitted, please import the specific functions you need'
47+
}]
48+
},
4249
{
4350
code: 'import _ from "lodash"',
4451
parser: 'babel-eslint',

0 commit comments

Comments
 (0)