lint-check
bởi microsoft
Chạy lint trên các gói bị ảnh hưởng, phân tích lỗi và tự động sửa các vấn đề phổ biến (design tokens, React.FC, an toàn SSR, hạn chế import)
npx skills add https://github.com/microsoft/fluentui --skill lint-checkLint Check and Auto-Fix
Run linting and fix common issues for Fluent UI packages.
Steps
-
Determine scope. If
$ARGUMENTSis provided, lint that specific package. Otherwise, lint affected packages:# Specific package yarn nx run @fluentui/$ARGUMENTS:lint # Or affected packages yarn nx affected -t lint -
Parse the output and categorize errors by the custom Fluent UI ESLint rules:
Rule What it catches How to fix @fluentui/ban-context-exportContext exported from wrong layer Move to react-shared-contextspackage@fluentui/ban-instanceof-html-elementinstanceof HTMLElement(breaks iframes)Use element.tagName or feature detection @fluentui/no-global-reactReact.FC,React.useStateetc.Use named imports: import { useState } from 'react'@fluentui/no-restricted-importsBanned import paths Use the allowed import path from the error message @fluentui/no-context-default-valueContext created without undefineddefaultUse createContext(undefined)and add a guard hook -
Auto-fix any issues found by editing the source files directly. For each fix:
- Read the file
- Apply the fix
- Verify the fix by re-running lint on that specific file
-
Report a summary of what was found and fixed.
References
- ESLint plugin source:
packages/eslint-plugin/src/rules/ - Design tokens guide: docs/architecture/design-tokens.md
- Component patterns: docs/architecture/component-patterns.md