eslint-plugin-smarthr 0.2.1 → 0.2.2

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.2.2](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.2.1...v0.2.2) (2022-08-18)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * redundant-name rule の allowedNames オプションが適用されないバグがあったため修正する ([#23](https://github.com/kufu/eslint-plugin-smarthr/issues/23)) ([86a7bc5](https://github.com/kufu/eslint-plugin-smarthr/commit/86a7bc548398261885f31c75b56d8edffe5017c3))
11
+
5
12
  ### [0.2.1](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.2.0...v0.2.1) (2022-08-15)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-smarthr",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "author": "SmartHR",
5
5
  "license": "MIT",
6
6
  "description": "A sharable ESLint plugin for SmartHR",
@@ -203,7 +203,7 @@ const handleReportBetterName = ({
203
203
  }
204
204
 
205
205
  const generateTypeRedundant = (args) => {
206
- const { context } = args
206
+ const { context, filename } = args
207
207
  const key = 'type'
208
208
  const redundantKeywords = generateRedundantKeywords({ args, key })
209
209
  const option = args.option[key]
@@ -211,6 +211,14 @@ const generateTypeRedundant = (args) => {
211
211
 
212
212
  return (node) => {
213
213
  const typeName = node.id.name
214
+
215
+ if (
216
+ option.allowedNames &&
217
+ Object.entries(option.allowedNames).find(([regex, calcs]) => filename.match(new RegExp(regex)) && calcs.find((c) => c === typeName))
218
+ ) {
219
+ return
220
+ }
221
+
214
222
  const suffix = option.suffix || defaultConfig.SUFFIX
215
223
 
216
224
  let SuffixedName = typeName