eslint-plugin-smarthr 0.3.5 → 0.3.6
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.3.6](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.3.5...v0.3.6) (2023-08-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* .eslintrc.js などの設定からparserOptions.project が設定されている場合、tsconfig.jsonの読み込み先を変更する ([#68](https://github.com/kufu/eslint-plugin-smarthr/issues/68)) ([3897faf](https://github.com/kufu/eslint-plugin-smarthr/commit/3897fafbf3bf8ccdc42a06700ff832ec97dc7ff1))
|
|
11
|
+
|
|
5
12
|
### [0.3.5](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.3.4...v0.3.5) (2023-07-28)
|
|
6
13
|
|
|
7
14
|
|
package/libs/common.js
CHANGED
|
@@ -3,13 +3,29 @@ const path = require('path')
|
|
|
3
3
|
const fs = require('fs')
|
|
4
4
|
|
|
5
5
|
const replacePaths = (() => {
|
|
6
|
-
const
|
|
6
|
+
const cwd = process.cwd()
|
|
7
|
+
const eslintrc = (() => {
|
|
8
|
+
let file = `${cwd}/.eslintrc.js`
|
|
9
|
+
if (fs.existsSync(file)) {
|
|
10
|
+
return require(file)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
file = `${cwd}/.eslintrc`
|
|
14
|
+
|
|
15
|
+
if (fs.existsSync(file)) {
|
|
16
|
+
return JSON5.parse(fs.readFileSync(file))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return {}
|
|
20
|
+
})()
|
|
21
|
+
|
|
22
|
+
const tsconfigFile = `${cwd}/${eslintrc.parserOptions?.project || 'tsconfig.json'}`
|
|
7
23
|
|
|
8
|
-
if (!
|
|
9
|
-
throw new Error(
|
|
24
|
+
if (!fs.existsSync(tsconfigFile)) {
|
|
25
|
+
throw new Error(`${tsconfigFile} を設置してください`)
|
|
10
26
|
}
|
|
11
27
|
|
|
12
|
-
const { compilerOptions } = JSON5.parse(
|
|
28
|
+
const { compilerOptions } = JSON5.parse(fs.readFileSync(tsconfigFile))
|
|
13
29
|
|
|
14
30
|
if (!compilerOptions || !compilerOptions.paths) {
|
|
15
31
|
throw new Error('tsconfig.json の compilerOptions.paths に `"@/*": ["any_path/*"]` 形式でフロントエンドのroot dir を指定してください')
|
package/package.json
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
## config
|
|
9
9
|
|
|
10
10
|
- tsconfig.json の compilerOptions.pathsに '@/*', もしくは '~/*' としてroot path を指定する必要があります
|
|
11
|
+
- tsconfig.json はデフォルトではコマンド実行をしたディレクトリから読み込みます
|
|
12
|
+
- tsconfig.json の設置ディレクトリを変更したい場合、 `.eslintrc` などのeslint設定ファイルに `parserOptions.project` を設定してください
|
|
11
13
|
- ドメインを識別するために以下の設定を記述する必要があります
|
|
12
14
|
- globalModuleDir
|
|
13
15
|
- 全体で利用するファイルを収めているディレクトリを相対パスで指定します
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
## config
|
|
8
8
|
|
|
9
9
|
- tsconfig.json の compilerOptions.pathsに '@/*', もしくは '~/*' としてroot path を指定する必要があります
|
|
10
|
+
- tsconfig.json はデフォルトではコマンド実行をしたディレクトリから読み込みます
|
|
11
|
+
- tsconfig.json の設置ディレクトリを変更したい場合、 `.eslintrc` などのeslint設定ファイルに `parserOptions.project` を設定してください
|
|
10
12
|
- ドメインを識別するために以下の設定を記述する必要があります
|
|
11
13
|
- globalModuleDir
|
|
12
14
|
- 全体で利用するファイルを収めているディレクトリを相対パスで指定します
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
## config
|
|
7
7
|
|
|
8
8
|
- tsconfig.json の compilerOptions.pathsに '@/*', もしくは '~/*' としてroot path を指定する必要があります
|
|
9
|
+
- tsconfig.json はデフォルトではコマンド実行をしたディレクトリから読み込みます
|
|
10
|
+
- tsconfig.json の設置ディレクトリを変更したい場合、 `.eslintrc` などのeslint設定ファイルに `parserOptions.project` を設定してください
|
|
9
11
|
- 以下の設定を行えます。全て省略可能です。
|
|
10
12
|
- ignoreKeywords
|
|
11
13
|
- ディレクトリ名から生成されるキーワードに含めたくない文字列を指定します
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# smarthr/require-barrel-import
|
|
2
2
|
|
|
3
3
|
- tsconfig.json の compilerOptions.pathsに '@/*', もしくは '~/*' としてroot path を指定する必要があります
|
|
4
|
+
- tsconfig.json はデフォルトではコマンド実行をしたディレクトリから読み込みます
|
|
5
|
+
- tsconfig.json の設置ディレクトリを変更したい場合、 `.eslintrc` などのeslint設定ファイルに `parserOptions.project` を設定してください
|
|
4
6
|
- importした対象が本来exportされているべきであるbarrel(index.tsなど)が有る場合、import pathの変更を促します
|
|
5
7
|
- 例: Page/parts/Menu/Item の import は Page/parts/Menu から行わせたい
|
|
6
8
|
- ディレクトリ内のindexファイルを捜査し、対象を決定します
|