eslint-plugin-smarthr 0.5.20 → 1.1.0

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +4 -2
  3. package/README.md +35 -35
  4. package/index.js +9 -5
  5. package/package.json +13 -14
  6. package/rules/a11y-input-in-form-control/index.js +3 -0
  7. package/rules/a11y-prohibit-sectioning-content-in-form/index.js +1 -1
  8. package/rules/format-import-path/index.js +2 -2
  9. package/rules/jsx-start-with-spread-attributes/index.js +3 -4
  10. package/rules/prohibit-file-name/index.js +2 -3
  11. package/rules/prohibit-import/index.js +2 -3
  12. package/rules/require-barrel-import/index.js +3 -4
  13. package/rules/require-declaration/README.md +2 -2
  14. package/rules/require-declaration/index.js +3 -4
  15. package/rules/require-export/index.js +1 -2
  16. package/rules/require-import/index.js +3 -4
  17. package/test/a11y-anchor-has-href-attribute.js +5 -7
  18. package/test/a11y-clickable-element-has-text.js +5 -8
  19. package/test/a11y-delegate-element-has-role-presantation.js +6 -7
  20. package/test/a11y-form-control-in-form.js +5 -7
  21. package/test/a11y-heading-in-sectioning-content.js +6 -7
  22. package/test/a11y-image-has-alt-attribute.js +5 -7
  23. package/test/a11y-input-has-name-attribute.js +6 -7
  24. package/test/a11y-input-in-form-control.js +6 -7
  25. package/test/a11y-numbered-text-within-ol.js +5 -7
  26. package/test/a11y-prohhibit-input-placeholder.js +5 -7
  27. package/test/a11y-prohibit-input-maxlength-attribute.js +5 -7
  28. package/test/a11y-prohibit-useless-sectioning-fragment.js +5 -7
  29. package/test/a11y-replace-unreadable-symbol.js +5 -6
  30. package/test/a11y-required-layout-as-attribute.js +5 -6
  31. package/test/a11y-trigger-has-button.js +5 -7
  32. package/test/best-practice-for-button-element.js +5 -7
  33. package/test/best-practice-for-data-test-attribute.js +5 -7
  34. package/test/best-practice-for-date.js +5 -7
  35. package/test/best-practice-for-layouts.js +5 -7
  36. package/test/best-practice-for-remote-trigger-dialog.js +5 -7
  37. package/test/design-system-guideline-prohibit-double-icons.js +5 -7
  38. package/test/format-translate-component.js +5 -7
  39. package/test/prohibit-file-name.js +6 -3
  40. package/test/prohibit-import.js +6 -3
  41. package/test/prohibit-path-within-template-literal.js +6 -3
  42. package/test/require-declaration.js +5 -7
  43. package/test/require-export.js +6 -3
  44. package/test/require-import.js +6 -3
  45. package/test/trim-props.js +5 -3
  46. package/.github/CODEOWNERS +0 -3
  47. package/.node-version +0 -1
  48. package/CODE_OF_CONDUCT.md +0 -89
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
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.1.0](https://github.com/kufu/tamatebako/compare/eslint-plugin-smarthr-v1.0.0...eslint-plugin-smarthr-v1.1.0) (2025-01-08)
6
+
7
+
8
+ ### Features
9
+
10
+ * a11y-input-in-form-controlでtype="hidden"の場合の判定を追加 ([#455](https://github.com/kufu/tamatebako/issues/455)) ([4ff63b9](https://github.com/kufu/tamatebako/commit/4ff63b90b5cba5df34fe5ffc0fb25cbd1ed8a2b3))
11
+
12
+ ## [1.0.0](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.5.20...v1.0.0) (2024-12-12)
13
+
14
+
15
+ ### ⚠ BREAKING CHANGES
16
+
17
+ ESLint v9 及び FlatConfig への対応をしました。
18
+
19
+ これにともない、ESLint v8 以下及び LegacyConfig では利用できなくなりました。
20
+
21
+ * ESLint v9 ([#154](https://github.com/kufu/eslint-plugin-smarthr/issues/154)) ([a0b79fd](https://github.com/kufu/eslint-plugin-smarthr/commit/a0b79fd39fcab103008f9a257fb29d7d0e9c662b))
22
+
5
23
  ### [0.5.20](https://github.com/kufu/eslint-plugin-smarthr/compare/v0.5.18...v0.5.20) (2024-11-25)
6
24
 
7
25
 
package/LICENSE CHANGED
@@ -1,7 +1,9 @@
1
- Copyright 2023 SmartHR, Inc.
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2024 SmartHR
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
6
 
5
7
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
8
 
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,37 +1,37 @@
1
1
  # eslint-plugin-smarthr
2
2
 
3
- - [a11y-anchor-has-href-attribute](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-anchor-has-href-attribute)
4
- - [a11y-clickable-element-has-text](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-clickable-element-has-text)
5
- - [a11y-delegate-element-has-role-presentation](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-delegate-element-has-role-presentation)
6
- - [a11y-form-control-in-form](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-form-control-in-form)
7
- - [a11y-heading-in-sectioning-content](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-heading-in-sectioning-content)
8
- - [a11y-image-has-alt-attribute](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-image-has-alt-attribute)
9
- - [a11y-input-has-name-attribute](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-input-has-name-attribute)
10
- - [a11y-input-in-form-control](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-input-in-form-control)
11
- - [a11y-numbered-text-within-ol](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-numbered-text-within-ol)
12
- - [a11y-prohibit-input-maxlength-attribute](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-prohibit-input-maxlength-attribute)
13
- - [a11y-prohibit-input-placeholder](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-prohibit-input-placeholder)
14
- - [a11y-prohibit-sectioning-content-in-form](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-prohibit-sectioning-content-in-form)
15
- - [a11y-prohibit-useless-sectioning-fragment](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-prohibit-useless-sectioning-fragment)
16
- - [a11y-replace-unreadable-symbol](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-replace-unreadable-symbol)
17
- - [a11y-required-layout-as-attribute](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-required-layout-as-attribute)
18
- - [a11y-trigger-has-button](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-trigger-has-button)
19
- - [best-practice-for-button-element](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/best-practice-for-button-element)
20
- - [best-practice-for-data-test-attribute](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/best-practice-for-data-test-attribute)
21
- - [best-practice-for-date](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/best-practice-for-date)
22
- - [best-practice-for-layouts](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/best-practice-for-layouts)
23
- - [best-practice-for-remote-trigger-dialog](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/best-practice-for-remote-trigger-dialog)
24
- - [design-system-guideline-prohibit-double-icons](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/design-system-guideline-prohibit-double-icons)
25
- - [format-import-path](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/format-import-path)
26
- - [format-translate-component](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/format-translate-component)
27
- - [jsx-start-with-spread-attributes](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/jsx-start-with-spread-attributes)
28
- - [no-import-other-domain](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/no-import-other-domain)
29
- - [prohibit-export-array-type](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/prohibit-export-array-type)
30
- - [prohibit-file-name](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/prohibit-file-name)
31
- - [prohibit-import](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/prohibit-import)
32
- - [prohibit-path-within-template-literal](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/prohibit-path-within-template-literal)
33
- - [require-barrel-import](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/require-barrel-import)
34
- - [require-declaration](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/require-declaration)
35
- - [require-export](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/require-export)
36
- - [require-import](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/require-import)
37
- - [trim-props](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/trim-props)
3
+ - [a11y-anchor-has-href-attribute](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-anchor-has-href-attribute)
4
+ - [a11y-clickable-element-has-text](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-clickable-element-has-text)
5
+ - [a11y-delegate-element-has-role-presentation](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-delegate-element-has-role-presentation)
6
+ - [a11y-form-control-in-form](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-form-control-in-form)
7
+ - [a11y-heading-in-sectioning-content](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-heading-in-sectioning-content)
8
+ - [a11y-image-has-alt-attribute](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-image-has-alt-attribute)
9
+ - [a11y-input-has-name-attribute](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-input-has-name-attribute)
10
+ - [a11y-input-in-form-control](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-input-in-form-control)
11
+ - [a11y-numbered-text-within-ol](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-numbered-text-within-ol)
12
+ - [a11y-prohibit-input-maxlength-attribute](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-prohibit-input-maxlength-attribute)
13
+ - [a11y-prohibit-input-placeholder](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-prohibit-input-placeholder)
14
+ - [a11y-prohibit-sectioning-content-in-form](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-prohibit-sectioning-content-in-form)
15
+ - [a11y-prohibit-useless-sectioning-fragment](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-prohibit-useless-sectioning-fragment)
16
+ - [a11y-replace-unreadable-symbol](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-replace-unreadable-symbol)
17
+ - [a11y-required-layout-as-attribute](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-required-layout-as-attribute)
18
+ - [a11y-trigger-has-button](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/a11y-trigger-has-button)
19
+ - [best-practice-for-button-element](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/best-practice-for-button-element)
20
+ - [best-practice-for-data-test-attribute](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/best-practice-for-data-test-attribute)
21
+ - [best-practice-for-date](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/best-practice-for-date)
22
+ - [best-practice-for-layouts](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/best-practice-for-layouts)
23
+ - [best-practice-for-remote-trigger-dialog](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/best-practice-for-remote-trigger-dialog)
24
+ - [design-system-guideline-prohibit-double-icons](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/design-system-guideline-prohibit-double-icons)
25
+ - [format-import-path](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/format-import-path)
26
+ - [format-translate-component](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/format-translate-component)
27
+ - [jsx-start-with-spread-attributes](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/jsx-start-with-spread-attributes)
28
+ - [no-import-other-domain](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/no-import-other-domain)
29
+ - [prohibit-export-array-type](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/prohibit-export-array-type)
30
+ - [prohibit-file-name](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/prohibit-file-name)
31
+ - [prohibit-import](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/prohibit-import)
32
+ - [prohibit-path-within-template-literal](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/prohibit-path-within-template-literal)
33
+ - [require-barrel-import](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/require-barrel-import)
34
+ - [require-declaration](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/require-declaration)
35
+ - [require-export](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/require-export)
36
+ - [require-import](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/require-import)
37
+ - [trim-props](https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/trim-props)
package/index.js CHANGED
@@ -5,12 +5,16 @@ const path = require('path');
5
5
 
6
6
  const rules = generateRulesMap();
7
7
 
8
+ /**
9
+ * @type {import('eslint').Linter.Config}
10
+ */
8
11
  module.exports = {
9
- configs: {
10
- recommended: generateRecommendedConfig(rules),
11
- },
12
+ name: 'eslint-plugin-smarthr',
12
13
  rules,
13
- };
14
+ plugins: {
15
+ recommended: generateRecommendedConfig(rules),
16
+ }
17
+ }
14
18
 
15
19
  function generateRulesMap() {
16
20
  let rulesPath = path.join(__dirname, 'rules');
@@ -25,7 +29,7 @@ function generateRulesMap() {
25
29
 
26
30
  function generateRecommendedConfig(rules) {
27
31
  let config = {
28
- plugins: ['smarthr'],
32
+ name: 'eslint-plugin-smarthr/recommended',
29
33
  rules: {},
30
34
  };
31
35
 
package/package.json CHANGED
@@ -1,42 +1,41 @@
1
1
  {
2
2
  "name": "eslint-plugin-smarthr",
3
- "version": "0.5.20",
3
+ "version": "1.1.0",
4
4
  "author": "SmartHR",
5
5
  "license": "MIT",
6
6
  "description": "A sharable ESLint plugin for SmartHR",
7
7
  "main": "index.js",
8
+ "engines": {
9
+ "node": ">=20.18.1"
10
+ },
8
11
  "scripts": {
9
- "test": "jest",
10
- "release:dryrun": "standard-version --dry-run",
11
- "release": "standard-version"
12
+ "test": "jest"
12
13
  },
13
14
  "repository": {
14
15
  "type": "git",
15
- "url": "git+ssh://git@github.com:kufu/eslint-plugin-smarthr.git"
16
+ "url": "git+git@github.com:kufu/tamatebako.git"
16
17
  },
17
- "homepage": "https://github.com/kufu/eslint-plugin-smarthr",
18
+ "homepage": "https://github.com/kufu/tamatebako/packages/eslint-plugin-smarthr",
18
19
  "publishConfig": {
19
20
  "registry": "https://registry.npmjs.org"
20
21
  },
21
22
  "bugs": {
22
- "url": "https://github.com/kufu/eslint-plugin-smarthr/issues"
23
+ "url": "https://github.com/kufu/tamatebako/issues"
23
24
  },
24
25
  "dependencies": {
25
- "json5": "^2.2.0"
26
+ "json5": "^2.2.3"
26
27
  },
27
28
  "devDependencies": {
28
- "eslint": "^8.8.0",
29
- "jest": "^27.4.7",
30
- "standard-version": "^9.3.2",
31
- "typescript-eslint": "^7.5.0"
29
+ "typescript-eslint": "^8.14.0"
32
30
  },
33
31
  "peerDependencies": {
34
- "eslint": "^7 || ^8"
32
+ "eslint": "^9"
35
33
  },
36
34
  "keywords": [
37
35
  "eslint",
38
36
  "eslint-plugin",
39
37
  "eslintplugin",
40
38
  "smarthr"
41
- ]
39
+ ],
40
+ "gitHead": "7231c562b253db92c64527e5ab5350c8a7e0d92a"
42
41
  }
@@ -143,6 +143,9 @@ module.exports = {
143
143
  case 'checkbox':
144
144
  isTypeCheck = true
145
145
  break
146
+ case 'hidden':
147
+ // HINT: hiddenの場合はラベルなしを許容するため、breakではなくreturnで処理終了させる
148
+ return
146
149
  }
147
150
 
148
151
  break
@@ -141,7 +141,7 @@ module.exports = {
141
141
  schema: [],
142
142
  },
143
143
  create(context) {
144
- const filenames = context.getFilename().replace(rootPathSlashed, '').replace(extRegex, '').split('/')
144
+ const filenames = context.filename.replace(rootPathSlashed, '').replace(extRegex, '').split('/')
145
145
  const isInnerForm = filenames.some(includeWrapper)
146
146
  const notified = []
147
147
 
@@ -125,12 +125,12 @@ module.exports = {
125
125
  message: `${fixedImportPath} に修正してください`,
126
126
  fix: (fixer) => fixer.replaceText(
127
127
  node,
128
- context.getSourceCode().getText(node).replace(new RegExp(`from '${importPath}'$`), `from '${fixedImportPath}'`)
128
+ context.sourceCode.getText(node).replace(new RegExp(`from '${importPath}'$`), `from '${fixedImportPath}'`)
129
129
  ),
130
130
  })
131
131
  }
132
132
  },
133
- }
133
+ };
134
134
  },
135
135
  }
