Skip to content

Commit 7816731

Browse files
lencioniljharb
authored andcommitted
Allow importing devDependencies in tests
This rule seems to be giving me errors for some places we have imported devDependencies in our tests such as tape and eslint. This is actually okay, so we just need to configure this rule to allow devDependencies for tests. While I was at it, I added some whitespace to improve readability and reduce the likelihood of merge conflicts.
1 parent 6db1af1 commit 7816731

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

packages/eslint-config-airbnb/test/.eslintrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
// disabled because I find it tedious to write tests while following this
44
// rule
55
"no-shadow": 0,
6+
67
// tests uses `t` for tape
7-
"id-length": [2, {"min": 2, "properties": "never", "exceptions": ["t"]}]
8+
"id-length": [2, {"min": 2, "properties": "never", "exceptions": ["t"]}],
9+
10+
// tests can import things in devDependencies
11+
"import/no-extraneous-dependencies": [2, {"devDependencies": true}]
812
}
913
}

packages/eslint-config-airbnb/test/test-react-order.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ const cli = new CLIEngine({
88
useEslintrc: false,
99
baseConfig: eslintrc,
1010

11-
// This rule fails when executing on text.
12-
rules: { indent: 0 },
11+
rules: {
12+
// This rule fails when executing on text.
13+
indent: 0,
14+
15+
// It is okay to import devDependencies in tests.
16+
'import/no-extraneous-dependencies': [2, { devDependencies: true }],
17+
},
1318
});
1419

1520
function lint(text) {

0 commit comments

Comments
 (0)