eslint-plugin-smarthr 3.5.0 → 3.5.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,14 @@
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
+ ## [3.5.1](https://github.com/kufu/tamatebako/compare/eslint-plugin-smarthr-v3.5.0...eslint-plugin-smarthr-v3.5.1) (2025-12-31)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * best-practice-for-rest-parameters で残余引数をarrow functionでreturnする場合誤検知されていた問題を修正 ([#988](https://github.com/kufu/tamatebako/issues/988)) ([4353323](https://github.com/kufu/tamatebako/commit/4353323e1cc37761dbc841023f5b1575ca3e38cc))
11
+ * best-practice-for-rest-parameters で残余引数をreturnする場合誤検知されていた問題を修正 ([#986](https://github.com/kufu/tamatebako/issues/986)) ([9ff646c](https://github.com/kufu/tamatebako/commit/9ff646c10c6ca9c28eff111b837fa6030003ac2a))
12
+
5
13
  ## [3.5.0](https://github.com/kufu/tamatebako/compare/eslint-plugin-smarthr-v3.4.0...eslint-plugin-smarthr-v3.5.0) (2025-12-26)
6
14
 
7
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-smarthr",
3
- "version": "3.5.0",
3
+ "version": "3.5.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": "2709611af1e9178d321a0fbfc6564e2cbc454c72"
40
+ "gitHead": "ca09d161140518cc79de3365fab83b93ff883da7"
41
41
  }
@@ -47,9 +47,14 @@ module.exports = {
47
47
  message: `残余引数には ${REST_REGEX} とマッチする名称を指定してください${DETAIL_LINK}`,
48
48
  })
49
49
  },
50
- [`:not(:matches(RestElement,JSXSpreadAttribute,JSXSpreadAttribute>TSAsExpression,SpreadElement,SpreadElement>TSAsExpression,MemberExpression,VariableDeclarator,ArrayExpression,CallExpression,ObjectPattern>Property,ObjectExpression>Property))>Identifier[name=${REST_REGEX}]`]: actionNotRest,
50
+ [`:not(:matches(RestElement,JSXSpreadAttribute,JSXSpreadAttribute>TSAsExpression,SpreadElement,SpreadElement>TSAsExpression,MemberExpression,VariableDeclarator,ArrayExpression,CallExpression,ObjectPattern>Property,ObjectExpression>Property,ReturnStatement,ArrowFunctionExpression))>Identifier[name=${REST_REGEX}]`]: actionNotRest,
51
51
  [`:matches(VariableDeclarator[id.name=${REST_REGEX}],ObjectPattern>Property[value.name=${REST_REGEX}],ObjectExpression>Property[key.name=${REST_REGEX}])`]: actionNotRest,
52
52
  [`MemberExpression[object.name=${REST_REGEX}]`]: actionMemberExpressionName,
53
+ [`ArrowFunctionExpression>Identifier[name=${REST_REGEX}]`]: (node) => {
54
+ if (node !== node.parent.body) {
55
+ actionNotRest(node)
56
+ }
57
+ },
53
58
  [`VariableDeclarator[id.type='ObjectPattern'][init.name=${REST_REGEX}]`]: (node) => {
54
59
  context.report({
55
60
  node,
@@ -32,6 +32,13 @@ ruleTester.run('best-practice-for-rest-parameters', rule, {
32
32
  { code: `const hoge = [rest]` },
33
33
  { code: `hoge(fugaRest)` },
34
34
  { code: `<Any {...rest} />` },
35
+ { code: `
36
+ const removeKey = (key, obj) => {
37
+ const { [key]: _removed, ...rest } = obj
38
+ return rest
39
+ }
40
+ ` },
41
+ { code: `const removeIdAttr = ({ id: _id, ...rest }) => rest` },
35
42
  ],
36
43
  invalid: [
37
44
  { code: `const hoge = ({ ...rest }) => {}`, errors: [ { message: `意味のない残余引数のため、単一の引数に変更してください${DETAIL_LINK}` } ] },