Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Docs: instructions on how to integrate custom rules into your project #7066

Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issuedocumentationDocumentation ("docs") that needs adding/updatinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
@flut1

Description

@flut1

Before You File a Documentation Request Please Confirm You Have Done The Following...

Suggested Changes

typescript-eslint has somegreat documentation andutils to write a custom linting rule 👍 The first line reads "custom ESLint rules generally work the same way for JavaScript and TypeScript code", so theplugin docs from eslint are a good starting point. However, it still left me with some questions around how to utilize such a rule in a project.

Writing custom rules on top of typescript-eslint might not be incredibly common, so I don't expect there to be a extremely detailed step-by-step guide. But I think some pointers around the questions listed below would be a great addition to the documentation:

  1. Can therule from thecode snippet in the documentation be directly consumed in your eslint config, or does it need to be wrapped in a plugin?
    • my guess is this is generally the same as eslint, but is anything like "Runtime Rules" also possible?
  2. Do rules need to be compiled to JS before being usable?
    • my assumption is yes, but this was optional intslint if you utilizedts-node. So it would be nice to mention this explicitly.
  3. What tsconfig is recommended when compiling a rule?
    • I tried copying configuration from the@typescript-eslint/eslint-plugin package (given that one contains the rules). Not all of it seems to be relevant for creating rules though
  4. If you want to publish a package with a rule:
    • are there package naming recommendations on top of thenaming instructions from eslint itself?
    • shouldtypescript and@typescript-eslint/*** packages be part of your (peer/dev-)dependencies?

This list is not intended as a literal proposal of questions that should all be addressed in the docs. Rather they're meant as examples of a topic that I think could use some clarification. Even referencing an example repo with a good setup would already help. Alternatively, there's interest in having a generator similar toeslint/generator-eslint. There'san open issue to create a TypeScript template, but at this moment it seems unclear if they want to move forward with that.

Affected URL(s)

https://typescript-eslint.io/custom-rules

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuedocumentationDocumentation ("docs") that needs adding/updatinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp