スキル一覧に戻る
AVRA-CADAVRA

linter-error-prevention

by AVRA-CADAVRA

0🍴 0📅 2026年1月24日
GitHubで見るManusで実行

SKILL.md


name: linter-error-prevention description: Enforces zero linter errors, common issue prevention, code cleanup. Use when writing code, reviewing code, or ensuring code quality standards.

Linter Error Prevention

Mandatory Rule

✅ Zero linter errors before completion ✅ Zero warnings before completion ✅ Follow Dart style guide

Common Linter Issues

Unused Imports

// ❌ BAD: Unused import
import 'package:unused/package.dart';

class MyClass {
  // Doesn't use unused package
}

// ✅ GOOD: Remove unused imports
class MyClass {
  // No unused imports
}

Unused Variables

// ❌ BAD: Unused variable
void method() {
  final unused = calculateValue();
  doSomething();
}

// ✅ GOOD: Use variable or remove
void method() {
  final value = calculateValue();
  doSomething(value);
}

Missing Required Parameters

// ❌ BAD: Missing required parameter
createUser(name: 'John');

// ✅ GOOD: Provide required parameters
createUser(name: 'John', email: 'john@example.com');

Const Constructor Warnings

// ❌ BAD: Const constructor error
const MyWidget(
  required this.value, // Required parameters can't be const
)

// ✅ GOOD: Remove const if constructor isn't const
MyWidget(
  required this.value,
)

Linter Rules

Enable Linter Rules

Check analysis_options.yaml for enabled linter rules:

linter:
  rules:
    - prefer_const_constructors
    - prefer_const_literals_to_create_immutables
    - avoid_print
    - prefer_single_quotes

Common Rules

prefer_const_constructors:

// ✅ GOOD: Use const when possible
const Text('Hello')

// ❌ BAD: Not using const
Text('Hello')

avoid_print:

// ✅ GOOD: Use developer.log
developer.log('Message', name: 'ServiceName');

// ❌ BAD: Using print
print('Message');

prefer_single_quotes:

// ✅ GOOD: Single quotes
final text = 'Hello';

// ❌ BAD: Double quotes
final text = "Hello";

Running Linter

Command Line

flutter analyze
dart analyze

IDE Integration

Most IDEs run linter automatically and show warnings.

Fix Common Issues

Automatic Fixes

Many linter issues can be auto-fixed:

dart fix --apply
flutter pub run dart_code_metrics:metrics analyze lib/

Manual Fixes

For issues that can't be auto-fixed:

  1. Read linter warning message
  2. Understand the issue
  3. Fix according to Dart style guide
  4. Re-run linter to verify

Pre-Commit Checklist

Before committing:

  • Run flutter analyze - no errors
  • Run flutter analyze - no warnings
  • No unused imports
  • No unused variables
  • No const constructor errors
  • Follow Dart style guide
  • All linter rules satisfied

Code Quality Standards

Zero Tolerance

  • Zero linter errors
  • Zero deprecated API warnings
  • Zero unused code (unless documented exception)

Continuous Improvement

  • Fix linter issues immediately
  • Don't accumulate technical debt
  • Keep codebase clean

Reference

  • analysis_options.yaml - Linter configuration
  • Dart Style Guide
  • Effective Dart Guide

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です