Code Monkey home page Code Monkey logo

flutter-yumemi-lints's Introduction

melos

Overview

Provides a set of lint rules recommended by YUMEMI Inc. for Dart and Flutter projects. These rules help enhance code quality and maintainability by ensuring adherence to best practices and style conventions. Follow the steps below to integrate and customize these lint rules into your project.

Usage

1. Installation

In a terminal, located at the root of your package, run this command:

dart pub add dev:yumemi_lints

2. Setting

In a terminal, located at the root of your package, run this command:

dart run yumemi_lints update

The above command will automatically update the lint rules to the recommended.yaml recommended by Yumemi Inc. according to the version of Flutter or Dart SDK used in the project.

This can be used when introducing yumemi_lints or when updating the Flutter or Dart sdk version to avoid the hassle of manually updating lints.

3. Configuration

Basic

For basic lint rule configuration, include lint rules recommended by YUMEMI Inc. in your analysis_options.yaml file as shown below:

include: package:yumemi_lints/dart/2.17/recommended.yaml

Please note that you need to adjust the file path accordingly based on the Dart or Flutter version your project is using.

Customization

If you want to customize lint rules, include all lint rules in your analysis_options.yaml file as shown below:

include: package:yumemi_lints/dart/2.17/all.yaml

analyzer:
  errors:
    # By including all.yaml, some rules will conflict.
    # These warnings will be addressed within this file.
    included_file_warning: ignore

linter:
  rules:
    # Conflicts with enabling `avoid_types_on_closure_parameters`, `omit_local_variable_types`.
    always_specify_types: false

    # Conflicts with enabling `strict-raw-types`.
    avoid_annotating_with_dynamic: false

    # Conflicts with enabling `prefer_single_quotes`.
    prefer_double_quotes: false

    # Conflicts with enabling `avoid_final_parameters`.
    prefer_final_parameters: false

    # Conflicts with enabling `always_use_package_imports`.
    prefer_relative_imports: false

    # Conflicts with enabling `prefer_final_locals`.
    unnecessary_final: false

In the above example, we have customized various lint rules by adjusting their settings in the analysis_options.yaml file. You can modify these settings according to your project's specific needs and coding style preferences.

How to contribute

See Contributor Guide for contributing conventions.

Contributors

blendthink/
blendthink
Kanta
Kanta Mori
Yamasaki-pan961/
Yamasaki-pan961
trm11tkr/
trm11tkr
K9i
K9i - Kota Hayashi
Ryotaro
Ryotaro Onoue

flutter-yumemi-lints's People

Contributors

blendthink avatar dependabot[bot] avatar github-actions[bot] avatar k9i-0 avatar morikann avatar trm11tkr avatar web-flow avatar yamasaki-pan961 avatar yumnumm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter-yumemi-lints's Issues

[Improve]: Deprecated keys in GitHub Actions workflow

Describe

The following warning was issued in the GitHub Actions workflow:

https://github.com/yumemi-inc/flutter-yumemi-lints/actions/runs/7749596165/job/21134434497

Warning: Input 'app_id' has been deprecated with message: 'app_id' is deprecated and will be removed in a future version. Use 'app-id' instead.
Warning: Input 'private_key' has been deprecated with message: 'private_key' is deprecated and will be removed in a future version. Use 'private-key' instead.

Screenshots

N/A

Environment

Additional context

No response

[Improve]: Define and Implement Recommended Warning Levels for Lint Rules

Describe

To enhance code quality and maintainability, I propose defining a set of recommended warning levels for Lint rules as per Yumemi's best practices. This initiative aims to standardize the warning levels across our projects, ensuring that all developers adhere to the same quality checks and coding standards. Implementing these levels will help in identifying potential code issues more effectively.

Screenshots

N/A

Environment

Additional context

This improvement will not only streamline our code review processes but also decrease the learning curve for new team members by providing them with a clear set of coding guidelines. Additional discussions and inputs from the team to refine these warning levels would be appreciated.

https://www.notion.so/yumemi/Lint-6888ae0f29184da7b8691e6930107285

[Feature Request]: Update `analysis_options.yaml` using a command

Is your feature request related to a problem? Please describe

When updating the Dart/Flutter SDK version for the project, it would be more appropriate to also update the lint rules used, but currently, they have to be updated manually, which is somewhat costly.

Describe the solution you'd like

#...

environment:
  sdk: ^3.1.0
include: package:yumemi_lints/dart/2.17.0/recommended.yaml

dart run yumemi_lints update

include: package:yumemi_lints/dart/3.1.0/recommended.yaml

Describe alternatives you've considered

No response

Additional context

No response

[Bug]: Running dart run yumemi_lints update may sometimes update to a non-existent version of the yumemi_lints lint

Describe the bug

As the title suggests.

To Reproduce

  1. Introducing yumemi_lints
    • yumemi_lints: v2.0.0
    • project flutter version: v3.22.0
  2. Run dart run yumemi_lints update
    • lint version is 3.22 but does not exist

Expected behavior

  1. If the corresponding lint version does not exist, tell the user in a console message.
  2. Let the user choose whether to apply the previous supported version.
    • If yes, update the lint version.
    • If not, do nothing.

