eslint-plugin-smarthr
Advanced tools
Comparing version 0.5.9 to 0.5.10
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.5.10](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.5.9...v0.5.10) (2024-04-26) | ||
### Bug Fixes | ||
* <FormControl> 内に三項演算子がある場合に、入力要素が複数あると誤認されないようにする ([#139](https://github.com/kufu/eslint-plugin-smarthr/issues/139)) ([8a234c7](https://github.com/kufu/eslint-plugin-smarthr/commit/8a234c73e140725ff1926d4d23f64c263e46d5d6)) | ||
### [0.5.9](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.5.7...v0.5.9) (2024-04-22) | ||
@@ -7,0 +14,0 @@ |
{ | ||
"name": "eslint-plugin-smarthr", | ||
"version": "0.5.9", | ||
"version": "0.5.10", | ||
"author": "SmartHR", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -97,2 +97,3 @@ const { generateTagFormatter } = require('../../libs/format_styled_components') | ||
let formControls = [] | ||
let conditionalformControls = [] | ||
let checkboxFormControls = [] | ||
@@ -106,2 +107,3 @@ | ||
const isAdditionalMultiInput = checkAdditionalMultiInputComponents(nodeName) | ||
let conditionalExpressions = [] | ||
@@ -167,2 +169,3 @@ if (isFormControlInput || isAdditionalMultiInput || checkAdditionalInputComponents(nodeName)) { | ||
const hit = formControls.includes(n) | ||
let conditionalHit = false | ||
@@ -172,2 +175,3 @@ if (!hit) { | ||
if (isCheckbox) { | ||
@@ -178,2 +182,10 @@ checkboxFormControls.push(n) | ||
if (conditionalExpressions.length > 0) { | ||
conditionalHit = conditionalformControls.includes(n) | ||
if (!conditionalHit) { | ||
conditionalformControls.push(n) | ||
} | ||
} | ||
const isMultiInput = isPreMultiple || hit || isInMap | ||
@@ -192,3 +204,3 @@ const matcherFormControl = name.match(FORM_CONTROL_REGEX) | ||
}); | ||
} else if (isMultiInput && !openingElement.attributes.find(findRoleGroup)) { | ||
} else if (isMultiInput && !conditionalHit && !openingElement.attributes.find(findRoleGroup)) { | ||
context.report({ | ||
@@ -254,2 +266,6 @@ node: n, | ||
} | ||
case 'ConditionalExpression': { | ||
conditionalExpressions.push(n) | ||
break | ||
} | ||
case 'VariableDeclarator': { | ||
@@ -256,0 +272,0 @@ if (n.parent.parent?.type && n.parent.parent.type.match(IGNORE_INPUT_CHECK_PARENT_TYPE)) { |
@@ -138,2 +138,3 @@ const rule = require('../rules/a11y-input-in-form-control') | ||
{ code: '<Fieldset><HogeCheckBoxes /></Fieldset>' }, | ||
{ code: '<HogeFormControl>{ dateInput ? <DateInput /> : <Input /> }</HogeFormControl>'}, | ||
], | ||
@@ -183,3 +184,5 @@ invalid: [ | ||
{ code: '<HogeFormControl><HogeCheckBoxes /></HogeFormControl>', errors: [ { message: invalidMultiInputsInFormControl() } ] }, | ||
{ code: "<HogeFormControl>{ dateInput ? <DateInput /> : <Input /> }<CheckBox /></HogeFormControl>", errors: [ { message: invalidMultiInputsInFormControl() } ]}, | ||
{ code: "<HogeFormControl><CheckBox />{ dateInput ? <DateInput /> : <Input /> }</HogeFormControl>", errors: [ { message: invalidMultiInputsInFormControl() } ]}, | ||
] | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
401242
101
5788