eslint-plugin-smarthr 0.3.22 → 0.3.23

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.23](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.3.22...v0.3.23) (2024-01-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * import内で型の場合はtype kindを設定することでasでの命名縛りを回避できるように修正 ([#102](https://github.com/kufu/eslint-plugin-smarthr/issues/102)) ([689d7da](https://github.com/kufu/eslint-plugin-smarthr/commit/689d7da9e899b2801ae2dfdfd465f6cfcc277e85))
11
+
5
12
  ### [0.3.22](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.3.21...v0.3.22) (2024-01-16)
6
13
 
7
14
 
@@ -27,13 +27,14 @@ const generateTagFormatter = ({ context, EXPECTED_NAMES, UNEXPECTED_NAMES }) =>
27
27
  }) : []
28
28
 
29
29
 
30
- const checkImportedNameToLocalName = (node, base, extended, mode) => {
30
+ const checkImportedNameToLocalName = (node, base, extended, isImport) => {
31
31
  entriesesTagNames.forEach(([b, e]) => {
32
32
  if (base.match(b) && !extended.match(e)) {
33
33
  context.report({
34
34
  node,
35
- message: `${extended}を正規表現 "${e.toString()}" がmatchする名称に変更してください。
36
- - ${base}が型の場合、'${mode} type { ${base} as ${extended} }' もしくは '${mode} { type ${base} as ${extended} }' のように明示的に型であることを宣言してください。名称変更が不要になります`,
35
+ message: `${extended}を正規表現 "${e.toString()}" がmatchする名称に変更してください。${isImport ? `
36
+ - ${base}が型の場合、'import type { ${base} as ${extended} }' もしくは 'import { type ${base} as ${extended} }' のように明示的に型であることを宣言してください。名称変更が不要になります
37
+ ` : ''}`,
37
38
  });
38
39
  }
39
40
  })
@@ -46,7 +47,7 @@ const generateTagFormatter = ({ context, EXPECTED_NAMES, UNEXPECTED_NAMES }) =>
46
47
  if (node.importKind !== 'type') {
47
48
  node.specifiers.forEach((s) => {
48
49
  if (s.importKind !== 'type' && s.imported && s.imported.name !== s.local.name) {
49
- checkImportedNameToLocalName(node, s.imported.name, s.local.name, 'import')
50
+ checkImportedNameToLocalName(node, s.imported.name, s.local.name, true)
50
51
  }
51
52
  })
52
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-smarthr",
3
- "version": "0.3.22",
3
+ "version": "0.3.23",
4
4
  "author": "SmartHR",
5
5
  "license": "MIT",
6
6
  "description": "A sharable ESLint plugin for SmartHR",