Environment

  • yumemi lints version: v2.0.0
  • Flutter Version: v3.22.0

Additional context

No response

[Feature Request]: Create a workflow to push a tag when a pull request updating the package version is merged

Is your feature request related to a problem? Please describe

After a pull request updating the package version is merged, the tag must be pushed manually.

Describe the solution you'd like

Since it's cumbersome to push tags manually, set up a GitHub Actions workflow to run automatically when a pull request that updates the package version is merged.

Describe alternatives you've considered

No response

Additional context

No response

Automatically update lint rules

Run a GitHub Actions workflow everyday.
Watch for updates to Flutter/Dart lint rules and create pull requests when updates are made.

※ Call and update the CLI tool created in issue #6 .

Tasks

  • Create a empty workflow for updating lint rules
  • Implement a workflow for updating lint rules

Create a project to generate all lint rules for each version

Create lint rules for each Flutter/Dart version

  • dart
    • 2.17.0
      • all.yaml
    • 2.17.1
  • flutter
    • 3.0.0
      • all.yaml
    • 3.0.1

NOTE:

  • Dart version 2.17.0 or higher is required.
  • Flutter version 3.0.0 or higher is required.
  • YUMEMI Inc. recommended lint rules will be addressed in another Issue.

Tasks

  • Create a base cli project update_lint_rules
  • Implement a process to get all lint rules
  • Implement a process to extract lint rules for Flutter and Dart
  • Implement a process to get stable release info of Dart SDK
  • Implement a process to get stable release info of Flutter SDK
  • Implement a process to output Dart or Flutter all lint rules to a file
  • Address a 'duplicate_ignore' warning
  • Modify the method of determining whether it is a Lint rule for Flutter
  • Update README of the update_lint_rules package

[Improve]: A mechanism to flexibly absorb flaws in the automated generation source

Describe

This issue focuses on the need for a robust mechanism within our system that can flexibly handle and absorb flaws originating from our automated generation source. Currently, our automated processes rely on this source for critical data, but it is prone to occasional inaccuracies and inconsistencies. These flaws can lead to errors in our final output, affecting the overall quality and reliability of our products or services. The proposed mechanism should be capable of identifying these flaws early in the process, possibly through advanced monitoring and error-detection algorithms. Once detected, the system should have the ability to either correct these errors or adapt its output to mitigate the impact of these flaws. The goal is to create a more resilient and reliable automated process, which maintains high-quality output even in the presence of source data imperfections.

Screenshots

No response

Environment

  • Package Version: 1.1.0
  • Commit SHA: fe97203

Additional context

dart-lang/sdk#53852

[Improve]: Automate Approval of PRs with Identical Lint Rules in Successive Versions

Describe

I'm looking to create a GitHub Workflow that automatically approves pull requests (PRs) when they contain LintRules identical to the previous version. Specifically, when a PR auto-generates files like dart/3.1.0/all.yaml and dart/3.2.0/all.yaml, it should be automatically approved if its contents match those of the immediately preceding version, in this case, dart/3.0.7/all.yaml. This would significantly streamline our update process, ensuring that identical lint rules across versions do not require manual approval. The details of which user will handle the approvals will be determined separately.

Screenshots

N/A

Environment

Additional context

No response

[Bug]: Incorrect inclusion of Flutter-specific lint rules in Dart lint configuration

Describe the bug

There seems to be an issue where Flutter-specific lint rules are mistakenly included in the Dart lint configuration. This could potentially mislead or cause errors for Dart-only projects. The specific rules identified so far include use_colored_box and use_decorated_box. There might be additional Flutter-specific rules that need to be evaluated and possibly removed or correctly categorized.

Screenshots

N/A

To Reproduce

  1. Open the Dart project lint configuration file.
  2. Observe the inclusion of use_colored_box and use_decorated_box.
  3. These rules should not be applicable to pure Dart projects as they are specific to Flutter.

Expected behavior

The Dart lint configuration should not include Flutter-specific lint rules unless explicitly intended for a Flutter project. Correcting this will avoid confusion and potential misuse in Dart-only environments.

Environment

Additional context

No response

[Improve]: Remove the patch version from the directory name of Lint Rules

Describe

lib
├── dart
│   ├── 2.17.0
│   ├── 2.17.1
│   ├── 2.17.3
│   ├── 2.17.5
│   ├── ...
│   ├── 2.18.0
│   ├── 2.18.1
│   ├── 2.18.2
│   ├── 2.18.3
│   ├── ...
└── flutter
    ├── 3.0.0
    ├── 3.0.1
    ├── 3.0.2
    ├── 3.0.3
    ├── ...
    ├── 3.3.0
    ├── 3.3.1
    ├── 3.3.2
    ├── 3.3.3
    ├── ...

lib
├── dart
│   ├── 2.17
│   ├── 2.18
│   ├── ...
└── flutter
    ├── 3.0
    ├── 3.3
    ├── ...

Modifications to the check_lint_rules_identity are also necessary.

Screenshots

N/A

Environment

Additional context

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.