136
136
  module.exports.schema = SCHEMA
@@ -35,8 +35,7 @@ module.exports = {
35
35
 
36
36
  if (insertIndex >= 0) {
37
37
  const option = context.options[0]
38
- const sourceCode = context.getSourceCode()
39
- const attributeCode = sourceCode.getText(node)
38
+ const attributeCode = context.sourceCode.getText(node)
40
39
 
41
40
  context.report({
42
41
  node,
@@ -49,7 +48,7 @@ module.exports = {
49
48
  }
50
49
 
51
50
  if (a !== node) {
52
- p = [...p, sourceCode.getText(a)]
51
+ p = [...p, context.sourceCode.getText(a)]
53
52
  }
54
53
 
55
54
  return p
@@ -63,7 +62,7 @@ module.exports = {
63
62
  });
64
63
  }
65
64
  },
66
- }
65
+ };
67
66
  },
68
67
  }
69
68
  module.exports.schema = SCHEMA
@@ -19,8 +19,7 @@ module.exports = {
19
19
  },
20
20
  create(context) {
21
21
  const options = context.options[0]
22
- const filename = context.getFilename()
23
- const targetPaths = Object.keys(options).filter((regex) => !!filename.match(new RegExp(regex)))
22
+ const targetPaths = Object.keys(options).filter((regex) => !!context.filename.match(new RegExp(regex)))
24
23
 
25
24
 
26
25
  if (targetPaths.length === 0) {
@@ -32,7 +31,7 @@ module.exports = {
32
31
  targetPaths.forEach((path) => {
33
32
  const message = options[path]
34
33
 
35
- matcher = filename.match(new RegExp(path))
34
+ matcher = context.filename.match(new RegExp(path))
36
35
 
37
36
  if (matcher) {
38
37
  messages.push([...matcher].reduce(((prev, k, index) => prev.replaceAll(`\$${index}`, k)), message))
@@ -42,15 +42,14 @@ module.exports = {
42
42
  },
43
43
  create(context) {
44
44
  const options = context.options[0]
45
- const filename = context.getFilename()
46
45
  const parentDir = (() => {
47
- const dir = filename.match(/^(.+?)\..+?$/)[1].split('/')
46
+ const dir = context.filename.match(/^(.+?)\..+?$/)[1].split('/')
48
47
  dir.pop()
49
48
 
50
49
  return dir.join('/')
51
50
  })()
52
51
  const targetPathRegexs = Object.keys(options)
53
- const targetProhibits = targetPathRegexs.filter((regex) => !!filename.match(new RegExp(regex)))
52
+ const targetProhibits = targetPathRegexs.filter((regex) => !!context.filename.match(new RegExp(regex)))
54
53
 
55
54
  if (targetProhibits.length === 0) {
56
55
  return {}
@@ -93,17 +93,16 @@ module.exports = {
93
93
  },
94
94
  create(context) {
95
95
  const option = context.options[0] || {}
96
- const filename = context.getFilename()
97
96
 
98
- if (option.ignores && option.ignores.some((i) => !!filename.match(new RegExp(i)))) {
97
+ if (option.ignores && option.ignores.some((i) => !!context.filename.match(new RegExp(i)))) {
99
98
  return {}
100
99
  }
101
100
 
102
- let d = filename.split('/')
101
+ let d = context.filename.split('/')
103
102
  d.pop()
104
103
  const dir = d.join('/')
105
104
  const targetPathRegexs = Object.keys(option?.allowedImports || {})
106
- const targetAllowedImports = targetPathRegexs.filter((regex) => !!filename.match(new RegExp(regex)))
105
+ const targetAllowedImports = targetPathRegexs.filter((regex) => !!context.filename.match(new RegExp(regex)))
107
106
 
108
107
  return {
109
108
  ImportDeclaration: (node) => {
@@ -3,8 +3,8 @@
3
3
  - 対象ファイルに宣言してほしい、変数・関数・class・型などを定義するルールです
4
4
  - コードの規約などを決める際に便利です
5
5
  - import, exportを強制したい場合は以下を利用してください
6
- - https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/require-import
7
- - https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/require-export
6
+ - https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/require-import
7
+ - https://github.com/kufu/tamatebako/tree/master/packages/eslint-plugin-smarthr/rules/require-export
8
8
 
9
9
  ## rules
10
10
 
@@ -50,9 +50,8 @@ module.exports = {
50
50
  },
51
51
  create(context) {
52
52
  const options = context.options[0]
53
- const filename = context.getFilename()
54
53
  const targetPathRegexs = Object.keys(options)
55
- const targetRequires = targetPathRegexs.filter((regex) => !!filename.match(new RegExp(regex)))
54
+ const targetRequires = targetPathRegexs.filter((regex) => !!context.filename.match(new RegExp(regex)))
56
55
 
57
56
  if (targetRequires.length === 0) {
58
57
  return {}
@@ -105,7 +104,7 @@ module.exports = {
105
104
  message: localOption.reportMessage || `${localOption.type} ${requireDeclaration}が宣言されていません`,
106
105
  })
107
106
  } else if (localOption.use) {
108
- const code = context.getSourceCode().getText(hit)
107
+ const code = context.sourceCode.getText(hit)
109
108
  let reported = false
110
109
 
111
110
  localOption.use.forEach((u) => {
@@ -121,7 +120,7 @@ module.exports = {
121
120
  })
122
121
  })
123
122
  },
124
- }
123
+ };
125
124
  },
126
125
  }
127
126
 
@@ -30,9 +30,8 @@ module.exports = {
30
30
  },
31
31
  create(context) {
32
32
  const options = context.options[0]
33
- const filename = context.getFilename()
34
33
  const targetPathRegexs = Object.keys(options)
35
- const targetRequires = targetPathRegexs.filter((regex) => !!filename.match(new RegExp(regex)))
34
+ const targetRequires = targetPathRegexs.filter((regex) => !!context.filename.match(new RegExp(regex)))
36
35
 
37
36
  if (targetRequires.length === 0) {
38
37
  return {}
@@ -42,9 +42,8 @@ module.exports = {
42
42
  },
43
43
  create(context) {
44
44
  const options = context.options[0]
45
- const filename = context.getFilename()
46
45
  const targetPathRegexs = Object.keys(options)
47
- const targetRequires = targetPathRegexs.filter((regex) => !!filename.match(new RegExp(regex)))
46
+ const targetRequires = targetPathRegexs.filter((regex) => !!context.filename.match(new RegExp(regex)))
48
47
 
49
48
  if (targetRequires.length === 0) {
50
49
  return {}
@@ -54,7 +53,7 @@ module.exports = {
54
53
  Program: (node) => {
55
54
  const importDeclarations = node.body.filter((item) => item.type === 'ImportDeclaration')
56
55
  const parentDir = (() => {
57
- const dir = filename.match(/^(.+?)\..+?$/)[1].split('/')
56
+ const dir = context.filename.match(/^(.+?)\..+?$/)[1].split('/')
58
57
  dir.pop()
59
58
 
60
59
  return dir.join('/')
@@ -66,7 +65,7 @@ module.exports = {
66
65
  Object.keys(option).forEach((targetModule) => {
67
66
  const { imported, reportMessage, targetRegex } = Object.assign({imported: true}, option[targetModule])
68
67
 
69
- if (targetRegex && !filename.match(new RegExp(targetRegex))) {
68
+ if (targetRegex && !context.filename.match(new RegExp(targetRegex))) {
70
69
  return
71
70
  }
72
71
 
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-anchor-has-href-attribute')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const generateErrorText = (name) => `${name} に href 属性を正しく設定してください
16
14
  - onClickなどでページ遷移する場合でもhref属性に遷移先のURIを設定してください
17
15
  - Cmd + clickなどのキーボードショートカットに対応出来ます
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-clickable-element-has-text')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const defaultErrorMessage = `a, buttonなどのクリッカブルな要素内にはテキストを設定してください
16
14
  - 要素内にアイコン、画像のみを設置する場合はaltなどの代替テキスト用属性を指定してください
17
15
  - SVG component の場合、altを属性として受け取れるようにした上で '<svg role="img" aria-label={alt}>' のように指定してください
@@ -149,7 +147,6 @@ ruleTester.run('a11y-clickable-element-has-text', rule, {
149
147
  { code: 'const Hoge = styled(Link)``', errors: [ { message: `Hogeを正規表現 "/Link$/" がmatchする名称に変更してください。` } ] },
150
148
  { code: 'const Hoge = styled(Button)``', errors: [ { message: `Hogeを正規表現 "/Button$/" がmatchする名称に変更してください。` } ] },
151
149
  { code: 'const Fuga = styled(HogeAnchor)``', errors: [ { message: `Fugaを正規表現 "/Anchor$/" がmatchする名称に変更してください。` } ] },
152
- { code: 'const Fuga = styled(HogeAnchor)``', errors: [ { message: `Fugaを正規表現 "/Anchor$/" がmatchする名称に変更してください。` } ] },
153
150
  { code: 'const Fuga = styled(SmartHRLogo)``', errors: [ { message: `Fugaを正規表現 "/SmartHRLogo$/" がmatchする名称に変更してください。` } ] },
154
151
  { code: 'const Piyo = styled.a(() => ``)', errors: [ { message: `Piyoを正規表現 "/(Anchor|Link)$/" がmatchする名称に変更してください。` } ] },
155
152
  { code: 'const Piyo = styled("a")(() => ``)', errors: [ { message: `Piyoを正規表現 "/(Anchor|Link)$/" がmatchする名称に変更してください。` } ] },
@@ -2,15 +2,14 @@ const rule = require('../rules/a11y-delegate-element-has-role-presentation');
2
2
  const RuleTester = require('eslint').RuleTester;
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
- });
12
+ })
14
13
 
15
14
  const defaultInteractiveRegex = '/((i|I)nput$|(t|T)extarea$|(s|S)elect$|InputFile$|RadioButtonPanel$|Check(b|B)ox$|Combo(b|B)ox$|DatePicker$|TimePicker$|DropZone$|Switch$|SegmentedControl$|RightFixedNote$|FieldSet$|Fieldset$|FormControl$|FormGroup$|(b|B)utton$|Anchor$|Link$|TabItem$|^a$|(f|F)orm$|ActionDialogWithTrigger$|RemoteDialogTrigger$|RemoteTrigger(.+)Dialog$|FormDialog$|Pagination$|SideNav$|AccordionPanel$|FilterDropdown$)/'
16
15
  const messageNonInteractiveEventHandler = (nodeName, onAttrs, interactiveComponentRegex = defaultInteractiveRegex) => {
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-form-control-in-form')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const generateErrorText = (elementName) => `${elementName}をform要素で囲むようにマークアップしてください。
16
14
  - form要素で囲むことでスクリーンリーダーに入力フォームであることが正しく伝わる、入力要素にfocusした状態でEnterを押せばsubmitできる、inputのpattern属性を利用できるなどのメリットがあります
17
15
  - 以下のいずれかの方法で修正をおこなってください
@@ -2,15 +2,14 @@ const rule = require('../rules/a11y-heading-in-sectioning-content');
2
2
  const RuleTester = require('eslint').RuleTester;
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
- });
12
+ })
14
13
 
15
14
  const lowerMessage = `smarthr-ui/Headingと紐づく内容の範囲(アウトライン)が曖昧になっています。
16
15
  - smarthr-uiのArticle, Aside, Nav, SectionのいずれかでHeadingコンポーネントと内容をラップしてHeadingに対応する範囲を明確に指定してください。`
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-image-has-alt-attribute')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const messageNotExistAlt = `画像にはalt属性を指定してください。
16
14
  - コンポーネントが画像ではない場合、img or image を末尾に持たない名称に変更してください。
17
15
  - ボタンやリンクの先頭・末尾などに設置するアイコンとしての役割を持つ画像の場合、コンポーネント名の末尾を "Icon" に変更してください。
@@ -2,15 +2,14 @@ const rule = require('../rules/a11y-input-has-name-attribute');
2
2
  const RuleTester = require('eslint').RuleTester;
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
- });
12
+ })
14
13
 
15
14
  const MESSAGE_SUFFIX = `
16
15
  - ブラウザの自動補完が有効化されるなどのメリットがあります
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-input-in-form-control')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const noLabeledInput = (name) => `${name} を、smarthr-ui/FormControl もしくはそれを拡張したコンポーネントが囲むようマークアップを変更してください。
16
14
  - FormControlで入力要素を囲むことでラベルと入力要素が適切に紐づき、操作性が高まります
17
15
  - ${name}が入力要素とラベル・タイトル・説明など含む概念を表示するコンポーネントの場合、コンポーネント名を/((FormGroup)$|(FormControl)$|((F|^f)ieldset)$)/とマッチするように修正してください
@@ -92,6 +90,7 @@ ruleTester.run('a11y-input-in-form-control', rule, {
92
90
  { code: 'const HogeRadioButtonPanel = styled(FugaRadioButtonPanel)``' },
93
91
  { code: 'const HogeCheckBox = styled(FugaCheckbox)``' },
94
92
  { code: 'const DatePicker = styled(AnyDatePicker)``' },
93
+ { code: '<input type="hidden" />' },
95
94
  { code: '<input title="any"/>' },
96
95
  { code: '<HogeInput title="any"/>' },
97
96
  { code: '<textarea title="any"/>' },
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-numbered-text-within-ol')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  ruleTester.run('a11y-numbered-text-within-ol', rule, {
16
14
  valid: [
17
15
  { code: `const HogeOrderedFugaList = styled.ol` },
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-prohibit-input-placeholder')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  ruleTester.run('a11y-prohibit-input-placeholder', rule, {
16
14
  valid: [
17
15
  { code: `import styled from 'styled-components'` },
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-prohibit-input-maxlength-attribute')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const expectedErrorMessage = (elName) => `${elName}にmaxLength属性を設定しないでください。
16
14
  - maxLength属性がついた要素に、テキストをペーストすると、maxLength属性の値を超えた範囲が意図せず切り捨てられてしまう場合があります
17
15
  - 以下のいずれかの方法で修正をおこなってください
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-prohibit-useless-sectioning-fragment')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const error = (tag) => `無意味なSectioningFragmentが記述されています。子要素である${tag}で問題なくセクションは設定されているため、このSectioningFragmentは削除してください`
16
14
 
17
15
  ruleTester.run('a11y-prohibit-useless-sectioning-fragment', rule, {
@@ -7,13 +7,12 @@ const generateErrorText = (symbol, replaced, read) => `"${symbol}"はスクリ
7
7
  - 前後の文脈などで "${read}" と読まれることが不適切な場合 \`<RangeSeparator decorators={{ visuallyHiddenText: () => "ANY" }} />\` のようにdecoratorsを指定してください`
8
8
 
9
9
  const ruleTester = new RuleTester({
10
- parserOptions: {
11
- ecmaVersion: 2018,
12
- ecmaFeatures: {
13
- experimentalObjectRestSpread: true,
14
- jsx: true,
10
+ languageOptions: {
11
+ parserOptions: {
12
+ ecmaFeatures: {
13
+ jsx: true,
14
+ },
15
15
  },
16
- sourceType: 'module',
17
16
  },
18
17
  })
19
18
 
@@ -2,13 +2,12 @@ const rule = require('../rules/a11y-required-layout-as-attribute')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
13
 
@@ -2,16 +2,14 @@ const rule = require('../rules/a11y-trigger-has-button')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  ruleTester.run('a11y-trigger-has-button', rule, {
16
14
  valid: [
17
15
  { code: `import styled from 'styled-components'` },
@@ -2,16 +2,14 @@ const rule = require('../rules/best-practice-for-button-element')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const ERRORMESSAGE_REQUIRED_TYPE_ATTR = `button要素を利用する場合、type属性に "button" もしくは "submit" を指定してください
16
14
  - button要素のtype属性のデフォルトは "submit" のため、button要素がformでラップされていると意図しないsubmitを引き起こす可能性があります
17
15
  - smarthr-ui/Button, smarthr-ui/UnstyledButtonのtype属性のデフォルトは "button" になっているため、buttonから置き換えることをおすすめします`
@@ -2,16 +2,14 @@ const rule = require('../rules/best-practice-for-data-test-attribute')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const generateErrorMessage = (attr) => `テストのために要素を指定するために、${attr} 属性を利用するのではなく、他の方法で要素を指定することを検討してください。
16
14
  - 方法1: click_link, click_button等を利用したりすることで、利用しているテスト環境に準じた方法で要素を指定することを検討してください。
17
15
  - 参考(Testing Library): https://testing-library.com/docs/queries/about
@@ -2,16 +2,14 @@ const rule = require('../rules/best-practice-for-date')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const errorNewDate = `'new Date(arg)' のように引数を一つだけ指定したDate instanceの生成は実行環境によって結果が異なるため、以下のいずれかの方法に変更してください
16
14
  - 'new Date(2022, 12 - 1, 31)' のように数値を個別に指定する
17
15
  - dayjsなど、日付系ライブラリを利用する (例: 'dayjs(arg).toDate()')`
@@ -2,16 +2,14 @@ const rule = require('../rules/best-practice-for-layouts')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const errorMessage = (type, name) => `${name}には子要素が一つしか無いため、${type}でマークアップする意味がありません。
16
14
  - styleを確認し、div・spanなど、別要素でマークアップし直すか、${name}を削除してください
17
15
  - as, forwardedAsなどでSectioningContent系要素に変更している場合、対応するsmarthr-ui/Section, Aside, Nav, Article のいずれかに差し替えてください`
@@ -2,16 +2,14 @@ const rule = require('../rules/best-practice-for-remote-trigger-dialog')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  ruleTester.run('best-practice-for-remote-trigger-dialog', rule, {
16
14
  valid: [
17
15
  { code: `import styled from 'styled-components'` },
@@ -2,16 +2,14 @@ const rule = require('../rules/design-system-guideline-prohibit-double-icons')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const generateErrorText = (name) => `${name} には prefix と suffix は同時に設定できません。
16
14
  - prefix または suffix のみを設定してください。
17
15
  - どちらにもアイコンをつけられそうな場合は、アイコン付き(右)(サフィックス)を優先し、アイコン付き(左)(プレフィックス)には指定しないでください。
@@ -2,16 +2,14 @@ const rule = require('../rules/format-translate-component')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const options = [
16
14
  {
17
15
  componentPath: '@/any/path/Translate',
@@ -2,9 +2,12 @@ const rule = require('../rules/prohibit-file-name')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- sourceType: 'module',
7
- ecmaVersion: 12
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
+ },
8
11
  },
9
12
  })
10
13
 
@@ -2,9 +2,12 @@ const rule = require('../rules/prohibit-import')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- sourceType: 'module',
7
- ecmaVersion: 12
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
+ },
8
11
  },
9
12
  })
10
13
 
@@ -2,9 +2,12 @@ const rule = require('../rules/prohibit-path-within-template-literal')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- sourceType: 'module',
7
- ecmaVersion: 12
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
+ },
8
11
  },
9
12
  })
10
13
 
@@ -2,16 +2,14 @@ const rule = require('../rules/require-declaration')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaVersion: 12,
7
- ecmaFeatures: {
8
- experimentalObjectRestSpread: true,
9
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
10
  },
11
- sourceType: 'module',
12
11
  },
13
12
  })
14
-
15
13
  const options = [
16
14
  {
17
15
  '^.+$': {
@@ -2,9 +2,12 @@ const rule = require('../rules/require-export')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- sourceType: 'module',
7
- ecmaVersion: 12
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
+ },
8
11
  },
9
12
  })
10
13
 
@@ -2,9 +2,12 @@ const rule = require('../rules/require-import')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- sourceType: 'module',
7
- ecmaVersion: 12
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
10
+ },
8
11
  },
9
12
  })
10
13
 
@@ -2,9 +2,11 @@ const rule = require('../rules/trim-props')
2
2
  const RuleTester = require('eslint').RuleTester
3
3
 
4
4
  const ruleTester = new RuleTester({
5
- parserOptions: {
6
- ecmaFeatures: {
7
- jsx: true,
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true,
9
+ },
8
10
  },
9
11
  },
10
12
  })
@@ -1,3 +0,0 @@
1
- # https://help.github.com/en/articles/about-code-owners
2
-
3
- * @kufu/group-dev-front-linter-reviewers
package/.node-version DELETED
@@ -1 +0,0 @@
1
- 20.11.1
@@ -1,89 +0,0 @@
1
- SmartHR CODE OF CONDUCT
2
- ===
3
-
4
- # コントリビューター行動規範
5
-
6
- ## 私たちの約束
7
- メンバー、コントリビューター、およびリーダーとして、年齢、体の大きさ、目に見えるまたは目に見えない障害、民族性、性別、
8
- 性同一性、表現、経験のレベル、教育、社会経済的地位、国籍、人格、人種、宗教、または性的同一性と指向に関係なく、
9
- コミュニティへの参加をハラスメントのない体験にすることを誓います。
10
-
11
- 私たちは、オープンで親しみやすく、多様で包括的で健全なコミュニティに貢献する方法で行動し、交流することを誓います。
12
-
13
- ## 私たちの標準
14
-
15
- 前向きな環境を作り上げることに貢献する行動の例:
16
-
17
- * 他人への共感と優しさを示す
18
-
19
- * 異なる意見、視点、経験を尊重する
20
-
21
- * 建設的なフィードバックを与え、優雅に受け入れる
22
-
23
- * 私たちの過ちの影響を受けた人々に責任を受け入れ、謝罪し、そしてその経験から学ぶ
24
-
25
- * 個人としてだけでなく、コミュニティ全体にとっても最善であることに焦点を当てる
26
-
27
- 許容できない行動の例は次のとおりです。
28
-
29
- * 性的な言葉や画像の使用、および性的な注意またはその他あらゆる種類の問題行為
30
-
31
- * トローリング、侮辱的または中傷的なコメント、個人的または政治的攻撃
32
-
33
- * 公的またはプライベートの嫌がらせ
34
-
35
- * 明示的な許可なしに、住所や電子メールアドレスなど、他者の個人情報を公開する
36
-
37
- * 職業上不適切と合理的に考えられるその他の行為
38
-
39
- ## 執行責任
40
-
41
- コミュニティリーダーは、許容される行動の基準を明確にし、実施する責任があり、不適切、脅迫的、攻撃的、または有害と見なされる行動に応じて、適切で公正な是正措置を講じます。
42
-
43
- コミュニティリーダーは、コメント、コミット、コード、wikiの編集、問題、およびこの行動規範に沿っていないその他の貢献を削除、編集、または拒否する権利と責任を持ち、適切な場合はモデレーションの決定の理由を伝えます。
44
-
45
- ## 適用範囲
46
-
47
- この行動規範は、すべてのコミュニティスペース内で適用され、個人がパブリックスペースでコミュニティを公式に代表している場合にも適用されます。
48
- 私たちのコミュニティを代表する例には、公式の電子メールアドレスの使用、公式のソーシャルメディアアカウントを介した投稿、オンラインまたはオフラインのイベントでの指定代理人としての行動などがあります。
49
-
50
- ## 執行
51
-
52
- 虐待的、嫌がらせ、またはその他の許容できない行動の事例は、執行を担当するコミュニティリーダーに対して `oss@smarthr.co.jp` で報告される場合があります。
53
- すべての苦情は迅速かつ公正にレビューおよび調査されます。
54
-
55
- すべてのコミュニティリーダーは、問題の報告者のプライバシーとセキュリティを尊重する義務があります。
56
-
57
- ## 執行ガイドライン
58
-
59
- コミュニティリーダーは、この行動規範に違反していると見なした行動への帰結を判断する際に、これらのコミュニティガイドラインに従います。
60
-
61
- ### 1. 更生
62
-
63
- **コミュニティへの影響**: コミュニティで専門家にふさわしくない、または歓迎されないと思われる不適切な言葉の使用やその他の不適切な行動をすること。
64
-
65
- **帰結**: コミュニティリーダーからの非公開の書面による警告。違反の理由を明確にし、行動が不適切だった理由を説明します。 公の謝罪が要求される場合があります。
66
-
67
- ### 2. 警告
68
-
69
- **コミュニティへの影響**: 単一の出来事または一連の動作による違反。
70
-
71
- **帰結**: 持続的な行動の結果を伴う警告。 指定された期間、行動規範の実施者との一方的な対話を含め、関係者との対話はありません。 これには、コミュニティスペースやソーシャルメディアなどの外部チャネルでの相互作用の回避が含まれます。 これらの条件に違反すると、一時的または永続的に禁止される場合があります。
72
-
73
- ### 3. 一時的な禁止
74
- **コミュニティへの影響**: 持続的で不適切な行動を含む、コミュニティ標準の重大な違反。
75
-
76
- **帰結**: 指定された期間のコミュニティとのあらゆる種類の相互関係または公的なコミュニケーションの一時的な禁止。 この期間中、行動規範を実施する人々との一方的な対話を含め、関係する人々との公的または私的な対話は許可されません。
77
- これらの条件に違反すると、永久的に禁止される場合があります。
78
- ### 4. 永久的な禁止
79
- **コミュニティへの影響**: 連続的な不適切な行動、個人への嫌がらせ、または個人の集団に対する攻撃または名誉毀損を含む、コミュニティの標準への違反のパターンを示す。
80
-
81
- **帰結**: コミュニティ内でのあらゆる種類の公的な相互関係の永久的な禁止。
82
-
83
- ## 帰属
84
- この行動規範は、https://www.contributor-covenant.org/version/2/0/code_of_conduct.html で利用可能な [Contributor Covenant][homepage] バージョン2.0を基に作成されています。
85
-
86
- コミュニティへの影響ガイドラインは[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity)に適合しています。
87
-
88
- [homepage]: https://www.contributor-covenant.org
89
- この行動規範に関する一般的な質問への回答については、https://www.contributor-covenant.org/faq のFAQを参照してください。翻訳はhttps://www.contributor-covenant.org/translations で入手できます。