eslint-plugin-strict-dependencies 0.0.2 → 1.0.0
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,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-strict-dependencies",
|
|
3
3
|
"description": "ESlint plugin to define custom module dependency rules.",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/knowledge-work/eslint-plugin-strict-dependencies.git"
|
|
8
8
|
},
|
|
9
|
-
|
|
9
|
+
"keywords": [
|
|
10
10
|
"eslint",
|
|
11
11
|
"eslintplugin",
|
|
12
12
|
"lint",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"is-glob": "^4.0.3",
|
|
29
29
|
"jest": "^27.2.4",
|
|
30
|
-
"micromatch": "^4.0.4"
|
|
30
|
+
"micromatch": "^4.0.4",
|
|
31
|
+
"require-strip-json-comments": "^2.0.0"
|
|
31
32
|
},
|
|
32
33
|
"scripts": {
|
|
33
34
|
"test": "jest --coverage"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
|
|
3
|
-
const fs = require('fs')
|
|
4
3
|
const path = require('path')
|
|
4
|
+
const parseJSON = require('require-strip-json-comments')
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* import文のrootからのパスを求める
|
|
@@ -13,9 +13,9 @@ module.exports = (importPath, relativeFilePath) => {
|
|
|
13
13
|
// Load tsconfig option
|
|
14
14
|
// MEMO: tscとか使って簡単に読める方法がありそう
|
|
15
15
|
try {
|
|
16
|
-
const
|
|
16
|
+
const tsConfigFilePath = path.join(process.cwd(), '/tsconfig.json')
|
|
17
17
|
// Exists ts config
|
|
18
|
-
const tsConfig =
|
|
18
|
+
const tsConfig = parseJSON(tsConfigFilePath)
|
|
19
19
|
if (tsConfig.compilerOptions && tsConfig.compilerOptions.paths) {
|
|
20
20
|
Object.keys(tsConfig.compilerOptions.paths).forEach((key) => {
|
|
21
21
|
// FIXME: このlint ruleではimport先が存在するかチェックしておらず、複数のパスから正しい方を選択できないため[0]固定
|