Skip to content

Commit 3182db5

Browse files
committed
test: enable import/no-extraneous-dependencies
1 parent 01c451c commit 3182db5

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

.eslintrc.js

+27-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
const path = require('path');
2+
const fs = require('fs');
3+
4+
const isDirectory = source => fs.lstatSync(source).isDirectory();
5+
const getDirectories = source =>
6+
fs
7+
.readdirSync(source)
8+
.map(name => path.join(source, name))
9+
.filter(isDirectory);
10+
111
module.exports = {
212
root: true,
313
plugins: ['@typescript-eslint', 'jest', 'import'],
@@ -25,14 +35,25 @@ module.exports = {
2535
// Prevent importing the default as if it were named
2636
'import/no-named-default': 'error',
2737
// Forbid a module from importing itself
28-
'import/no-self-import': 'error'
38+
'import/no-self-import': 'error',
2939

30-
// Enable after https://github.com/benmosher/eslint-plugin-import/issues/1650 is fixed
40+
// This is not working on windows machines
41+
// https://github.com/benmosher/eslint-plugin-import/issues/1650
42+
// and is not reporting all errors due to
43+
// https://github.com/benmosher/eslint-plugin-import/pull/1104
3144
// Forbid the use of extraneous packages
32-
// 'import/no-extraneous-dependencies': [
33-
// 'error',
34-
// {devDependencies: ['**/*.test.js']}
35-
// ]
45+
'import/no-extraneous-dependencies': [
46+
'error',
47+
{
48+
devDependencies: ['**/*.test.js', '**/*.test.ts'],
49+
packageDir: [
50+
__dirname,
51+
...getDirectories(path.join(__dirname, '@packages')),
52+
...getDirectories(path.join(__dirname, '@commitlint')),
53+
...getDirectories(path.join(__dirname, '@alias'))
54+
]
55+
}
56+
]
3657
},
3758
overrides: [
3859
{

0 commit comments

Comments
 (0)