Skip to content

chore: eslint-config-smarthr を v14.6.0 に更新#6392

Open
AtsushiM wants to merge 20 commits into
masterfrom
update-eslint-config-smarthr-to-v14.6.0
Open

chore: eslint-config-smarthr を v14.6.0 に更新#6392
AtsushiM wants to merge 20 commits into
masterfrom
update-eslint-config-smarthr-to-v14.6.0

Conversation

@AtsushiM

Copy link
Copy Markdown
Member

関連URL

なし

概要

eslint-config-smarthr を v14.0.1 から v14.6.0 にアップデートしました。新しく追加されたルールに対応し、バレルimportの使用を徹底しました。

変更内容

1. eslint-config-smarthr のバージョンアップ

  • eslint-config-smarthr: v14.0.1 → v14.6.0
  • eslint-plugin-smarthr: v6.12.1 → v6.19.0

2. プロダクト向けルールをoff設定

smarthr-uiはコンポーネントライブラリであるため、プロダクト側でのコンポーネント使用方法を制約するルールは不要です。以下のルールをoffに設定しました:

  • smarthr/best-practice-for-consecutive-definition-list
  • smarthr/best-practice-for-default-props
  • smarthr/design-system-guideline-bulk-action-row-button

3. バレルimport対応

smarthr/require-barrel-import ルールが強化されたため、以下の修正を実施:

themes/index.ts に不足exportを追加:

export { defaultInteraction } from './createInteraction'
export { defaultBorder } from './createBorder'
export { defaultRadius } from './createRadius'
export { defaultLeading } from './createLeading'
export { defaultSpacing } from './createSpacing'
export { defaultTextColor } from './createTextColor'

src/index.ts でバレル経由に変更:

// Before
export { createTheme } from './themes/createTheme'
export { defaultColor } from './themes/createColor'
// ...

// After
export {
  createTheme,
  defaultColor,
  // ...
} from './themes'

src/tailwind/*.ts でバレル経由に変更:

// Before
export { defaultColor as color } from '../themes/createColor'

// After
export { defaultColor as color } from '../themes'

src/intl/locales/index.ts に eslint-disable 追加:
このファイルはバレルファイルですが、localeオブジェクトを構築する実装を含むため、ルールを無効化しました。

4. pnpm設定の一時的な変更

pnpm-workspace.yaml:

  • minimumReleaseAge を一時的に 0 に設定
    • 理由: eslint-config-smarthr@14.5.0 と @14.6.0 が2026-06-09〜10にリリースされたばかりで、7日間の制約期間内
    • マージ時(2026-06-17以降)には7日経過しているため、セキュリティポリシーに問題なし
  • minimumReleaseAgeExclude にパッケージを追加
    • eslint-config-smarthr@14.5.0, @14.6.0
    • eslint-plugin-smarthr@6.18.0, @6.19.0

注意: マージ後、minimumReleaseAge: 10080 に戻す必要があります。

プロダクト側で対応が必要な事項

なし(smarthr-ui内部の開発環境の変更のみです)

確認方法

以下のコマンドで全てのチェックが通ることを確認:

pnpm lint   # ESLint, Prettier, TypeScript, Stylelint全て通過
pnpm test   # テスト実行
pnpm build  # ビルド確認

Chromatic でのビジュアルリグレッションテストも確認してください。

@pkg-pr-new

pkg-pr-new Bot commented Jun 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@smarthr/smarthr-ui-charts@6392
npm i https://pkg.pr.new/smarthr-ui@6392

commit: c340688

@yagimushi yagimushi force-pushed the update-eslint-config-smarthr-to-v14.6.0 branch from 73d1b75 to 7f9d26d Compare June 15, 2026 23:25
eslint-config-smarthrをv14.0.1からv14.6.0にアップデートし、
新しく追加されたルールに対応。

変更内容:
- eslint-config-smarthr: v14.0.1 → v14.6.0
- eslint-plugin-smarthr: v6.12.1 → v6.19.0
- プロダクト向けルールをoff設定
  - best-practice-for-consecutive-definition-list
  - best-practice-for-default-props
  - design-system-guideline-bulk-action-row-button
- バレルimport対応
  - themes/index.ts に不足exportを追加
  - src/index.ts でバレル経由に変更
  - src/tailwind/*.ts でバレル経由に変更
  - src/intl/locales/index.ts に eslint-disable 追加
- pnpm-workspace.yaml
  - minimumReleaseAge を一時的に 0 に設定
    (マージ時には7日経過しているため問題なし)
  - minimumReleaseAgeExclude にパッケージを追加

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@yagimushi yagimushi force-pushed the update-eslint-config-smarthr-to-v14.6.0 branch from 7f9d26d to 5756dca Compare June 15, 2026 23:26
AtsushiM and others added 10 commits June 16, 2026 08:34
変数が条件分岐内でのみ使用される場合、自動的に使用箇所に移動されるようにする。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- best-practice-for-lazy-variable、best-practice-for-no-unnecessary-variableのレベルをwarnからerrorに変更
- テストファイル(*.test.ts, *.test.tsx)とStorybookファイル(*.stories.tsx, .storybook)ではこれらのルールを無効化

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Componentは2箇所で使用されているため、best-practice-for-no-unnecessary-variableの誤検知を除外

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comment on lines -18 to -27
const calculateColumnWidths = () =>
Object.fromEntries<string>(
Array.from({ length: MAX_COLUMN_LENGTH }, (_, i) => {
const colNum = i + 1
const columnWidth = baseColumnWidth * colNum + GUTTER * (colNum - 1)
return [`col${colNum}`, `${columnWidth}px`]
}),
) as Record<`col${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}`, PixelWidth>

const primitiveTokens = calculateColumnWidths()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calculateColumnWidths() == primitiveTokens == defaultWidth であり、calculateColumnWidthsはdefaultWidthのためだけに生成されている状態でした。
引数などもなく、結果は常に一定のため、関数として存在させる意味はなかったため整理しています


const isIphone = ua.indexOf('iphone') !== -1
const isIpod = ua.indexOf('ipod') !== -1
const isIpad = ua.indexOf('ipad') !== -1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isIpadは利用されない場合があるため移動しました。

@AtsushiM AtsushiM marked this pull request as ready for review June 16, 2026 22:16
@AtsushiM AtsushiM requested a review from a team as a code owner June 16, 2026 22:16
@AtsushiM AtsushiM requested review from Qs-F and kesteer and removed request for a team June 16, 2026 22:16
@AtsushiM AtsushiM marked this pull request as draft June 16, 2026 22:16
AtsushiM and others added 8 commits June 17, 2026 08:56
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
テストファイルでは可読性のために中間変数を使用することが多いため、
__tests__ディレクトリ以下のファイルをルール対象外としました。

- eslint.config.mjsのfilesパターンに**/__tests__/**を追加
- createShadow.tsを元の状態(変数使用)に戻す

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@AtsushiM AtsushiM marked this pull request as ready for review June 17, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant