eslint-plugin-smarthr 0.3.4 → 0.3.5

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.5](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.3.4...v0.3.5) (2023-07-28)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * a11y-heading-in-sectioning-content で Heading系コンポーネントの拡張をexportしている場合、正しく除外されないバグを修正 ([#67](https://github.com/kufu/eslint-plugin-smarthr/issues/67)) ([a4b8e6d](https://github.com/kufu/eslint-plugin-smarthr/commit/a4b8e6d1081b1e96ad574153805f86d5f7551c5e))
11
+
5
12
  ### [0.3.4](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.3.3...v0.3.4) (2023-07-18)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-smarthr",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "author": "SmartHR",
5
5
  "license": "MIT",
6
6
  "description": "A sharable ESLint plugin for SmartHR",
@@ -19,6 +19,7 @@ const bareTagRegex = /^(article|aside|nav|section)$/
19
19
  const modelessDialogRegex = /ModelessDialog$/
20
20
 
21
21
  const noHeadingTagNames = ['span', 'legend']
22
+ const ignoreHeadingCheckParentType = ['Program', 'ExportNamedDeclaration']
22
23
 
23
24
  const headingMessage = `smarthr-ui/Headingと紐づく内容の範囲(アウトライン)が曖昧になっています。
24
25
  - smarthr-uiのArticle, Aside, Nav, SectionのいずれかでHeadingコンポーネントと内容をラップしてHeadingに対応する範囲を明確に指定してください。`
@@ -48,7 +49,7 @@ const searchBubbleUp = (node) => {
48
49
 
49
50
  if (
50
51
  // Headingコンポーネントの拡張なので対象外
51
- node.type === 'VariableDeclarator' && node.parent.parent?.type === 'Program' && node.id.name.match(declaratorHeadingRegex) ||
52
+ node.type === 'VariableDeclarator' && ignoreHeadingCheckParentType.includes(node.parent.parent?.type) && node.id.name.match(declaratorHeadingRegex) ||
52
53
  // ModelessDialogのheaderにHeadingを設定している場合も対象外
53
54
  node.type === 'JSXAttribute' && node.name.name === 'header' && node.parent.name.name.match(modelessDialogRegex)
54
55
  ) {
@@ -38,6 +38,7 @@ ruleTester.run('a11y-heading-in-sectioning-content', rule, {
38
38
  { code: '<Section><Heading>hoge</Heading></Section>' },
39
39
  { code: '<><Section><Heading>hoge</Heading></Section><Section><Heading>fuga</Heading></Section></>' },
40
40
  { code: 'const HogeHeading = () => <FugaHeading anyArg={abc}>hoge</FugaHeading>' },
41
+ { code: 'export const HogeHeading = () => <FugaHeading anyArg={abc}>hoge</FugaHeading>' },
41
42
  ],
42
43
  invalid: [
43
44
  { code: `import hoge from 'styled-components'`, errors: [ { message: `styled-components をimportする際は、名称が"styled" となるようにしてください。例: "import styled from 'styled-components'"` } ] },