From ffb31d1a84745f925a237f2f88f6467bfdcbf9f3 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Mon, 9 Feb 2026 21:38:02 +0900 Subject: [PATCH 01/15] feat(eslint): migrate to ESLint v10 - Update eslint to v10.0.0 and @eslint/js to v10.0.1 - Replace eslint-plugin-eslint-comments with @eslint-community/eslint-plugin-eslint-comments - Add @eslint/compat and wrap v10-incompatible plugins with fixupPluginRules (import-x, jsdoc, comments, sort-class-members) - Remove deprecated @typescript-eslint/no-var-requires rule --- packages/@d-zero/eslint-config/base.js | 17 +++++++++++++---- packages/@d-zero/eslint-config/package.json | 7 ++++--- packages/@d-zero/eslint-config/typescript.js | 1 - 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/@d-zero/eslint-config/base.js b/packages/@d-zero/eslint-config/base.js index 8b27f8f5..a6b07f7e 100644 --- a/packages/@d-zero/eslint-config/base.js +++ b/packages/@d-zero/eslint-config/base.js @@ -1,6 +1,7 @@ import dzeroPlugin from '@d-zero/eslint-plugin'; +import { fixupPluginRules } from '@eslint/compat'; import js from '@eslint/js'; -import comments from 'eslint-plugin-eslint-comments'; +import comments from '@eslint-community/eslint-plugin-eslint-comments'; import { flatConfigs as importX } from 'eslint-plugin-import-x'; import jsdoc from 'eslint-plugin-jsdoc'; import * as regexpPlugin from 'eslint-plugin-regexp'; @@ -73,6 +74,10 @@ export const base = [ regexpPlugin.configs['flat/recommended'], { ...importX.recommended, + plugins: { + ...importX.recommended.plugins, + 'import-x': fixupPluginRules(importX.recommended.plugins['import-x']), + }, rules: { ...importX.recommended.rules, 'import-x/no-extraneous-dependencies': 2, @@ -109,6 +114,10 @@ export const base = [ }, { ...jsdoc.configs['flat/recommended'], + plugins: { + ...jsdoc.configs['flat/recommended'].plugins, + jsdoc: fixupPluginRules(jsdoc.configs['flat/recommended'].plugins.jsdoc), + }, rules: { ...jsdoc.configs['flat/recommended'].rules, 'jsdoc/require-param-type': 0, @@ -120,13 +129,13 @@ export const base = [ }, { plugins: { - comments, + comments: fixupPluginRules(comments), }, }, { plugins: { - comments, - 'sort-class-members': sortClassMembers, + comments: fixupPluginRules(comments), + 'sort-class-members': fixupPluginRules(sortClassMembers), }, rules: { 'sort-class-members/sort-class-members': [ diff --git a/packages/@d-zero/eslint-config/package.json b/packages/@d-zero/eslint-config/package.json index 01e49455..7a5200d5 100644 --- a/packages/@d-zero/eslint-config/package.json +++ b/packages/@d-zero/eslint-config/package.json @@ -20,9 +20,10 @@ }, "dependencies": { "@d-zero/eslint-plugin": "5.0.0", - "@eslint/js": "9.39.5", - "eslint": "9.39.5", - "eslint-plugin-eslint-comments": "3.2.0", + "@eslint-community/eslint-plugin-eslint-comments": "4.6.0", + "@eslint/compat": "2.0.2", + "@eslint/js": "10.0.1", + "eslint": "10.0.0", "eslint-plugin-import-x": "4.17.1", "eslint-plugin-jsdoc": "64.1.0", "eslint-plugin-regexp": "3.2.0", diff --git a/packages/@d-zero/eslint-config/typescript.js b/packages/@d-zero/eslint-config/typescript.js index 43b00a30..1a0f8733 100644 --- a/packages/@d-zero/eslint-config/typescript.js +++ b/packages/@d-zero/eslint-config/typescript.js @@ -29,7 +29,6 @@ export const ts = tsESLint.config( '@typescript-eslint/no-namespace': [2, { allowDeclarations: true }], '@typescript-eslint/no-unnecessary-type-assertion': 2, '@typescript-eslint/no-unused-vars': 2, - '@typescript-eslint/no-var-requires': 2, '@typescript-eslint/prefer-namespace-keyword': 2, '@typescript-eslint/require-await': 2, '@typescript-eslint/restrict-plus-operands': 0, From c6a54a52c6c0dee7fa4cf4e5ebeecacdf7d74ab7 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Mon, 9 Feb 2026 21:39:56 +0900 Subject: [PATCH 02/15] fix(stylelint-rules): fix no-useless-assignment in prefer-individual-transform-properties --- .../prefer-individual-transform-properties/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/@d-zero/stylelint-rules/src/rules/prefer-individual-transform-properties/index.ts b/packages/@d-zero/stylelint-rules/src/rules/prefer-individual-transform-properties/index.ts index f08df5e6..4003c87d 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/prefer-individual-transform-properties/index.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/prefer-individual-transform-properties/index.ts @@ -53,15 +53,18 @@ function canBeReplacedWithIndividualProperties(value: string): { // Generate suggestion based on function type const args = postcssValueParser.stringify(node.nodes); suggestions.push(`${property}: ${args}`); - - // Don't walk into the arguments of transform functions - return false; + break; } } if (!isReplaceable) { hasNonReplaceableFunction = true; } + + // Don't walk into the arguments of transform functions + if (isReplaceable) { + return false; + } } return true; }); From 8098b75ad653f506d89327a6523bff32aa237980 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Fri, 14 Aug 2026 20:26:19 +0900 Subject: [PATCH 03/15] chore(eslint-plugin): bump eslint and typescript-eslint dependencies for v10 support @typescript-eslint/utils, parser and rule-tester at 8.53.1 don't declare eslint v10 in their peerDependencies; bump all to the latest 8.67.0 which does. Also bump the devDependency eslint to the latest 10.8.1. --- packages/@d-zero/eslint-plugin/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@d-zero/eslint-plugin/package.json b/packages/@d-zero/eslint-plugin/package.json index 3457963d..2c3dad6a 100644 --- a/packages/@d-zero/eslint-plugin/package.json +++ b/packages/@d-zero/eslint-plugin/package.json @@ -30,7 +30,7 @@ "devDependencies": { "@typescript-eslint/parser": "8.67.0", "@typescript-eslint/rule-tester": "8.67.0", - "eslint": "9.39.5", + "eslint": "10.8.1", "vue-eslint-parser": "10.4.1" } } From fd30858703cc968659dc1a33fb61eab5226275fd Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Fri, 14 Aug 2026 20:26:43 +0900 Subject: [PATCH 04/15] chore(eslint): bump eslint, typescript-eslint and eslint-comments plugin @eslint-community/eslint-plugin-eslint-comments 4.6.0 doesn't declare eslint v10 support in its peerDependencies (added in 4.7.0); bump to the latest 4.7.2. Also bump eslint to 10.8.1 and typescript-eslint to 8.67.0 to match @d-zero/eslint-plugin. --- packages/@d-zero/eslint-config/package.json | 4 +- packages/@d-zero/eslint-plugin/package.json | 2 +- yarn.lock | 210 ++++++++------------ 3 files changed, 90 insertions(+), 126 deletions(-) diff --git a/packages/@d-zero/eslint-config/package.json b/packages/@d-zero/eslint-config/package.json index 7a5200d5..b34b0abe 100644 --- a/packages/@d-zero/eslint-config/package.json +++ b/packages/@d-zero/eslint-config/package.json @@ -20,10 +20,10 @@ }, "dependencies": { "@d-zero/eslint-plugin": "5.0.0", - "@eslint-community/eslint-plugin-eslint-comments": "4.6.0", + "@eslint-community/eslint-plugin-eslint-comments": "4.7.2", "@eslint/compat": "2.0.2", "@eslint/js": "10.0.1", - "eslint": "10.0.0", + "eslint": "10.8.0", "eslint-plugin-import-x": "4.17.1", "eslint-plugin-jsdoc": "64.1.0", "eslint-plugin-regexp": "3.2.0", diff --git a/packages/@d-zero/eslint-plugin/package.json b/packages/@d-zero/eslint-plugin/package.json index 2c3dad6a..72f24bef 100644 --- a/packages/@d-zero/eslint-plugin/package.json +++ b/packages/@d-zero/eslint-plugin/package.json @@ -30,7 +30,7 @@ "devDependencies": { "@typescript-eslint/parser": "8.67.0", "@typescript-eslint/rule-tester": "8.67.0", - "eslint": "10.8.1", + "eslint": "10.8.0", "vue-eslint-parser": "10.4.1" } } diff --git a/yarn.lock b/yarn.lock index b238cf29..389098ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -988,9 +988,10 @@ __metadata: resolution: "@d-zero/eslint-config@workspace:packages/@d-zero/eslint-config" dependencies: "@d-zero/eslint-plugin": "npm:5.0.0" - "@eslint/js": "npm:9.39.5" - eslint: "npm:9.39.5" - eslint-plugin-eslint-comments: "npm:3.2.0" + "@eslint-community/eslint-plugin-eslint-comments": "npm:4.7.2" + "@eslint/compat": "npm:2.0.2" + "@eslint/js": "npm:10.0.1" + eslint: "npm:10.8.0" eslint-plugin-import-x: "npm:4.17.1" eslint-plugin-jsdoc: "npm:64.1.0" eslint-plugin-regexp: "npm:3.2.0" @@ -1008,7 +1009,7 @@ __metadata: "@typescript-eslint/parser": "npm:8.67.0" "@typescript-eslint/rule-tester": "npm:8.67.0" "@typescript-eslint/utils": "npm:8.67.0" - eslint: "npm:9.39.5" + eslint: "npm:10.8.0" vue-eslint-parser: "npm:10.4.1" peerDependencies: eslint: ">=9.0.0" @@ -1151,6 +1152,18 @@ __metadata: languageName: node linkType: hard +"@eslint-community/eslint-plugin-eslint-comments@npm:4.7.2": + version: 4.7.2 + resolution: "@eslint-community/eslint-plugin-eslint-comments@npm:4.7.2" + dependencies: + escape-string-regexp: "npm:^4.0.0" + ignore: "npm:^7.0.5" + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 + checksum: 10c0/196028413b216c069d2bd43281951a1031ab01e49045b39a5c903b137f8c5cb0fe46f445fbbe00f9ea8411242c55c642aa32488ed1ea8bd4b6c97344f329026c + languageName: node + linkType: hard + "@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.8.0, @eslint-community/eslint-utils@npm:^4.9.0, @eslint-community/eslint-utils@npm:^4.9.1": version: 4.9.1 resolution: "@eslint-community/eslint-utils@npm:4.9.1" @@ -1162,80 +1175,82 @@ __metadata: languageName: node linkType: hard -"@eslint-community/regexpp@npm:^4.11.0, @eslint-community/regexpp@npm:^4.12.1, @eslint-community/regexpp@npm:^4.12.2, @eslint-community/regexpp@npm:^4.8.0": +"@eslint-community/regexpp@npm:^4.11.0, @eslint-community/regexpp@npm:^4.12.2, @eslint-community/regexpp@npm:^4.8.0": version: 4.12.2 resolution: "@eslint-community/regexpp@npm:4.12.2" checksum: 10c0/fddcbc66851b308478d04e302a4d771d6917a0b3740dc351513c0da9ca2eab8a1adf99f5e0aa7ab8b13fa0df005c81adeee7e63a92f3effd7d367a163b721c2d languageName: node linkType: hard -"@eslint/config-array@npm:^0.21.2": - version: 0.21.2 - resolution: "@eslint/config-array@npm:0.21.2" +"@eslint/compat@npm:2.0.2": + version: 2.0.2 + resolution: "@eslint/compat@npm:2.0.2" dependencies: - "@eslint/object-schema": "npm:^2.1.7" - debug: "npm:^4.3.1" - minimatch: "npm:^3.1.5" - checksum: 10c0/89dfe815d18456177c0a1f238daf4593107fd20298b3598e0103054360d3b8d09d967defd8318f031185d68df1f95cfa68becf1390a9c5c6887665f1475142e3 + "@eslint/core": "npm:^1.1.0" + peerDependencies: + eslint: ^8.40 || 9 || 10 + peerDependenciesMeta: + eslint: + optional: true + checksum: 10c0/176df611bcb54ff7d9c3ac440df6844e552a4ed5de30eba28edbeebb68ccc7f19111fdd4c10780101ee5f871bd03ec0457f38c67834c285751c2bdb37d8ae73c languageName: node linkType: hard -"@eslint/config-helpers@npm:^0.4.2": - version: 0.4.2 - resolution: "@eslint/config-helpers@npm:0.4.2" +"@eslint/config-array@npm:^0.23.5": + version: 0.23.5 + resolution: "@eslint/config-array@npm:0.23.5" dependencies: - "@eslint/core": "npm:^0.17.0" - checksum: 10c0/92efd7a527b2d17eb1a148409d71d80f9ac160b565ac73ee092252e8bf08ecd08670699f46b306b94f13d22e88ac88a612120e7847570dd7cdc72f234d50dcb4 + "@eslint/object-schema": "npm:^3.0.5" + debug: "npm:^4.3.1" + minimatch: "npm:^10.2.4" + checksum: 10c0/b24833c4c76e78ee075d306cd3f095db46b2db0f90cc13a6ee6e4275f9889731c05bf5403ab5fefb79c756e07ac9184ed0e04570341382f9eccbccc80e6d1a0c languageName: node linkType: hard -"@eslint/core@npm:^0.17.0": - version: 0.17.0 - resolution: "@eslint/core@npm:0.17.0" +"@eslint/config-helpers@npm:^0.7.0": + version: 0.7.0 + resolution: "@eslint/config-helpers@npm:0.7.0" dependencies: - "@types/json-schema": "npm:^7.0.15" - checksum: 10c0/9a580f2246633bc752298e7440dd942ec421860d1946d0801f0423830e67887e4aeba10ab9a23d281727a978eb93d053d1922a587d502942a713607f40ed704e + "@eslint/core": "npm:^1.2.1" + checksum: 10c0/fd40d57d6f1db49f7b647048b88a433dc7f6522ef3edf855a43cb526ef4fc40622ceed0dc8de2e03d254f30f8e035370570de1d4bd8e7c2b1200131451e0d331 languageName: node linkType: hard -"@eslint/eslintrc@npm:^3.3.6": - version: 3.3.6 - resolution: "@eslint/eslintrc@npm:3.3.6" +"@eslint/core@npm:^1.1.0, @eslint/core@npm:^1.2.1": + version: 1.2.1 + resolution: "@eslint/core@npm:1.2.1" dependencies: - ajv: "npm:^6.14.0" - debug: "npm:^4.3.2" - espree: "npm:^10.0.1" - globals: "npm:^14.0.0" - ignore: "npm:^5.2.0" - import-fresh: "npm:^3.2.1" - js-yaml: "npm:^4.3.0" - minimatch: "npm:^3.1.5" - strip-json-comments: "npm:^3.1.1" - checksum: 10c0/349697171ee116f501a2f483bf47cd38937a61880aeb1c23481a69afc95e95859430a0947acbe1f5507f223180bf57530ecf2989e73bcbea763a6dcffdf1d010 + "@types/json-schema": "npm:^7.0.15" + checksum: 10c0/10979b40588ecfef771fcb5013a542a35fb30692cc95a65f3481b0b36fbd89f5679efeb30d57f4eed35203d859aabace2a620177d6c536f71b299a1af2f3398f languageName: node linkType: hard -"@eslint/js@npm:9.39.5": - version: 9.39.5 - resolution: "@eslint/js@npm:9.39.5" - checksum: 10c0/49894e98ba313a7d3bfb1b20d55c0f9826be45a7db876fd84e533ac7f101b1d95b51cd22c6a6db3a45066b9c0d068c31b4a22fa0db8a6cc8744a25540efdb824 +"@eslint/js@npm:10.0.1": + version: 10.0.1 + resolution: "@eslint/js@npm:10.0.1" + peerDependencies: + eslint: ^10.0.0 + peerDependenciesMeta: + eslint: + optional: true + checksum: 10c0/9f3fcaf71ba7fdf65d82e8faad6ecfe97e11801cc3c362b306a88ea1ed1344ae0d35330dddb0e8ad18f010f6687a70b75491b9e01c8af57acd7987cee6b3ec6c languageName: node linkType: hard -"@eslint/object-schema@npm:^2.1.7": - version: 2.1.7 - resolution: "@eslint/object-schema@npm:2.1.7" - checksum: 10c0/936b6e499853d1335803f556d526c86f5fe2259ed241bc665000e1d6353828edd913feed43120d150adb75570cae162cf000b5b0dfc9596726761c36b82f4e87 +"@eslint/object-schema@npm:^3.0.5": + version: 3.0.5 + resolution: "@eslint/object-schema@npm:3.0.5" + checksum: 10c0/1db337431f520b99e9edda64ef5fafd7ec6a029843eeb608753025125b6649d861d843cffafafd3c4e37926d7d5f9ec0c6a8e3665c13c3da2144e8132892e92e languageName: node linkType: hard -"@eslint/plugin-kit@npm:^0.4.1": - version: 0.4.1 - resolution: "@eslint/plugin-kit@npm:0.4.1" +"@eslint/plugin-kit@npm:^0.7.2": + version: 0.7.2 + resolution: "@eslint/plugin-kit@npm:0.7.2" dependencies: - "@eslint/core": "npm:^0.17.0" + "@eslint/core": "npm:^1.2.1" levn: "npm:^0.4.1" - checksum: 10c0/51600f78b798f172a9915dffb295e2ffb44840d583427bc732baf12ecb963eb841b253300e657da91d890f4b323d10a1bd12934bf293e3018d8bb66fdce5217b + checksum: 10c0/aafba08077bcd6d7dde6c2e21db18086046a88f914f29971a84cac9ad2d48952ded1b293e665e523805297eff756522dafa16f0062195e2c7143dcd1d47d11ed languageName: node linkType: hard @@ -3602,7 +3617,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.15.0, acorn@npm:^8.16.0": +"acorn@npm:^8.16.0": version: 8.18.0 resolution: "acorn@npm:8.18.0" bin: @@ -4210,7 +4225,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:4.1.2, chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.1": +"chalk@npm:4.1.2, chalk@npm:^4.1.0, chalk@npm:^4.1.1": version: 4.1.2 resolution: "chalk@npm:4.1.2" dependencies: @@ -5516,18 +5531,6 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-eslint-comments@npm:3.2.0": - version: 3.2.0 - resolution: "eslint-plugin-eslint-comments@npm:3.2.0" - dependencies: - escape-string-regexp: "npm:^1.0.5" - ignore: "npm:^5.0.5" - peerDependencies: - eslint: ">=4.19.1" - checksum: 10c0/c71db824592dc8ea498021572a0bd33d763ef26126bdb3b84a027ca75a1adbe0894ec95024f7de39ef12308560e62cbf8af0d06ffe472be5ba8bd9169c928e96 - languageName: node - linkType: hard - "eslint-plugin-import-x@npm:4.17.1": version: 4.17.1 resolution: "eslint-plugin-import-x@npm:4.17.1" @@ -5630,7 +5633,7 @@ __metadata: languageName: node linkType: hard -"eslint-scope@npm:^8.2.0 || ^9.0.0": +"eslint-scope@npm:^8.2.0 || ^9.0.0, eslint-scope@npm:^9.1.2": version: 9.1.2 resolution: "eslint-scope@npm:9.1.2" dependencies: @@ -5642,16 +5645,6 @@ __metadata: languageName: node linkType: hard -"eslint-scope@npm:^8.4.0": - version: 8.4.0 - resolution: "eslint-scope@npm:8.4.0" - dependencies: - esrecurse: "npm:^4.3.0" - estraverse: "npm:^5.2.0" - checksum: 10c0/407f6c600204d0f3705bd557f81bd0189e69cd7996f408f8971ab5779c0af733d1af2f1412066b40ee1588b085874fc37a2333986c6521669cdbdd36ca5058e0 - languageName: node - linkType: hard - "eslint-visitor-keys@npm:^3.4.3": version: 3.4.3 resolution: "eslint-visitor-keys@npm:3.4.3" @@ -5666,38 +5659,28 @@ __metadata: languageName: node linkType: hard -"eslint-visitor-keys@npm:^4.2.1": - version: 4.2.1 - resolution: "eslint-visitor-keys@npm:4.2.1" - checksum: 10c0/fcd43999199d6740db26c58dbe0c2594623e31ca307e616ac05153c9272f12f1364f5a0b1917a8e962268fdecc6f3622c1c2908b4fcc2e047a106fe6de69dc43 - languageName: node - linkType: hard - -"eslint@npm:9.39.5": - version: 9.39.5 - resolution: "eslint@npm:9.39.5" +"eslint@npm:10.8.0": + version: 10.8.0 + resolution: "eslint@npm:10.8.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.8.0" - "@eslint-community/regexpp": "npm:^4.12.1" - "@eslint/config-array": "npm:^0.21.2" - "@eslint/config-helpers": "npm:^0.4.2" - "@eslint/core": "npm:^0.17.0" - "@eslint/eslintrc": "npm:^3.3.6" - "@eslint/js": "npm:9.39.5" - "@eslint/plugin-kit": "npm:^0.4.1" + "@eslint-community/regexpp": "npm:^4.12.2" + "@eslint/config-array": "npm:^0.23.5" + "@eslint/config-helpers": "npm:^0.7.0" + "@eslint/core": "npm:^1.2.1" + "@eslint/plugin-kit": "npm:^0.7.2" "@humanfs/node": "npm:^0.16.6" "@humanwhocodes/module-importer": "npm:^1.0.1" "@humanwhocodes/retry": "npm:^0.4.2" "@types/estree": "npm:^1.0.6" ajv: "npm:^6.14.0" - chalk: "npm:^4.0.0" cross-spawn: "npm:^7.0.6" debug: "npm:^4.3.2" escape-string-regexp: "npm:^4.0.0" - eslint-scope: "npm:^8.4.0" - eslint-visitor-keys: "npm:^4.2.1" - espree: "npm:^10.4.0" - esquery: "npm:^1.5.0" + eslint-scope: "npm:^9.1.2" + eslint-visitor-keys: "npm:^5.0.1" + espree: "npm:^11.2.0" + esquery: "npm:^1.7.0" esutils: "npm:^2.0.2" fast-deep-equal: "npm:^3.1.3" file-entry-cache: "npm:^8.0.0" @@ -5707,8 +5690,7 @@ __metadata: imurmurhash: "npm:^0.1.4" is-glob: "npm:^4.0.0" json-stable-stringify-without-jsonify: "npm:^1.0.1" - lodash.merge: "npm:^4.6.2" - minimatch: "npm:^3.1.5" + minimatch: "npm:^10.2.5" natural-compare: "npm:^1.4.0" optionator: "npm:^0.9.3" peerDependencies: @@ -5718,7 +5700,7 @@ __metadata: optional: true bin: eslint: bin/eslint.js - checksum: 10c0/46335bfcf180ffea9955b38122b578ac9e075b6220e5695be1c988354ea429b04f5db05edc132aa9019ce9847736e9ca0c9ea6d6cedda3c06209c9b52dbd0fd5 + checksum: 10c0/2dbc523578834088615f388e08418d2620b25655f7a398f6d415765fa2a3a25d6b8b43bd3293d40f977e12752323a841d52654a2648697a00c0102c9794bb3dc languageName: node linkType: hard @@ -5733,17 +5715,6 @@ __metadata: languageName: node linkType: hard -"espree@npm:^10.0.1, espree@npm:^10.4.0": - version: 10.4.0 - resolution: "espree@npm:10.4.0" - dependencies: - acorn: "npm:^8.15.0" - acorn-jsx: "npm:^5.3.2" - eslint-visitor-keys: "npm:^4.2.1" - checksum: 10c0/c63fe06131c26c8157b4083313cb02a9a54720a08e21543300e55288c40e06c3fc284bdecf108d3a1372c5934a0a88644c98714f38b6ae8ed272b40d9ea08d6b - languageName: node - linkType: hard - "esprima@npm:^4.0.0, esprima@npm:^4.0.1": version: 4.0.1 resolution: "esprima@npm:4.0.1" @@ -5754,7 +5725,7 @@ __metadata: languageName: node linkType: hard -"esquery@npm:^1.5.0, esquery@npm:^1.6.0, esquery@npm:^1.7.0": +"esquery@npm:^1.6.0, esquery@npm:^1.7.0": version: 1.7.0 resolution: "esquery@npm:1.7.0" dependencies: @@ -6533,13 +6504,6 @@ __metadata: languageName: node linkType: hard -"globals@npm:^14.0.0": - version: 14.0.0 - resolution: "globals@npm:14.0.0" - checksum: 10c0/b96ff42620c9231ad468d4c58ff42afee7777ee1c963013ff8aabe095a451d0ceeb8dcd8ef4cbd64d2538cef45f787a78ba3a9574f4a634438963e334471302d - languageName: node - linkType: hard - "globals@npm:^16.4.0": version: 16.5.0 resolution: "globals@npm:16.5.0" @@ -6916,7 +6880,7 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.0.5, ignore@npm:^5.2.0": +"ignore@npm:^5.2.0": version: 5.3.2 resolution: "ignore@npm:5.3.2" checksum: 10c0/f9f652c957983634ded1e7f02da3b559a0d4cc210fca3792cb67f1b153623c9c42efdc1c4121af171e295444459fc4a9201101fb041b1104a3c000bccb188337 @@ -6930,7 +6894,7 @@ __metadata: languageName: node linkType: hard -"import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": +"import-fresh@npm:^3.3.0": version: 3.3.1 resolution: "import-fresh@npm:3.3.1" dependencies: @@ -8070,7 +8034,7 @@ __metadata: languageName: node linkType: hard -"lodash.merge@npm:4.6.2, lodash.merge@npm:^4.6.2": +"lodash.merge@npm:4.6.2": version: 4.6.2 resolution: "lodash.merge@npm:4.6.2" checksum: 10c0/402fa16a1edd7538de5b5903a90228aa48eb5533986ba7fa26606a49db2572bf414ff73a2c9f5d5fd36b31c46a5d5c7e1527749c07cbcf965ccff5fbdf32c506 @@ -8584,7 +8548,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^10.0.3, minimatch@npm:^10.1.1, minimatch@npm:^10.2.2, minimatch@npm:^9.0.3 || ^10.1.2": +"minimatch@npm:^10.0.3, minimatch@npm:^10.1.1, minimatch@npm:^10.2.2, minimatch@npm:^10.2.4, minimatch@npm:^10.2.5, minimatch@npm:^9.0.3 || ^10.1.2": version: 10.2.6 resolution: "minimatch@npm:10.2.6" dependencies: @@ -8593,7 +8557,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^3.0.3, minimatch@npm:^3.1.1, minimatch@npm:^3.1.5": +"minimatch@npm:^3.0.3, minimatch@npm:^3.1.1": version: 3.1.5 resolution: "minimatch@npm:3.1.5" dependencies: @@ -11069,7 +11033,7 @@ __metadata: languageName: node linkType: hard -"strip-json-comments@npm:3.1.1, strip-json-comments@npm:^3.0.1, strip-json-comments@npm:^3.1.1": +"strip-json-comments@npm:3.1.1, strip-json-comments@npm:^3.0.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" checksum: 10c0/9681a6257b925a7fa0f285851c0e613cc934a50661fa7bb41ca9cbbff89686bb4a0ee366e6ecedc4daafd01e83eee0720111ab294366fe7c185e935475ebcecd From bf9ef2266451cedf5ac6a5c68db36aa4ebc081f7 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 12:59:03 +0900 Subject: [PATCH 05/15] chore(eslint-plugin): bump eslint to 10.9.1 --- packages/@d-zero/eslint-plugin/package.json | 2 +- yarn.lock | 263 +++++++++++++------- 2 files changed, 171 insertions(+), 94 deletions(-) diff --git a/packages/@d-zero/eslint-plugin/package.json b/packages/@d-zero/eslint-plugin/package.json index 94e3cd8d..13d81b60 100644 --- a/packages/@d-zero/eslint-plugin/package.json +++ b/packages/@d-zero/eslint-plugin/package.json @@ -30,7 +30,7 @@ "devDependencies": { "@typescript-eslint/parser": "8.68.0", "@typescript-eslint/rule-tester": "8.68.0", - "eslint": "10.8.0", + "eslint": "10.9.1", "vue-eslint-parser": "10.4.1" } } diff --git a/yarn.lock b/yarn.lock index 75135a38..6b0b3a26 100644 --- a/yarn.lock +++ b/yarn.lock @@ -39,7 +39,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.28.5, @babel/helper-validator-identifier@npm:^7.29.7": +"@babel/helper-validator-identifier@npm:^7.29.7": version: 7.29.7 resolution: "@babel/helper-validator-identifier@npm:7.29.7" checksum: 10c0/4795354e7ae0dcafa72de1cd04ec51252dc1498517170beaf019e03effc5b7bf13c6b21a3949a77e07b8125be7f106ed1131350d8ebd4566ae874094a726d62b @@ -989,14 +989,14 @@ __metadata: dependencies: "@d-zero/eslint-plugin": "npm:5.0.0" "@eslint-community/eslint-plugin-eslint-comments": "npm:4.7.2" - "@eslint/compat": "npm:2.0.2" + "@eslint/compat": "npm:2.1.0" "@eslint/js": "npm:10.0.1" - eslint: "npm:10.8.0" + eslint: "npm:10.9.1" eslint-plugin-import-x: "npm:4.17.1" - eslint-plugin-jsdoc: "npm:64.2.1" + eslint-plugin-jsdoc: "npm:64.3.2" eslint-plugin-regexp: "npm:3.2.0" eslint-plugin-sort-class-members: "npm:1.22.1" - eslint-plugin-unicorn: "npm:63.0.0" + eslint-plugin-unicorn: "npm:74.0.0" globals: "npm:17.11.0" typescript-eslint: "npm:8.68.0" languageName: unknown @@ -1009,7 +1009,7 @@ __metadata: "@typescript-eslint/parser": "npm:8.68.0" "@typescript-eslint/rule-tester": "npm:8.68.0" "@typescript-eslint/utils": "npm:8.68.0" - eslint: "npm:10.8.0" + eslint: "npm:10.9.1" vue-eslint-parser: "npm:10.4.1" peerDependencies: eslint: ">=9.0.0" @@ -1220,7 +1220,7 @@ __metadata: languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.8.0, @eslint-community/eslint-utils@npm:^4.9.0, @eslint-community/eslint-utils@npm:^4.9.1": +"@eslint-community/eslint-utils@npm:^4.10.1, @eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.8.0, @eslint-community/eslint-utils@npm:^4.9.1": version: 4.10.1 resolution: "@eslint-community/eslint-utils@npm:4.10.1" dependencies: @@ -1238,17 +1238,17 @@ __metadata: languageName: node linkType: hard -"@eslint/compat@npm:2.0.2": - version: 2.0.2 - resolution: "@eslint/compat@npm:2.0.2" +"@eslint/compat@npm:2.1.0": + version: 2.1.0 + resolution: "@eslint/compat@npm:2.1.0" dependencies: - "@eslint/core": "npm:^1.1.0" + "@eslint/core": "npm:^1.2.1" peerDependencies: eslint: ^8.40 || 9 || 10 peerDependenciesMeta: eslint: optional: true - checksum: 10c0/176df611bcb54ff7d9c3ac440df6844e552a4ed5de30eba28edbeebb68ccc7f19111fdd4c10780101ee5f871bd03ec0457f38c67834c285751c2bdb37d8ae73c + checksum: 10c0/05b9e54813f124c45a8142571dbc539ea06bfc70a21e28c5d39a145578a62c733a9029850b89e357ee5924b1ea19611bf4d7cfe894595028730f691b86e9815b languageName: node linkType: hard @@ -1272,7 +1272,7 @@ __metadata: languageName: node linkType: hard -"@eslint/core@npm:^1.1.0, @eslint/core@npm:^1.2.1": +"@eslint/core@npm:^1.2.1": version: 1.2.1 resolution: "@eslint/core@npm:1.2.1" dependencies: @@ -1281,6 +1281,16 @@ __metadata: languageName: node linkType: hard +"@eslint/css-tree@npm:^4.0.5": + version: 4.0.5 + resolution: "@eslint/css-tree@npm:4.0.5" + dependencies: + mdn-data: "npm:2.29.0" + source-map-js: "npm:^1.2.1" + checksum: 10c0/7fbcb169c98dc8172503b3b1f4bd58b65959e611387f936aa0df193b4c3111f02a79597b7363a5120dddac491117d448e02216379f675070fad7ab1256d8da3b + languageName: node + linkType: hard + "@eslint/js@npm:10.0.1": version: 10.0.1 resolution: "@eslint/js@npm:10.0.1" @@ -3381,20 +3391,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:8.68.0, @typescript-eslint/types@npm:^8.68.0": +"@typescript-eslint/types@npm:8.68.0, @typescript-eslint/types@npm:^8.56.0, @typescript-eslint/types@npm:^8.67.0, @typescript-eslint/types@npm:^8.68.0": version: 8.68.0 resolution: "@typescript-eslint/types@npm:8.68.0" checksum: 10c0/c7e64094de90ff81a53572651e670f7566163df8a14ffd6c5822212d8412db590976a9a2aaed965b390cefe389e9ec3d498862127212ca840a4a80527dae6972 languageName: node linkType: hard -"@typescript-eslint/types@npm:^8.56.0, @typescript-eslint/types@npm:^8.67.0": - version: 8.67.0 - resolution: "@typescript-eslint/types@npm:8.67.0" - checksum: 10c0/b892a00d4cbea9604a0abf6eedd0ea019b27df4220a1d90e0035101cb4f846722c9e3eeadce40b423c1e0240709bbc787c6ca49bcc4f8c25ba23b4bd0436492a - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:8.68.0": version: 8.68.0 resolution: "@typescript-eslint/typescript-estree@npm:8.68.0" @@ -3414,7 +3417,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:8.68.0": +"@typescript-eslint/utils@npm:8.68.0, @typescript-eslint/utils@npm:^8.68.0": version: 8.68.0 resolution: "@typescript-eslint/utils@npm:8.68.0" dependencies: @@ -4203,7 +4206,7 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:^4.28.7": +"browserslist@npm:^4.28.7, browserslist@npm:^4.28.8": version: 4.28.8 resolution: "browserslist@npm:4.28.8" dependencies: @@ -4474,22 +4477,13 @@ __metadata: languageName: node linkType: hard -"ci-info@npm:^4.0.0, ci-info@npm:^4.3.1": +"ci-info@npm:^4.0.0, ci-info@npm:^4.4.0": version: 4.4.0 resolution: "ci-info@npm:4.4.0" checksum: 10c0/44156201545b8dde01aa8a09ee2fe9fc7a73b1bef9adbd4606c9f61c8caeeb73fb7a575c88b0443f7b4edb5ee45debaa59ed54ba5f99698339393ca01349eb3a languageName: node linkType: hard -"clean-regexp@npm:^1.0.0": - version: 1.0.0 - resolution: "clean-regexp@npm:1.0.0" - dependencies: - escape-string-regexp: "npm:^1.0.5" - checksum: 10c0/fd9c7446551b8fc536f95e8a286d431017cd4ba1ec2e53997ec9159385e9c317672f6dfc4d49fdb97449fdb53b0bacd0a8bab9343b8fdd2e46c7ddf6173d0db7 - languageName: node - linkType: hard - "clean-stack@npm:^2.0.0": version: 2.2.0 resolution: "clean-stack@npm:2.2.0" @@ -4863,6 +4857,13 @@ __metadata: languageName: node linkType: hard +"convert-hrtime@npm:^5.0.0": + version: 5.0.0 + resolution: "convert-hrtime@npm:5.0.0" + checksum: 10c0/2092e51aab205e1141440e84e2a89f8881e68e47c1f8bc168dfd7c67047d8f1db43bac28044bc05749205651fead4e7910f52c7bb6066213480df99e333e9f47 + languageName: node + linkType: hard + "convert-source-map@npm:^2.0.0": version: 2.0.0 resolution: "convert-source-map@npm:2.0.0" @@ -4870,7 +4871,7 @@ __metadata: languageName: node linkType: hard -"core-js-compat@npm:^3.46.0": +"core-js-compat@npm:^3.50.0": version: 3.50.0 resolution: "core-js-compat@npm:3.50.0" dependencies: @@ -5323,6 +5324,13 @@ __metadata: languageName: node linkType: hard +"detect-indent@npm:^7.0.2": + version: 7.0.2 + resolution: "detect-indent@npm:7.0.2" + checksum: 10c0/adb1334ca3fe516dc6817aff0a777540b88643ab92fe13a72d0f5d12721ca796ffdd0e5fedb7b45e6e82657156c6ad44f5d5758157f0439532ae7d07b595146b + languageName: node + linkType: hard + "detect-installed@npm:2.0.4": version: 2.0.4 resolution: "detect-installed@npm:2.0.4" @@ -5680,12 +5688,13 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-jsdoc@npm:64.2.1": - version: 64.2.1 - resolution: "eslint-plugin-jsdoc@npm:64.2.1" +"eslint-plugin-jsdoc@npm:64.3.2": + version: 64.3.2 + resolution: "eslint-plugin-jsdoc@npm:64.3.2" dependencies: "@es-joy/jsdoccomment": "npm:~0.95.1" "@es-joy/resolve.exports": "npm:1.2.0" + "@typescript-eslint/utils": "npm:^8.68.0" are-docs-informative: "npm:^0.1.1" comment-parser: "npm:1.4.8" debug: "npm:^4.4.3" @@ -5700,7 +5709,7 @@ __metadata: to-valid-identifier: "npm:^1.0.0" peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 - checksum: 10c0/e603889d46ee7e821b357c65a71572683ba43e303f7169e06147f73e3f9f216639353c19f9fcd3bec24e5a4db47b07de7d0c53696ac2511249f89e3894b5de9b + checksum: 10c0/0115e8de5141819d0bedb9356611fbc36d20ef8f051b93df19803e0a913cc11cb5bf531350e40ac5ae702e992b45a64191f6af627f0d8e7a71242e4c18b3dbf7 languageName: node linkType: hard @@ -5730,29 +5739,33 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-unicorn@npm:63.0.0": - version: 63.0.0 - resolution: "eslint-plugin-unicorn@npm:63.0.0" +"eslint-plugin-unicorn@npm:74.0.0": + version: 74.0.0 + resolution: "eslint-plugin-unicorn@npm:74.0.0" dependencies: - "@babel/helper-validator-identifier": "npm:^7.28.5" - "@eslint-community/eslint-utils": "npm:^4.9.0" + "@eslint-community/eslint-utils": "npm:^4.10.1" + "@eslint/css-tree": "npm:^4.0.5" + browserslist: "npm:^4.28.8" change-case: "npm:^5.4.4" - ci-info: "npm:^4.3.1" - clean-regexp: "npm:^1.0.0" - core-js-compat: "npm:^3.46.0" + ci-info: "npm:^4.4.0" + core-js-compat: "npm:^3.50.0" + detect-indent: "npm:^7.0.2" + entities: "npm:^8.0.0" find-up-simple: "npm:^1.0.1" - globals: "npm:^16.4.0" + globals: "npm:^17.11.0" indent-string: "npm:^5.0.0" is-builtin-module: "npm:^5.0.0" - jsesc: "npm:^3.1.0" + is-identifier: "npm:^1.1.0" pluralize: "npm:^8.0.0" - regexp-tree: "npm:^0.1.27" - regjsparser: "npm:^0.13.0" - semver: "npm:^7.7.3" + quote-js-string: "npm:^0.1.0" + regjsparser: "npm:^0.13.2" + reserved-identifiers: "npm:^1.2.0" + semver: "npm:^7.8.5" strip-indent: "npm:^4.1.1" + yaml: "npm:^2.9.0" peerDependencies: - eslint: ">=9.38.0" - checksum: 10c0/bc3550322a2b008ea9252e1a94a4f12a6c96c4387be563a5d62b879078cbe6b01c957843d31ec7d09fd8d8cf287ac00f8b93666721ff916b0166d4e82c80926c + eslint: ">=10.4" + checksum: 10c0/d23315e22e97f793d701833bb7f1f087d57f0dc1a21d74b46b84ff6335613756b6d4bf16cf7e7c9b659d1ce06ec3cef2f98c63395a22e7ee39dcdf83c0d379d0 languageName: node linkType: hard @@ -5782,9 +5795,9 @@ __metadata: languageName: node linkType: hard -"eslint@npm:10.8.0": - version: 10.8.0 - resolution: "eslint@npm:10.8.0" +"eslint@npm:10.9.1": + version: 10.9.1 + resolution: "eslint@npm:10.9.1" dependencies: "@eslint-community/eslint-utils": "npm:^4.8.0" "@eslint-community/regexpp": "npm:^4.12.2" @@ -5823,7 +5836,7 @@ __metadata: optional: true bin: eslint: bin/eslint.js - checksum: 10c0/2dbc523578834088615f388e08418d2620b25655f7a398f6d415765fa2a3a25d6b8b43bd3293d40f977e12752323a841d52654a2648697a00c0102c9794bb3dc + checksum: 10c0/11cfd118dced911d506dc752086a641b45c95996af1f7b2a1914f992bbcdca78bb56cd4dd281595c7a792e1562a49047aa65ce763e3ed809cbde84fe4a08924f languageName: node linkType: hard @@ -6366,6 +6379,13 @@ __metadata: languageName: node linkType: hard +"function-timeout@npm:^1.0.1": + version: 1.0.2 + resolution: "function-timeout@npm:1.0.2" + checksum: 10c0/75d7ac6c83c450b84face2c9d22307b00e10c7376aa3a34c7be260853582c5e4c502904e2f6bf1d4500c4052e748e001388f6bbd9d34ebfdfb6c4fec2169d0ff + languageName: node + linkType: hard + "functions-have-names@npm:^1.2.3": version: 1.2.3 resolution: "functions-have-names@npm:1.2.3" @@ -6616,20 +6636,13 @@ __metadata: languageName: node linkType: hard -"globals@npm:17.11.0": +"globals@npm:17.11.0, globals@npm:^17.11.0": version: 17.11.0 resolution: "globals@npm:17.11.0" checksum: 10c0/5e1be3d816e04d4d0d01b1cdd40e46b5fb6b5e9f15aece9a5919b060e0fb1b3f1b9e7327dce97ef19e05513a6d65872e0834999ddea251557556dddd0f5fde30 languageName: node linkType: hard -"globals@npm:^16.4.0": - version: 16.5.0 - resolution: "globals@npm:16.5.0" - checksum: 10c0/615241dae7851c8012f5aa0223005b1ed6607713d6813de0741768bd4ddc39353117648f1a7086b4b0fa45eae733f1c0a0fe369aa4e543bb63f8de8990178ea9 - languageName: node - linkType: hard - "globby@npm:^16.2.1": version: 16.2.3 resolution: "globby@npm:16.2.3" @@ -6976,6 +6989,15 @@ __metadata: languageName: node linkType: hard +"identifier-regex@npm:^1.1.0": + version: 1.1.0 + resolution: "identifier-regex@npm:1.1.0" + dependencies: + reserved-identifiers: "npm:^1.0.0" + checksum: 10c0/712d661d170bc5fbf05fa784aa8ddd6c262e095276db25df248e143dc5ee66fb09253e9fe2817f78b4181c33c88316cc68f5976cc6cbaa2564e918194154503a + languageName: node + linkType: hard + "ieee754@npm:1.2.1, ieee754@npm:^1.1.13": version: 1.2.1 resolution: "ieee754@npm:1.2.1" @@ -7361,6 +7383,16 @@ __metadata: languageName: node linkType: hard +"is-identifier@npm:^1.1.0": + version: 1.1.0 + resolution: "is-identifier@npm:1.1.0" + dependencies: + identifier-regex: "npm:^1.1.0" + super-regex: "npm:^1.1.0" + checksum: 10c0/86eaaedc3d2e37d4de0129f1714e992cc67844d782abc00f4f450a954a2fba2f84612a7a9a415318ad1ac7bc7b093e4004e79d3578d8c35653d0507a80eba298 + languageName: node + linkType: hard + "is-inside-container@npm:1.0.0, is-inside-container@npm:^1.0.0": version: 1.0.0 resolution: "is-inside-container@npm:1.0.0" @@ -7616,7 +7648,7 @@ __metadata: languageName: node linkType: hard -"jsesc@npm:^3.1.0, jsesc@npm:~3.1.0": +"jsesc@npm:~3.1.0": version: 3.1.0 resolution: "jsesc@npm:3.1.0" bin: @@ -8226,6 +8258,17 @@ __metadata: languageName: node linkType: hard +"make-asynchronous@npm:^1.0.1": + version: 1.1.0 + resolution: "make-asynchronous@npm:1.1.0" + dependencies: + p-event: "npm:^6.0.0" + type-fest: "npm:^4.6.0" + web-worker: "npm:^1.5.0" + checksum: 10c0/794c4876839f00bc6e287a1f07177dc3bb5c177d06d4ebe9e3a055758d9740b9b296a957c9015bed8d0d92d70035c70108e4c7d7bc2880fb16b94d0bd4b75a37 + languageName: node + linkType: hard + "make-fetch-happen@npm:15.0.2": version: 15.0.2 resolution: "make-fetch-happen@npm:15.0.2" @@ -8460,6 +8503,13 @@ __metadata: languageName: node linkType: hard +"mdn-data@npm:2.29.0": + version: 2.29.0 + resolution: "mdn-data@npm:2.29.0" + checksum: 10c0/b973a82d0764ebe611014e3be1c174cbcd235f3d5f1f943530be03b2d2ec74e9db0b0018b2940e8f1f41ca887d1298dcd1d49738e6982f484dbbebccc0250652 + languageName: node + linkType: hard + "memorystream@npm:^0.3.1": version: 0.3.1 resolution: "memorystream@npm:0.3.1" @@ -9498,6 +9548,15 @@ __metadata: languageName: node linkType: hard +"p-event@npm:^6.0.0": + version: 6.0.1 + resolution: "p-event@npm:6.0.1" + dependencies: + p-timeout: "npm:^6.1.2" + checksum: 10c0/c2da4d3f445376db2130d740b41309f97e8802d17277590684ca51cdcafcc77a024ccdd6b1a24c275c49c3c4ef57bbfc499e6d2b3b18813c774aaceb81cde7b4 + languageName: node + linkType: hard + "p-finally@npm:^1.0.0": version: 1.0.0 resolution: "p-finally@npm:1.0.0" @@ -9550,14 +9609,7 @@ __metadata: languageName: node linkType: hard -"p-map@npm:^7.0.2": - version: 7.0.6 - resolution: "p-map@npm:7.0.6" - checksum: 10c0/46e3b3c79b6179613161aa1a28c72cfe7155f27f1928afee1b2406858728f9dd4c29637bba25cef9b50517caacdcb71549f5ff228292524b0069b2310922b22e - languageName: node - linkType: hard - -"p-map@npm:^7.0.6": +"p-map@npm:^7.0.2, p-map@npm:^7.0.6": version: 7.0.7 resolution: "p-map@npm:7.0.7" checksum: 10c0/41a94dca7f3e79b9b78ee343c22bfa2922357b2131eed93d12f0347c631450306463118d11ba4accac504463911dee7bddb97d14cbf7055f9d29d2ea99b28209 @@ -9583,6 +9635,13 @@ __metadata: languageName: node linkType: hard +"p-timeout@npm:^6.1.2": + version: 6.1.4 + resolution: "p-timeout@npm:6.1.4" + checksum: 10c0/019edad1c649ab07552aa456e40ce7575c4b8ae863191477f02ac8d283ac8c66cedef0ca93422735130477a051dfe952ba717641673fd3599befdd13f63bcc33 + languageName: node + linkType: hard + "p-try@npm:^2.0.0": version: 2.2.0 resolution: "p-try@npm:2.2.0" @@ -9862,14 +9921,7 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^4.0.2, picomatch@npm:^4.0.3, picomatch@npm:^4.0.4, picomatch@npm:^4.0.5": - version: 4.0.5 - resolution: "picomatch@npm:4.0.5" - checksum: 10c0/947bc6b6e1ff1e6c5aaf95b107a0839d12802f4f7b867663f67d47accba939ca1cb582cf99dfc30438efa1c4648ac5990967e783e8929c36b03e8440704ef1bd - languageName: node - linkType: hard - -"picomatch@npm:^4.0.7": +"picomatch@npm:^4.0.2, picomatch@npm:^4.0.3, picomatch@npm:^4.0.4, picomatch@npm:^4.0.5, picomatch@npm:^4.0.7": version: 4.0.7 resolution: "picomatch@npm:4.0.7" checksum: 10c0/beb6ae02c43ae44e84883b90830196d9046b1726ead292adcf7f57945e0bb0d992d68563d87e03b484b6f3c9a5c6defda7523477f047d7f0e663f126cc01787f @@ -10226,6 +10278,13 @@ __metadata: languageName: node linkType: hard +"quote-js-string@npm:^0.1.0": + version: 0.1.0 + resolution: "quote-js-string@npm:0.1.0" + checksum: 10c0/72b18e676ae2397d91b90966b41babe3d0203ddbccf28c5e7f91fd4aa827d1c2259abeef597d1404a689cf75f085792b592196dec074f164cc3950172caabd5f + languageName: node + linkType: hard + "rc-config-loader@npm:^4.1.4": version: 4.1.4 resolution: "rc-config-loader@npm:4.1.4" @@ -10352,15 +10411,6 @@ __metadata: languageName: node linkType: hard -"regexp-tree@npm:^0.1.27": - version: 0.1.27 - resolution: "regexp-tree@npm:0.1.27" - bin: - regexp-tree: bin/regexp-tree - checksum: 10c0/f636f44b4a0d93d7d6926585ecd81f63e4ce2ac895bc417b2ead0874cd36b337dcc3d0fedc63f69bf5aaeaa4340f36ca7e750c9687cceaf8087374e5284e843c - languageName: node - linkType: hard - "regexp.prototype.flags@npm:^1.1.1, regexp.prototype.flags@npm:^1.5.3": version: 1.5.4 resolution: "regexp.prototype.flags@npm:1.5.4" @@ -10375,7 +10425,7 @@ __metadata: languageName: node linkType: hard -"regjsparser@npm:^0.13.0": +"regjsparser@npm:^0.13.2": version: 0.13.2 resolution: "regjsparser@npm:0.13.2" dependencies: @@ -10476,7 +10526,7 @@ __metadata: languageName: node linkType: hard -"reserved-identifiers@npm:^1.0.0": +"reserved-identifiers@npm:^1.0.0, reserved-identifiers@npm:^1.2.0": version: 1.2.0 resolution: "reserved-identifiers@npm:1.2.0" checksum: 10c0/b82651b12e6c608e80463c3753d275bc20fd89294d0415f04e670aeec3611ae3582ddc19e8fedd497e7d0bcbfaddab6a12823ec86e855b1e6a245e0a734eb43d @@ -11348,6 +11398,17 @@ __metadata: languageName: node linkType: hard +"super-regex@npm:^1.1.0": + version: 1.1.0 + resolution: "super-regex@npm:1.1.0" + dependencies: + function-timeout: "npm:^1.0.1" + make-asynchronous: "npm:^1.0.1" + time-span: "npm:^5.1.0" + checksum: 10c0/8135ed40e4e3c5ee7305ee8545e8ab99722e671e71546ef877bc25a5980e04bafe9abef44dd28abd801160340a331280b1d91b24ce97c67674931bb20d798eda + languageName: node + linkType: hard + "supports-color@npm:7.2.0, supports-color@npm:^7.1.0": version: 7.2.0 resolution: "supports-color@npm:7.2.0" @@ -11838,6 +11899,15 @@ __metadata: languageName: node linkType: hard +"time-span@npm:^5.1.0": + version: 5.1.0 + resolution: "time-span@npm:5.1.0" + dependencies: + convert-hrtime: "npm:^5.0.0" + checksum: 10c0/37b8284c53f4ee320377512ac19e3a034f2b025f5abd6959b8c1d0f69e0f06ab03681df209f2e452d30129e7b1f25bf573fb0f29d57e71f9b4a6b5b99f4c4b9e + languageName: node + linkType: hard + "tinybench@npm:^2.9.0": version: 2.9.0 resolution: "tinybench@npm:2.9.0" @@ -12640,6 +12710,13 @@ __metadata: languageName: node linkType: hard +"web-worker@npm:^1.5.0": + version: 1.5.0 + resolution: "web-worker@npm:1.5.0" + checksum: 10c0/d42744757422803c73ca64fa51e1ce994354ace4b8438b3f740425a05afeb8df12dd5dadbf6b0839a08dbda56c470d7943c0383854c4fb1ae40ab874eb10427a + languageName: node + linkType: hard + "whatwg-mimetype@npm:5.0.0": version: 5.0.0 resolution: "whatwg-mimetype@npm:5.0.0" From 417c512dd8372467cf340eca58fff8694a4e94fb Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 12:59:17 +0900 Subject: [PATCH 06/15] fix(eslint-plugin): rename abbreviated argument names per unicorn/name-replacements --- .../src/rules/no-click-event/index.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/@d-zero/eslint-plugin/src/rules/no-click-event/index.ts b/packages/@d-zero/eslint-plugin/src/rules/no-click-event/index.ts index 14ba3765..ae733de9 100644 --- a/packages/@d-zero/eslint-plugin/src/rules/no-click-event/index.ts +++ b/packages/@d-zero/eslint-plugin/src/rules/no-click-event/index.ts @@ -22,9 +22,13 @@ export default createRule({ 'CallExpression[callee.property.name="addEventListener"]'( node: TSESTree.CallExpression, ) { - const args = node.arguments; - const firstArg = args[0]; - if (firstArg && firstArg.type === 'Literal' && firstArg.value === 'click') { + const arguments_ = node.arguments; + const firstArgument = arguments_[0]; + if ( + firstArgument && + firstArgument.type === 'Literal' && + firstArgument.value === 'click' + ) { context.report({ node, messageId: 'noClickEvent', @@ -46,8 +50,12 @@ export default createRule({ 'CallExpression[callee.type="MemberExpression"][callee.property.name="on"]'( node: TSESTree.CallExpression, ) { - const firstArg = node.arguments[0]; - if (firstArg && firstArg.type === 'Literal' && firstArg.value === 'click') { + const firstArgument = node.arguments[0]; + if ( + firstArgument && + firstArgument.type === 'Literal' && + firstArgument.value === 'click' + ) { context.report({ node, messageId: 'noClickEvent', From 8cc440ae8832c18a7e1e7c6c3e9735108e7e2b52 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 12:59:34 +0900 Subject: [PATCH 07/15] fix(csstree-scss-syntax): resolve eslint-plugin-unicorn v74 violations Rename abbreviated parameter names (name-replacements) and suppress no-this-outside-of-class where the css-tree parser API binds `this` to the parser context by design, not a class instance. --- packages/@d-zero/csstree-scss-syntax/src/index.ts | 3 +++ .../@d-zero/csstree-scss-syntax/src/node/sass-variable.ts | 3 +++ packages/@d-zero/csstree-scss-syntax/src/types.ts | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/@d-zero/csstree-scss-syntax/src/index.ts b/packages/@d-zero/csstree-scss-syntax/src/index.ts index f9834037..8a9052f1 100644 --- a/packages/@d-zero/csstree-scss-syntax/src/index.ts +++ b/packages/@d-zero/csstree-scss-syntax/src/index.ts @@ -21,6 +21,8 @@ const forked = CSSTree.fork( ...scope, Value: { ...scope.Value, + // `this` is the css-tree parser context bound at call time, not a class instance. + /* eslint-disable unicorn/no-this-outside-of-class */ // @ts-ignore getNode: function (context) { // @ts-ignore @@ -39,6 +41,7 @@ const forked = CSSTree.fork( return getNode.call(this, context); }, + /* eslint-enable unicorn/no-this-outside-of-class */ }, }, node: { diff --git a/packages/@d-zero/csstree-scss-syntax/src/node/sass-variable.ts b/packages/@d-zero/csstree-scss-syntax/src/node/sass-variable.ts index 97838e62..cbd8090a 100644 --- a/packages/@d-zero/csstree-scss-syntax/src/node/sass-variable.ts +++ b/packages/@d-zero/csstree-scss-syntax/src/node/sass-variable.ts @@ -6,6 +6,8 @@ export default { structure: { name: String, }, + // `this` is the css-tree parser context bound at call time, not a class instance. + /* eslint-disable unicorn/no-this-outside-of-class */ // @ts-ignore parse: function SassVariable() { // @ts-ignore @@ -22,6 +24,7 @@ export default { name: this.consume(IDENTIFIER), }; }, + /* eslint-enable unicorn/no-this-outside-of-class */ // @ts-ignore generate: function (node) { return '$' + node.name; diff --git a/packages/@d-zero/csstree-scss-syntax/src/types.ts b/packages/@d-zero/csstree-scss-syntax/src/types.ts index 96d6663c..5ebac786 100644 --- a/packages/@d-zero/csstree-scss-syntax/src/types.ts +++ b/packages/@d-zero/csstree-scss-syntax/src/types.ts @@ -16,15 +16,15 @@ export type CSSTreeModule = typeof CSSTree & { findAll: typeof CSSTree.findAll; fromPlainObject: typeof CSSTree.fromPlainObject; toPlainObject: typeof CSSTree.toPlainObject; - fork(...args: Parameters): CSSTreeModule; + fork(...arguments_: Parameters): CSSTreeModule; fork( - fn: (syntax: CSSTreeModule, assign: typeof Object.assign) => CSSTreeModule, + function_: (syntax: CSSTreeModule, assign: typeof Object.assign) => CSSTreeModule, ): CSSTreeModule; }; interface LexerEx extends CSSTree.Lexer { matchProperty( - ...args: Parameters + ...arguments_: Parameters ): LexerMatchResultMatched | LexerMatchResultMismatch; } From be5c46a3af9fc7d987c293584da51f5c233df510 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 12:59:56 +0900 Subject: [PATCH 08/15] fix(cz): rename abbreviated variable name per unicorn/name-replacements --- packages/@d-zero/cz-config/monorepo-scopes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@d-zero/cz-config/monorepo-scopes.js b/packages/@d-zero/cz-config/monorepo-scopes.js index ee3f2ea5..a8e365db 100644 --- a/packages/@d-zero/cz-config/monorepo-scopes.js +++ b/packages/@d-zero/cz-config/monorepo-scopes.js @@ -28,8 +28,8 @@ module.exports = function (removes) { if (!packageJson) { return null; } - const pkg = JSON.parse(packageJson); - let name = pkg.name; + const package_ = JSON.parse(packageJson); + let name = package_.name; for (const remove of removes) { name = name.replace(remove, ''); } From 60c4963a142a4d16d5955b0223ad7a2ab7e6dde9 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 13:00:11 +0900 Subject: [PATCH 09/15] fix(lint-staged): resolve eslint-plugin-unicorn v74 violations Rename abbreviated variable names (name-replacements) and extract the per-command-type logic into a function to avoid ambiguous continue statements in nested loops (no-break-in-nested-loop). --- .../@d-zero/lint-staged-config/src/index.ts | 109 ++++++++++-------- .../@d-zero/lint-staged-config/src/types.ts | 8 +- 2 files changed, 64 insertions(+), 53 deletions(-) diff --git a/packages/@d-zero/lint-staged-config/src/index.ts b/packages/@d-zero/lint-staged-config/src/index.ts index 371139cd..8717cb86 100644 --- a/packages/@d-zero/lint-staged-config/src/index.ts +++ b/packages/@d-zero/lint-staged-config/src/index.ts @@ -21,76 +21,93 @@ export type IgnoreMap = Partial>; /** * - * @param dirOptions + * @param directoryOptions * @param mapping */ export default function ( - dirOptions?: string | DirectoryOptions, + directoryOptions?: string | DirectoryOptions, mapping?: CommandMappings, ): LintStagedCommandMapper { return (allStagedFiles) => { - const commandList: string[] = []; const cwd = process.cwd(); - const dir = typeof dirOptions === 'string' ? dirOptions : dirOptions?.dir; - const ignore = typeof dirOptions === 'string' ? null : dirOptions?.ignore; + const directory = + typeof directoryOptions === 'string' ? directoryOptions : directoryOptions?.dir; + const ignore = typeof directoryOptions === 'string' ? null : directoryOptions?.ignore; - const baseDir = dir + const baseDirectory = directory ? // 絶対パスかどうか - path.isAbsolute(dir) + path.isAbsolute(directory) ? // 絶対パスならそのまま - dir + directory : // 相対パスなら絶対パスに変換 - path.resolve(cwd, dir) + path.resolve(cwd, directory) : // 引数がないならカレントディレクトリ cwd; - mapping = mapping ?? defaultMapping; + mapping ??= defaultMapping; + + /** + * + * @param extension + * @param commandType + */ + function buildCommand( + extension: string, + commandType: CommandType, + ): string | undefined { + const shell = commands[commandType]; + + if (!shell) { + return undefined; + } + + const pattern = path + .resolve(baseDirectory, '**', `{*.${extension},.*.${extension}}`) + .replaceAll(path.sep, '/'); - for (const [ext, commandTypes] of Object.entries(mapping)) { - for (const commandType of commandTypes) { - const shell = commands[commandType]; + const files = allStagedFiles.map((f) => f.replaceAll(path.sep, '/')); - if (!shell) { - continue; + let targetFiles = files.filter((file) => path.matchesGlob(file, pattern)); + + if (ignore) { + for (const ignoreMap of ignore) { + const ignorePattern = + typeof ignoreMap === 'string' ? ignoreMap : ignoreMap[commandType]; + if (!ignorePattern) { + continue; + } + const ignorePatterns = Array.isArray(ignorePattern) + ? ignorePattern + : [ignorePattern]; + const absIgnorePatterns = ignorePatterns.map((p) => { + if (p === path.basename(p)) { + return path.resolve('**', p).replaceAll(path.sep, '/'); + } + return path.isAbsolute(p) ? p : path.resolve(baseDirectory, p); + }); + targetFiles = targetFiles.filter((file) => + absIgnorePatterns.every((pattern) => !path.matchesGlob(file, pattern)), + ); } + } - const pattern = path - .resolve(baseDir, '**', `{*.${ext},.*.${ext}}`) - .replaceAll(path.sep, '/'); + if (targetFiles.length === 0) { + return undefined; + } - const files = allStagedFiles.map((f) => f.replaceAll(path.sep, '/')); + return shell + ' ' + targetFiles.map((f) => `"${f}"`).join(' '); + } - let targetFiles = files.filter((file) => path.matchesGlob(file, pattern)); + const commandList: string[] = []; - if (ignore) { - for (const ignoreMap of ignore) { - const ignorePattern = - typeof ignoreMap === 'string' ? ignoreMap : ignoreMap[commandType]; - if (!ignorePattern) { - continue; - } - const ignorePatterns = Array.isArray(ignorePattern) - ? ignorePattern - : [ignorePattern]; - const absIgnorePatterns = ignorePatterns.map((p) => { - if (p === path.basename(p)) { - return path.resolve('**', p).replaceAll(path.sep, '/'); - } - return path.isAbsolute(p) ? p : path.resolve(baseDir, p); - }); - targetFiles = targetFiles.filter( - (file) => - !absIgnorePatterns.some((pattern) => path.matchesGlob(file, pattern)), - ); - } - } + for (const [extension, commandTypes] of Object.entries(mapping)) { + for (const commandType of commandTypes) { + const command = buildCommand(extension, commandType); - if (targetFiles.length <= 0) { - continue; + if (command) { + commandList.push(command); } - - commandList.push(shell + ' ' + targetFiles.map((f) => `"${f}"`).join(' ')); } } diff --git a/packages/@d-zero/lint-staged-config/src/types.ts b/packages/@d-zero/lint-staged-config/src/types.ts index 834979dc..eea66377 100644 --- a/packages/@d-zero/lint-staged-config/src/types.ts +++ b/packages/@d-zero/lint-staged-config/src/types.ts @@ -21,13 +21,7 @@ export type TargetFileExtension = | 'yml'; export type CommandType = - | 'cspell' - | 'eslint' - | 'markuplint' - | 'prettier' - | 'puglint' - | 'stylelint' - | 'textlint'; + 'cspell' | 'eslint' | 'markuplint' | 'prettier' | 'puglint' | 'stylelint' | 'textlint'; export type CommandMappings = Readonly< Partial> From 3214c5aff42e77e1acd73642f6be46d68316ffb2 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 13:00:22 +0900 Subject: [PATCH 10/15] fix(markuplint): use https urls per unicorn/prefer-https --- packages/@d-zero/markuplint-config/base.js | 2 +- packages/@d-zero/markuplint-config/name.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@d-zero/markuplint-config/base.js b/packages/@d-zero/markuplint-config/base.js index d401580b..5956d89c 100644 --- a/packages/@d-zero/markuplint-config/base.js +++ b/packages/@d-zero/markuplint-config/base.js @@ -20,7 +20,7 @@ export default { { selector: 'html', rules: { - // + // 'invalid-attr': { options: { allowAttrs: [ diff --git a/packages/@d-zero/markuplint-config/name.js b/packages/@d-zero/markuplint-config/name.js index 9853989f..c32ff957 100644 --- a/packages/@d-zero/markuplint-config/name.js +++ b/packages/@d-zero/markuplint-config/name.js @@ -7,7 +7,7 @@ const nameBase = { severity: 'error', value: '/^c-(?[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/', reason: - 'クラス名の形式はディーゼロのコーディングガイドラインに則って命名する必要があります。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%F0%9F%92%8E-%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88', + 'クラス名の形式はディーゼロのコーディングガイドラインに則って命名する必要があります。 https://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%F0%9F%92%8E-%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88', }, }, childNodeRules: [ @@ -26,7 +26,7 @@ const nameBase = { '/^c-{{ ComponentName }}[a-z0-9]*(?:-[a-z0-9]+)*$/', ], reason: - 'ディーゼロのコーディングガイドラインではコンポーネントの中はそのコンポーネントのエレメントか、他のコンポーネントである必要があります。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88%E3%81%AE%E6%A7%8B%E6%88%90%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E5%91%BD%E5%90%8D%E8%A6%8F%E5%89%87', + 'ディーゼロのコーディングガイドラインではコンポーネントの中はそのコンポーネントのエレメントか、他のコンポーネントである必要があります。 https://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%B3%E3%83%B3%E3%83%9B%E3%82%9A%E3%83%BC%E3%83%8D%E3%83%B3%E3%83%88%E3%81%AE%E6%A7%8B%E6%88%90%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E5%91%BD%E5%90%8D%E8%A6%8F%E5%89%87', }, }, }, @@ -38,7 +38,7 @@ const nameBase = { severity: 'error', value: '/^(?!c-).+$|^$/', reason: - 'ディーゼロのコーディングガイドラインでは「c-content-main」の中は「c-」で始めないルールとなっています。 http://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%A8%E3%83%AC%E3%83%A1%E3%83%B3%E3%83%88%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%B9%E3%81%AE%E4%BE%8B%E5%A4%96%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E8%BF%BD%E5%8A%A0%E3%81%AE%E3%83%AB%E3%83%BC%E3%83%AB', + 'ディーゼロのコーディングガイドラインでは「c-content-main」の中は「c-」で始めないルールとなっています。 https://tmpl.d-zero.com/__guideline/coding-guideline/html.html#%E3%82%A8%E3%83%AC%E3%83%A1%E3%83%B3%E3%83%88%E3%81%AE%E3%82%AF%E3%83%A9%E3%82%B9%E3%81%AE%E4%BE%8B%E5%A4%96%E3%81%A8%E3%82%AF%E3%83%A9%E3%82%B9%E8%BF%BD%E5%8A%A0%E3%81%AE%E3%83%AB%E3%83%BC%E3%83%AB', }, }, }, From 5c81204241c1f6bdd32bdc1e218ed8790bac77f7 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 13:00:34 +0900 Subject: [PATCH 11/15] chore(eslint): bump @eslint/compat, eslint, eslint-plugin-jsdoc and eslint-plugin-unicorn eslint-plugin-jsdoc and typescript-eslint were kept below their latest published version because npm quarantines packages published within the last 24-72 hours. --- packages/@d-zero/eslint-config/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/@d-zero/eslint-config/package.json b/packages/@d-zero/eslint-config/package.json index ac57e1f5..f3b7433a 100644 --- a/packages/@d-zero/eslint-config/package.json +++ b/packages/@d-zero/eslint-config/package.json @@ -21,14 +21,14 @@ "dependencies": { "@d-zero/eslint-plugin": "5.0.0", "@eslint-community/eslint-plugin-eslint-comments": "4.7.2", - "@eslint/compat": "2.0.2", + "@eslint/compat": "2.1.0", "@eslint/js": "10.0.1", - "eslint": "10.8.0", + "eslint": "10.9.1", "eslint-plugin-import-x": "4.17.1", - "eslint-plugin-jsdoc": "64.2.1", + "eslint-plugin-jsdoc": "64.3.2", "eslint-plugin-regexp": "3.2.0", "eslint-plugin-sort-class-members": "1.22.1", - "eslint-plugin-unicorn": "63.0.0", + "eslint-plugin-unicorn": "74.0.0", "globals": "17.11.0", "typescript-eslint": "8.68.0" } From 71634052d9795fea0926a4c7d3bba16374b3979c Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 13:01:36 +0900 Subject: [PATCH 12/15] test(eslint): update prefer-top-level-await fixture for eslint-plugin-unicorn v74 The rule now ignores calls whose value is explicitly discarded with void, so the node fixture no longer triggers on `void asyncFn();`. Drop the void operator so the fixture still demonstrates a floating top-level async call that should be flagged. --- test/cli.spec.mjs | 8 ++++---- test/fixtures/eslint/node/prefer-top-level-await.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/cli.spec.mjs b/test/cli.spec.mjs index 9f36688b..9fc41b77 100644 --- a/test/cli.spec.mjs +++ b/test/cli.spec.mjs @@ -17,8 +17,8 @@ function n(filePath) { describe('ESLint', () => { const eslint = async (filepath, rule) => { - const dir = path.dirname(filepath); - const config = path.join(dir, 'eslint.config.js'); + const directory = path.dirname(filepath); + const config = path.join(directory, 'eslint.config.js'); const { stdout, stderr } = await execa( 'npx', ['eslint', filepath, '--config', config], @@ -74,7 +74,7 @@ describe('ESLint', () => { 'unicorn/prefer-top-level-await', ); expect(node).toStrictEqual([ - '5:6 error Prefer top-level await over an async function `asyncFn` call unicorn/prefer-top-level-await', + '5:1 error Prefer top-level await over an async function `asyncFn` call unicorn/prefer-top-level-await', ]); }); @@ -249,7 +249,7 @@ describe('stylelint', () => { }, ); - const json = stderr.split('error Command failed')[0] ?? stdout; + const json = stderr.split('error Command failed', 1)[0] ?? stdout; let violations; try { violations = JSON.parse(json); diff --git a/test/fixtures/eslint/node/prefer-top-level-await.ts b/test/fixtures/eslint/node/prefer-top-level-await.ts index d25a6f03..fa796f2c 100644 --- a/test/fixtures/eslint/node/prefer-top-level-await.ts +++ b/test/fixtures/eslint/node/prefer-top-level-await.ts @@ -2,4 +2,4 @@ async function asyncFn() { // do nothing } -void asyncFn(); +asyncFn(); From 0b15674d8ef6d93ef8a69f2295dcbb4e865f9304 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 13:02:19 +0900 Subject: [PATCH 13/15] fix(commitlint): prefer try/catch over promise chaining per unicorn/prefer-await --- packages/@d-zero/commitlint-config/get-cz-config.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/@d-zero/commitlint-config/get-cz-config.js b/packages/@d-zero/commitlint-config/get-cz-config.js index 657f27f5..a2c1a463 100644 --- a/packages/@d-zero/commitlint-config/get-cz-config.js +++ b/packages/@d-zero/commitlint-config/get-cz-config.js @@ -15,9 +15,15 @@ export async function getCZConfig() { return null; } - const modPath = czConfigPath.replace(/^(?:\.\/)?node_modules\//, ''); + const modulePath = czConfigPath.replace(/^(?:\.\/)?node_modules\//, ''); - const czConfig = await import(modPath).catch(() => null); + let czConfig; + + try { + czConfig = await import(modulePath); + } catch { + return null; + } return czConfig?.default ?? czConfig ?? null; } From d1d9056854c8abee027fc1b4130a8520bb23dbab Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 13:02:42 +0900 Subject: [PATCH 14/15] fix(stylelint-rules): resolve eslint-plugin-unicorn v74 violations Rename abbreviated identifiers (name-replacements), replace an existence-check-then-access with a single lookup (no-computed-property-existence-check), extract a nested-loop body into a predicate function (no-break-in-nested-loop), rename a non-boolean function away from a boolean-implying prefix (consistent-boolean-name), merge adjacent if statements into if/else (prefer-else-if), and split array-in-object destructuring across two statements in tests (no-unreadable-object-destructuring). --- .../index.spec.ts | 301 ++++++++---------- .../index.ts | 57 ++-- .../src/rules/component/index.spec.ts | 98 +++--- .../src/rules/component/index.ts | 56 ++-- .../index.spec.ts | 21 +- .../index.ts | 10 +- .../index.ts | 25 +- .../index.spec.ts | 84 +++-- .../shorthand-property-use-logical/index.ts | 18 +- .../src/utils/get-value-type.spec.ts | 4 +- .../src/utils/get-value-type.ts | 42 +-- 11 files changed, 329 insertions(+), 387 deletions(-) diff --git a/packages/@d-zero/stylelint-rules/src/rules/component-root-disallowed-properties/index.spec.ts b/packages/@d-zero/stylelint-rules/src/rules/component-root-disallowed-properties/index.spec.ts index 208e6b71..fd655fe5 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/component-root-disallowed-properties/index.spec.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/component-root-disallowed-properties/index.spec.ts @@ -17,14 +17,13 @@ describe('component-root-disallowed-properties', () => { describe('コンポーネントルートでの禁止プロパティチェック', () => { describe('width, inline-size', () => { test('width が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { width: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -32,14 +31,13 @@ describe('component-root-disallowed-properties', () => { }); test('inline-size が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { inline-size: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -47,56 +45,52 @@ describe('component-root-disallowed-properties', () => { }); test('min-width は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { min-width: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('max-width は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { max-width: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('min-inline-size は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { min-inline-size: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('max-inline-size は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { max-inline-size: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -105,14 +99,13 @@ describe('component-root-disallowed-properties', () => { describe('margin関連', () => { test('margin が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { margin: 10px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -120,14 +113,13 @@ describe('component-root-disallowed-properties', () => { }); test('margin-top が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { margin-top: 10px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -135,14 +127,13 @@ describe('component-root-disallowed-properties', () => { }); test('margin-block が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { margin-block: 10px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -152,14 +143,13 @@ describe('component-root-disallowed-properties', () => { describe('height, block-size', () => { test('height が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { height: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -167,14 +157,13 @@ describe('component-root-disallowed-properties', () => { }); test('block-size が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { block-size: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -182,56 +171,52 @@ describe('component-root-disallowed-properties', () => { }); test('min-height は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { min-height: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('max-height は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { max-height: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('min-block-size は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { min-block-size: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('max-block-size は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { max-block-size: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -240,14 +225,13 @@ describe('component-root-disallowed-properties', () => { describe('inset関連', () => { test('inset が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { inset: 0; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -255,14 +239,13 @@ describe('component-root-disallowed-properties', () => { }); test('top が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { top: 0; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -272,14 +255,13 @@ describe('component-root-disallowed-properties', () => { describe('position', () => { test('position: absolute が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { position: absolute; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -287,14 +269,13 @@ describe('component-root-disallowed-properties', () => { }); test('position: fixed が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { position: fixed; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -302,14 +283,13 @@ describe('component-root-disallowed-properties', () => { }); test('position: sticky が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { position: sticky; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -317,28 +297,26 @@ describe('component-root-disallowed-properties', () => { }); test('position: relative は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { position: relative; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('position: static は許可されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { position: static; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -347,14 +325,13 @@ describe('component-root-disallowed-properties', () => { describe('flex関連', () => { test('flex が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { flex: 1; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -362,14 +339,13 @@ describe('component-root-disallowed-properties', () => { }); test('flex-grow が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { flex-grow: 1; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -379,14 +355,13 @@ describe('component-root-disallowed-properties', () => { describe('その他の禁止プロパティ', () => { test('justify-self が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { justify-self: center; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -394,14 +369,13 @@ describe('component-root-disallowed-properties', () => { }); test('grid-area が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { grid-area: header; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -409,14 +383,13 @@ describe('component-root-disallowed-properties', () => { }); test('float が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { float: left; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -424,14 +397,13 @@ describe('component-root-disallowed-properties', () => { }); test('clear が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { clear: both; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -441,14 +413,13 @@ describe('component-root-disallowed-properties', () => { describe('c-content-main クラス', () => { test('c-content-main で width が禁止されている', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: '_c-content-main.scss', code: '.c-content-main { width: 100px; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -460,10 +431,7 @@ describe('component-root-disallowed-properties', () => { describe('コンポーネントルート以外ではエラーが出ないこと', () => { describe('コンポーネントの子要素', () => { test('SCSS: __element で禁止プロパティが使用されていてもエラーが出ない', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: '_c-component.scss', code: `.c-component { color: red; @@ -474,16 +442,15 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('CSS: __element で禁止プロパティが使用されていてもエラーが出ない', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { color: red; @@ -494,6 +461,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -502,10 +471,7 @@ describe('component-root-disallowed-properties', () => { describe('ネストされたルール', () => { test('SCSS: 子要素(__element)内で禁止プロパティが使用されていてもエラーが出ない', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: '_c-component.scss', code: `.c-component { color: red; @@ -516,16 +482,15 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('SCSS: 疑似クラス(:hover)内で禁止プロパティが使用されている場合はエラーが出る', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: '_c-component.scss', code: `.c-component { color: red; @@ -535,6 +500,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -544,10 +511,7 @@ describe('component-root-disallowed-properties', () => { describe('ファイル名と一致しないクラス名', () => { test('ファイル名と一致しないクラス名のルールで禁止プロパティが使用されていてもエラーが出ない', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { color: red; @@ -558,6 +522,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -566,10 +532,7 @@ describe('component-root-disallowed-properties', () => { describe('複数のルール', () => { test('コンポーネントルート以外のルールで禁止プロパティが使用されていてもエラーが出ない', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { color: red; @@ -585,6 +548,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -593,10 +558,7 @@ describe('component-root-disallowed-properties', () => { describe('疑似クラスの禁止', () => { test(':hover 内で禁止プロパティが使用されている場合はエラーが出る', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { &:hover { @@ -605,6 +567,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -612,10 +576,7 @@ describe('component-root-disallowed-properties', () => { }); test(':focus 内で禁止プロパティが使用されている場合はエラーが出る', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { &:focus { @@ -624,6 +585,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -631,10 +594,7 @@ describe('component-root-disallowed-properties', () => { }); test(':active 内で禁止プロパティが使用されている場合はエラーが出る', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { &:active { @@ -643,6 +603,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -650,10 +612,7 @@ describe('component-root-disallowed-properties', () => { }); test('複数の疑似クラスが組み合わさっている場合もエラーが出る', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { &:hover:focus { @@ -662,6 +621,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -671,10 +632,7 @@ describe('component-root-disallowed-properties', () => { describe('疑似要素の許可', () => { test('::before 内で禁止プロパティが使用されていてもエラーが出ない', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { &::before { @@ -685,16 +643,15 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('::after 内で禁止プロパティが使用されていてもエラーが出ない', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { &::after { @@ -704,16 +661,15 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('::first-line 内で禁止プロパティが使用されていてもエラーが出ない', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { &::first-line { @@ -722,6 +678,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -730,10 +688,7 @@ describe('component-root-disallowed-properties', () => { describe('疑似クラスと疑似要素の組み合わせ', () => { test(':hover::before のような組み合わせの場合、疑似要素が含まれているためエラーが出ない', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { &:hover::before { @@ -743,6 +698,8 @@ describe('component-root-disallowed-properties', () => { }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); diff --git a/packages/@d-zero/stylelint-rules/src/rules/component-root-disallowed-properties/index.ts b/packages/@d-zero/stylelint-rules/src/rules/component-root-disallowed-properties/index.ts index 472cd36f..7681c16c 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/component-root-disallowed-properties/index.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/component-root-disallowed-properties/index.ts @@ -51,13 +51,13 @@ const DISALLOWED_PROPERTIES: (string | { [propName: string]: string })[] = [ /** * プロパティが禁止されているかチェック - * @param prop + * @param property */ -function isDisallowedProperty(prop: string): boolean { - const normalizedProp = prop.toLowerCase(); +function isDisallowedProperty(property: string): boolean { + const normalizedProperty = property.toLowerCase(); return DISALLOWED_PROPERTIES.some((item) => { if (typeof item === 'string') { - return item === normalizedProp; + return item === normalizedProperty; } return false; }); @@ -65,19 +65,20 @@ function isDisallowedProperty(prop: string): boolean { /** * プロパティと値の組み合わせが禁止されているかチェック - * @param prop + * @param property * @param value */ -function isDisallowedPropertyValue(prop: string, value: string): boolean { - const normalizedProp = prop.toLowerCase(); +function isDisallowedPropertyValue(property: string, value: string): boolean { + const normalizedProperty = property.toLowerCase(); const normalizedValue = value.toLowerCase().trim(); return DISALLOWED_PROPERTIES.some((item) => { - if (typeof item === 'object') { - return ( - normalizedProp in item && item[normalizedProp]?.toLowerCase() === normalizedValue - ); + if (typeof item !== 'object') { + return false; } - return false; + const disallowedValue = Object.hasOwn(item, normalizedProperty) + ? item[normalizedProperty] + : undefined; + return disallowedValue?.toLowerCase() === normalizedValue; }); } @@ -100,14 +101,16 @@ function isComponentRoot(rule: Rule, basename: string): boolean { } for (const node of ruleFirstSelector.nodes) { - if (node.type === 'class') { - const className = node.value; + if (node.type !== 'class') { + continue; + } - // ファイル名と完全一致するクラス名のみがコンポーネントルート - // CSSファイルの場合は __ で始まるクラスは子要素なので除外 - if (className === basename) { - return true; - } + const className = node.value; + + // ファイル名と完全一致するクラス名のみがコンポーネントルート + // CSSファイルの場合は __ で始まるクラスは子要素なので除外 + if (className === basename) { + return true; } } @@ -162,10 +165,10 @@ export default createRule({ return; } - const ext = path.extname(fileName); - const originalBasename = path.basename(fileName, ext); + const extension = path.extname(fileName); + const originalBasename = path.basename(fileName, extension); - const basename = ['.scss', '.sass'].includes(ext) + const basename = ['.scss', '.sass'].includes(extension) ? originalBasename.replace(/^_/, '') : originalBasename; @@ -178,27 +181,27 @@ export default createRule({ const checkDeclarations = (rule: Rule) => { for (const node of rule.nodes) { if (node.type === 'decl') { - const prop = node.prop; + const property = node.prop; const value = node.value; // プロパティと値の組み合わせが禁止されているかチェック - if (isDisallowedPropertyValue(prop, value)) { + if (isDisallowedPropertyValue(property, value)) { const normalizedValue = value.toLowerCase().trim(); stylelint.utils.report({ result, ruleName, - message: messages.rejected(`${prop}: ${normalizedValue}`), + message: messages.rejected(`${property}: ${normalizedValue}`), node, }); continue; } // その他の禁止プロパティのチェック - if (isDisallowedProperty(prop)) { + if (isDisallowedProperty(property)) { stylelint.utils.report({ result, ruleName, - message: messages.rejected(prop), + message: messages.rejected(property), node, }); } diff --git a/packages/@d-zero/stylelint-rules/src/rules/component/index.spec.ts b/packages/@d-zero/stylelint-rules/src/rules/component/index.spec.ts index 7a41875b..e489e466 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/component/index.spec.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/component/index.spec.ts @@ -15,28 +15,26 @@ const config = (settings: Record | boolean = true) => ({ describe('Exact Match', () => { test('matched', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'test.css', code: '.test { color: currentColor; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('unmatched', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'test.css', code: '.text, *, div.test { color: currentColor; .test { color: inherit; } }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toStrictEqual([ @@ -57,70 +55,65 @@ describe('Exact Match', () => { describe('Component Naming Convention for CSS', () => { test('exact match in CSS', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button { color: currentColor; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('component element match in CSS', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button__text { color: currentColor; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('multiple component elements in CSS (auto-allow)', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button__text, .button__icon { color: currentColor; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('mixed component and component elements in CSS', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button, .button__text, .button__icon { color: currentColor; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('invalid component naming convention in CSS', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.card__text { color: currentColor; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toStrictEqual([ @@ -139,14 +132,13 @@ describe('Component Naming Convention for CSS', () => { }); test('CSS with wrong component name', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.card { color: currentColor; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toStrictEqual([ @@ -167,14 +159,13 @@ describe('Component Naming Convention for CSS', () => { describe('Partial Name', () => { test('match', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: '_c-component.scss', code: '.c-component { color: currentColor; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -183,72 +174,65 @@ describe('Partial Name', () => { describe('Options', () => { test('allowMultipleSelectors: false in SCSS', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: '_c-component.scss', code: '.c-component, .x-specific-class-name { color: currentColor; }', config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); }); test('allowMultipleSelectors: true in SCSS', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: '_c-component.scss', code: '.c-component, .x-specific-class-name { color: currentColor; }', config: config({ allowMultipleSelectors: true, }), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('CSS files automatically allow multiple selectors', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: '.button, .button__text, .button__icon { color: currentColor; }', config: config({ allowMultipleSelectors: false, // この設定は CSS では無視される }), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('CSS files allow multiple rules', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'button.css', code: `.button { color: currentColor; } .button__text { font-size: 14px; } .button__icon { width: 16px; }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('CSS files reject multiple components', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ codeFilename: 'c-component.css', code: `.c-component { --prop: value; } .c-component__element { --prop: value; } @@ -256,6 +240,8 @@ describe('Options', () => { .c-specific { --prop: value; }`, config: config({}), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(2); diff --git a/packages/@d-zero/stylelint-rules/src/rules/component/index.ts b/packages/@d-zero/stylelint-rules/src/rules/component/index.ts index 5326ece0..5a7e1233 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/component/index.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/component/index.ts @@ -15,10 +15,30 @@ type Options = { allowMultipleSelectors?: boolean; }; +/** + * セレクタノードがコンポーネントクラス(完全一致または __ で始まる子要素)かどうか判定 + * @param node + * @param basename + * @param isCssFile + */ +function isComponentClassNode( + node: Selector['nodes'][number], + basename: string, + isCssFile: boolean, +): boolean { + if (node.type !== 'class') { + return false; + } + + const className = node.value; + + return className === basename || (isCssFile && className.startsWith(`${basename}__`)); +} + export default createRule({ name: 'component', rule: (ruleName) => (primary) => { - const allowMultipleSelectors = primary.allowMultipleSelectors ?? false; + const isAllowMultipleSelectors = primary.allowMultipleSelectors ?? false; return (root, result) => { const fileName = root.source?.input.file; @@ -27,22 +47,22 @@ export default createRule({ return; } - const ext = path.extname(fileName); - const originalBasename = path.basename(fileName, ext); + const extension = path.extname(fileName); + const originalBasename = path.basename(fileName, extension); - const basename = ['.scss', '.sass'].includes(ext) + const basename = ['.scss', '.sass'].includes(extension) ? originalBasename.replace(/^_/, '') : originalBasename; // CSSファイルの場合は自動的にallowMultipleSelectorsをtrueにする - const isCssFile = ext === '.css'; - const effectiveAllowMultipleSelectors = isCssFile || allowMultipleSelectors; + const isCssFile = extension === '.css'; + const isEffectiveAllowMultipleSelectors = isCssFile || isAllowMultipleSelectors; const rules = root.nodes.filter((node): node is Rule => node.type === 'rule'); const [firstRule, ...overleftRules] = rules; // allowMultipleSelectorsに基づいて複数ルール制約をチェック - if (!effectiveAllowMultipleSelectors && overleftRules.length > 0) { + if (!isEffectiveAllowMultipleSelectors && overleftRules.length > 0) { for (const rule of overleftRules) { stylelint.utils.report({ result, @@ -75,22 +95,10 @@ export default createRule({ const [ruleFirstSelector, ...ruleMultipleSelectors] = ruleSelectors; if (!ruleFirstSelector) continue; - let hasValidComponentClass = false; - - for (const node of ruleFirstSelector.nodes) { - if (node.type === 'class') { - const className = node.value; - - // 完全一致またはコンポーネント命名規則(__で始まる)のチェック - if ( - className === basename || - (isCssFile && className.startsWith(`${basename}__`)) - ) { - hasValidComponentClass = true; - break; - } - } - } + // 完全一致またはコンポーネント命名規則(__で始まる)のチェック + const hasValidComponentClass = ruleFirstSelector.nodes.some((node) => + isComponentClassNode(node, basename, isCssFile), + ); if (!hasValidComponentClass) { stylelint.utils.report({ @@ -104,7 +112,7 @@ export default createRule({ } // 複数セレクタのチェック - if (!effectiveAllowMultipleSelectors && ruleMultipleSelectors.length > 0) { + if (!isEffectiveAllowMultipleSelectors && ruleMultipleSelectors.length > 0) { stylelint.utils.report({ result, ruleName, diff --git a/packages/@d-zero/stylelint-rules/src/rules/declaration-value-type-disallowed-list/index.spec.ts b/packages/@d-zero/stylelint-rules/src/rules/declaration-value-type-disallowed-list/index.spec.ts index d8810fc7..d219fc37 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/declaration-value-type-disallowed-list/index.spec.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/declaration-value-type-disallowed-list/index.spec.ts @@ -15,15 +15,14 @@ const config = (settings: Record | boolean = true) => ({ describe('Parse Error', () => { test('SCSS Syntax', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { background: url("a" + $b + "c") }', config: config({ length: ['px'], }), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -32,15 +31,14 @@ describe('Parse Error', () => { describe('length-pattern', () => { test('length in flex', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { flex: 1 1 10px }', config: config({ '/^length/': ['/[0-9]{2,}px/'], }), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toStrictEqual([ @@ -59,10 +57,7 @@ describe('length-pattern', () => { }); test('ignoreProperties options', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { flex: 1 1 10px }', config: config({ '/^length/': { @@ -71,6 +66,8 @@ describe('length-pattern', () => { }, }), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); diff --git a/packages/@d-zero/stylelint-rules/src/rules/declaration-value-type-disallowed-list/index.ts b/packages/@d-zero/stylelint-rules/src/rules/declaration-value-type-disallowed-list/index.ts index 4af57cb2..ff48fe47 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/declaration-value-type-disallowed-list/index.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/declaration-value-type-disallowed-list/index.ts @@ -42,8 +42,8 @@ export default createRule>({ return; } - root.walkDecls((decl) => { - const nodes = getValueType(decl); + root.walkDecls((declaration) => { + const nodes = getValueType(declaration); if (nodes === null) { return; @@ -66,7 +66,7 @@ export default createRule>({ if ( value.ignoreProperties && - matchesStringOrRegExp(decl.prop, value.ignoreProperties) + matchesStringOrRegExp(declaration.prop, value.ignoreProperties) ) { return []; } @@ -78,7 +78,7 @@ export default createRule>({ continue; } - const raw = decl.value.slice( + const raw = declaration.value.slice( node.value.sourceIndex, node.value.sourceIndex + node.value.sourceEndIndex, ); @@ -92,7 +92,7 @@ export default createRule>({ result, ruleName, message: messages.rejected(word, node.valueType), - node: decl, + node: declaration, word, }); } diff --git a/packages/@d-zero/stylelint-rules/src/rules/prefer-individual-transform-properties/index.ts b/packages/@d-zero/stylelint-rules/src/rules/prefer-individual-transform-properties/index.ts index 4003c87d..d72025b7 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/prefer-individual-transform-properties/index.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/prefer-individual-transform-properties/index.ts @@ -26,7 +26,7 @@ const REPLACEABLE_TRANSFORM_FUNCTIONS = { * Check if a transform value contains only functions that can be replaced * @param value */ -function canBeReplacedWithIndividualProperties(value: string): { +function analyzeReplaceableTransform(value: string): { canReplace: boolean; suggestions: string[]; } { @@ -51,20 +51,17 @@ function canBeReplacedWithIndividualProperties(value: string): { foundTransformTypes.add(property); // Generate suggestion based on function type - const args = postcssValueParser.stringify(node.nodes); - suggestions.push(`${property}: ${args}`); + const arguments_ = postcssValueParser.stringify(node.nodes); + suggestions.push(`${property}: ${arguments_}`); break; } } - if (!isReplaceable) { - hasNonReplaceableFunction = true; - } - - // Don't walk into the arguments of transform functions if (isReplaceable) { + // Don't walk into the arguments of transform functions return false; } + hasNonReplaceableFunction = true; } return true; }); @@ -90,14 +87,14 @@ export default createRule({ `Use individual transform properties instead of "transform: ${value}". Consider: ${suggestions}`, rule: (ruleName, messages) => () => { return (root, result) => { - root.walkDecls((decl) => { + root.walkDecls((declaration) => { // Only check transform property - if (decl.prop.toLowerCase() !== 'transform') { + if (declaration.prop.toLowerCase() !== 'transform') { return; } - const { canReplace, suggestions } = canBeReplacedWithIndividualProperties( - decl.value, + const { canReplace, suggestions } = analyzeReplaceableTransform( + declaration.value, ); // If we can replace and have suggestions, report the issue @@ -105,8 +102,8 @@ export default createRule({ stylelint.utils.report({ result, ruleName, - message: messages.rejected(decl.value, suggestions.join(', ')), - node: decl, + message: messages.rejected(declaration.value, suggestions.join(', ')), + node: declaration, }); } }); diff --git a/packages/@d-zero/stylelint-rules/src/rules/shorthand-property-use-logical/index.spec.ts b/packages/@d-zero/stylelint-rules/src/rules/shorthand-property-use-logical/index.spec.ts index 286aacf2..d8fa1f7c 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/shorthand-property-use-logical/index.spec.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/shorthand-property-use-logical/index.spec.ts @@ -16,26 +16,24 @@ const config = (settings: boolean | { properties?: string[] } = true) => ({ describe('shorthand-property-use-logical', () => { describe('padding', () => { test('single value - should not warn', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { padding: 2rem }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('two values - should warn', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { padding: 2rem 1rem }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toStrictEqual([ @@ -54,13 +52,12 @@ describe('shorthand-property-use-logical', () => { }); test('three values - should warn', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { padding: 2rem 0 0 }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -68,13 +65,12 @@ describe('shorthand-property-use-logical', () => { }); test('four values - should warn', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { padding: 1rem 2rem 3rem 4rem }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -84,26 +80,24 @@ describe('shorthand-property-use-logical', () => { describe('margin', () => { test('single value - should not warn', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { margin: auto }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('two values - should warn', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { margin: 1rem 2rem }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -113,26 +107,24 @@ describe('shorthand-property-use-logical', () => { describe('border-width', () => { test('single value - should not warn', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { border-width: 1px }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); }); test('multiple values - should warn', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { border-width: 1px 2px }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -142,13 +134,12 @@ describe('shorthand-property-use-logical', () => { describe('limited properties configuration', () => { test('only check specified properties', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { padding: 1rem 2rem; margin: 1rem 2rem; }', config: config({ properties: ['padding'] }), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); @@ -158,13 +149,12 @@ describe('shorthand-property-use-logical', () => { describe('unsupported properties', () => { test('should not check properties not in the list', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { background: url(a.png) no-repeat }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(0); @@ -173,26 +163,24 @@ describe('shorthand-property-use-logical', () => { describe('complex values', () => { test('calc() function with multiple values', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { padding: calc(1rem + 2px) 1rem }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); }); test('var() function with multiple values', async () => { - const { - // @ts-ignore - results: [{ warnings, parseErrors }], - } = await lint({ + const { results } = await lint({ code: '* { margin: var(--spacing) 2rem }', config: config(), }); + // @ts-ignore + const [{ warnings, parseErrors }] = results; expect(parseErrors).toHaveLength(0); expect(warnings).toHaveLength(1); diff --git a/packages/@d-zero/stylelint-rules/src/rules/shorthand-property-use-logical/index.ts b/packages/@d-zero/stylelint-rules/src/rules/shorthand-property-use-logical/index.ts index 8e3429f8..180ba0c3 100644 --- a/packages/@d-zero/stylelint-rules/src/rules/shorthand-property-use-logical/index.ts +++ b/packages/@d-zero/stylelint-rules/src/rules/shorthand-property-use-logical/index.ts @@ -65,10 +65,10 @@ export default createRule({ false, (value: unknown) => { if (!isPlainObject(value)) return false; - const obj = value as Record; + const object = value as Record; return ( - !('properties' in obj) || - (Array.isArray(obj.properties) && obj.properties.every(isString)) + !('properties' in object) || + (Array.isArray(object.properties) && object.properties.every(isString)) ); }, ], @@ -83,19 +83,19 @@ export default createRule({ ? primary.properties : [...SHORTHAND_PROPERTIES_WITH_LOGICAL]; - root.walkDecls((decl) => { + root.walkDecls((declaration) => { // Only check properties that are in our enabled list - if (!enabledProperties.includes(decl.prop)) { + if (!enabledProperties.includes(declaration.prop)) { return; } // Check if the property has multiple values - if (!hasMultipleValues(decl.value)) { + if (!hasMultipleValues(declaration.value)) { return; } // Get logical property suggestions - const logicalProperties = LOGICAL_PROPERTY_MAP[decl.prop]; + const logicalProperties = LOGICAL_PROPERTY_MAP[declaration.prop]; if (!logicalProperties) { return; } @@ -103,8 +103,8 @@ export default createRule({ stylelint.utils.report({ result, ruleName, - message: messages.rejected(decl.prop, logicalProperties.join(', ')), - node: decl, + message: messages.rejected(declaration.prop, logicalProperties.join(', ')), + node: declaration, }); }); }; diff --git a/packages/@d-zero/stylelint-rules/src/utils/get-value-type.spec.ts b/packages/@d-zero/stylelint-rules/src/utils/get-value-type.spec.ts index 4959f10b..cc6da1d5 100644 --- a/packages/@d-zero/stylelint-rules/src/utils/get-value-type.spec.ts +++ b/packages/@d-zero/stylelint-rules/src/utils/get-value-type.spec.ts @@ -12,8 +12,8 @@ import { getValueType } from './get-value-type.js'; function p(css: string) { const root = parse(css); const rule = root.first as Rule; - const decl = rule.first as Declaration; - const nodeWithType = getValueType(decl); + const declaration = rule.first as Declaration; + const nodeWithType = getValueType(declaration); return nodeWithType?.map((node) => node.valueType) ?? null; } diff --git a/packages/@d-zero/stylelint-rules/src/utils/get-value-type.ts b/packages/@d-zero/stylelint-rules/src/utils/get-value-type.ts index 260371eb..af7f7ff7 100644 --- a/packages/@d-zero/stylelint-rules/src/utils/get-value-type.ts +++ b/packages/@d-zero/stylelint-rules/src/utils/get-value-type.ts @@ -11,19 +11,19 @@ import postcssValueParser from 'postcss-value-parser'; /** * - * @param decl + * @param declaration */ -export function getValueType(decl: Declaration) { - if (decl.prop.startsWith('$')) { +export function getValueType(declaration: Declaration) { + if (declaration.prop.startsWith('$')) { return null; } try { - return _getValueType(decl.prop, decl.value); + return _getValueType(declaration.prop, declaration.value); } catch (error) { if ( error instanceof SyntaxError && 'source' in error && - error.source === decl.value + error.source === declaration.value ) { // Unsupported SCSS syntax by CSSTree return null; @@ -34,11 +34,11 @@ export function getValueType(decl: Declaration) { /** * - * @param prop + * @param property * @param value */ function _getValueType( - prop: string, + property: string, value: string, ): | { @@ -48,34 +48,40 @@ function _getValueType( | null { const valueAst = postcssValueParser(value); const valueAstFromCssTree = CSSTree.parse(value, { context: 'value' }); - let cssTreeDecl = CSSTree.lexer.matchProperty(prop, valueAstFromCssTree); + let cssTreeDeclaration = CSSTree.lexer.matchProperty(property, valueAstFromCssTree); - if (cssTreeDecl.error?.message === 'Matching for a tree with var() is not supported') { + if ( + cssTreeDeclaration.error?.message === + 'Matching for a tree with var() is not supported' + ) { value = value.replaceAll( /(var\([^)]+\))/g, (_, $1) => ' '.repeat($1.length - 1) + '1', ); - cssTreeDecl = CSSTree.lexer.matchProperty(prop, value); + cssTreeDeclaration = CSSTree.lexer.matchProperty(property, value); } - const values = valueAst.nodes.filter( - (node) => node.type === 'string' || node.type === 'function' || node.type === 'word', - ); + const replaceableNodeTypes: ReadonlySet = new Set([ + 'string', + 'function', + 'word', + ]); + const values = valueAst.nodes.filter((node) => replaceableNodeTypes.has(node.type)); // @ts-ignore - const props = cssTreeDecl.matched; - if (props === null) { + const properties = cssTreeDeclaration.matched; + if (properties === null) { return null; } - const valueTypes = props.match + const valueTypes = properties.match // @ts-ignore .flatMap((node) => getValueNode(node)) // @ts-ignore .map((node) => node.syntax.name); - return values.map((value, i) => { - const valueType = valueTypes[i] ?? null; + return values.map((value, index) => { + const valueType = valueTypes[index] ?? null; if (valueType === null && value.type === 'word' && value.value.startsWith('$')) { return { From 93468d2ccd57124c9f1838f2a8abfee9157d4323 Mon Sep 17 00:00:00 2001 From: Yusuke Hirao Date: Tue, 1 Sep 2026 13:02:53 +0900 Subject: [PATCH 15/15] fix(stylelint): use multiline block comment per unicorn/single-line-block-comment-style --- packages/@d-zero/stylelint-config/values.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/@d-zero/stylelint-config/values.js b/packages/@d-zero/stylelint-config/values.js index f1a68d99..47882f38 100644 --- a/packages/@d-zero/stylelint-config/values.js +++ b/packages/@d-zero/stylelint-config/values.js @@ -11,7 +11,9 @@ module.exports = { 'declaration-property-value-disallowed-list': [ { display: [ - /* @see https://drafts.csswg.org/css-display/#display-value-summary */ + /* + @see https://drafts.csswg.org/css-display/#display-value-summary + */ 'block', 'flow-root', 'inline',