eslint-plugin-smarthr 1.4.0 → 1.4.1
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
|
+
## [1.4.1](https://github.com/kufu/tamatebako/compare/eslint-plugin-smarthr-v1.4.0...eslint-plugin-smarthr-v1.4.1) (2025-03-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* tailwind-variantsでtv以外のimportを行った際、エラーになる問題を修正する ([#536](https://github.com/kufu/tamatebako/issues/536)) ([83efcf6](https://github.com/kufu/tamatebako/commit/83efcf671938ca471265af9c05bd47fbcce55fb9))
|
|
11
|
+
|
|
5
12
|
## [1.4.0](https://github.com/kufu/tamatebako/compare/eslint-plugin-smarthr-v1.3.0...eslint-plugin-smarthr-v1.4.0) (2025-03-06)
|
|
6
13
|
|
|
7
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-smarthr",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"author": "SmartHR",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A sharable ESLint plugin for SmartHR",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"eslintplugin",
|
|
38
38
|
"smarthr"
|
|
39
39
|
],
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "30434f9943f7dd03272ca3100497c4c3c6bb6fc0"
|
|
41
41
|
}
|
|
@@ -4,7 +4,7 @@ const TV_COMPONENTS_METHOD = 'tv'
|
|
|
4
4
|
const TV_COMPONENTS = 'tailwind-variants'
|
|
5
5
|
const TV_RESULT_CONST_NAME_REGEX = /(C|c)lassNameGenerator$/
|
|
6
6
|
|
|
7
|
-
const findValidImportNameNode = (s) => s.type === 'ImportSpecifier' && s.
|
|
7
|
+
const findValidImportNameNode = (s) => s.type === 'ImportSpecifier' && s.imported.name === TV_COMPONENTS_METHOD && s.local.name !== TV_COMPONENTS_METHOD
|
|
8
8
|
|
|
9
9
|
const checkImportTailwindVariants = (node, context) => {
|
|
10
10
|
}
|
|
@@ -43,7 +43,7 @@ module.exports = {
|
|
|
43
43
|
return {
|
|
44
44
|
ImportDeclaration: (node) => {
|
|
45
45
|
if (node.source.value === TV_COMPONENTS) {
|
|
46
|
-
if (
|
|
46
|
+
if (node.specifiers.some(findValidImportNameNode)) {
|
|
47
47
|
context.report({
|
|
48
48
|
node,
|
|
49
49
|
message: `${TV_COMPONENTS} をimportする際は、名称が"${TV_COMPONENTS_METHOD}" となるようにしてください。例: "import { ${TV_COMPONENTS_METHOD} } from '${TV_COMPONENTS}'"`,
|
|
@@ -14,6 +14,7 @@ const ruleTester = new RuleTester({
|
|
|
14
14
|
ruleTester.run('best-practice-for-button-element', rule, {
|
|
15
15
|
valid: [
|
|
16
16
|
{ code: `import { tv } from 'tailwind-variants'` },
|
|
17
|
+
{ code: `import { defaultConfig } from 'tailwind-variants'` },
|
|
17
18
|
{ code: `const classNameGenerator = tv()` },
|
|
18
19
|
{ code: `const xxxClassNameGenerator = tv()` },
|
|
19
20
|
{ code: `const hoge = useMemo(() => classNameGenerator(), [])` },
|