|
| 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 | + |
1 | 11 | module.exports = {
|
2 | 12 | root: true,
|
3 | 13 | plugins: ['@typescript-eslint', 'jest', 'import'],
|
@@ -25,14 +35,25 @@ module.exports = {
|
25 | 35 | // Prevent importing the default as if it were named
|
26 | 36 | 'import/no-named-default': 'error',
|
27 | 37 | // Forbid a module from importing itself
|
28 |
| - 'import/no-self-import': 'error' |
| 38 | + 'import/no-self-import': 'error', |
29 | 39 |
|
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 |
31 | 44 | // 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 | + ] |
36 | 57 | },
|
37 | 58 | overrides: [
|
38 | 59 | {
|
|
0 commit comments