eslint-plugin-strict-dependencies 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-strict-dependencies",
|
|
3
3
|
"description": "ESlint plugin to define custom module dependency rules.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/knowledge-work/eslint-plugin-strict-dependencies.git"
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"is-glob": "^4.0.3",
|
|
29
29
|
"micromatch": "^4.0.4",
|
|
30
|
+
"normalize-path": "^3.0.0",
|
|
30
31
|
"require-strip-json-comments": "^2.0.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const mm = require('micromatch')
|
|
5
5
|
const isGlob = require('is-glob')
|
|
6
|
+
const normalize = require('normalize-path')
|
|
6
7
|
|
|
7
8
|
const resolveImportPath = require('./resolveImportPath')
|
|
8
9
|
|
|
@@ -60,7 +61,7 @@ module.exports = {
|
|
|
60
61
|
|
|
61
62
|
function checkImport(node) {
|
|
62
63
|
const fileFullPath = context.getFilename()
|
|
63
|
-
const relativeFilePath = path.relative(process.cwd(), fileFullPath)
|
|
64
|
+
const relativeFilePath = normalize(path.relative(process.cwd(), fileFullPath))
|
|
64
65
|
const importPath = resolveImportPath(node.source.value, resolveRelativeImport ? relativeFilePath : null)
|
|
65
66
|
|
|
66
67
|
dependencies
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const parseJSON = require('require-strip-json-comments')
|
|
5
|
+
const normalize = require('normalize-path')
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* import文のrootからのパスを求める
|
|
@@ -30,8 +31,10 @@ module.exports = (importPath, relativeFilePath) => {
|
|
|
30
31
|
importPath = path.join(path.dirname(relativeFilePath), importPath)
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
const absolutePath = Object.keys(importAliasMap).reduce((resolvedImportPath, key) => {
|
|
34
35
|
// FIXME: use glob module instead of replace('*')
|
|
35
36
|
return resolvedImportPath.replace(key.replace('*', ''), importAliasMap[key].replace('*', ''))
|
|
36
37
|
}, importPath)
|
|
38
|
+
|
|
39
|
+
return normalize(absolutePath)
|
|
37
40
|
}
|