Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate invalid rule name in .textlintrc #1063

Open
1 of 2 tasks
azu opened this issue Feb 5, 2023 · 1 comment
Open
1 of 2 tasks

Validate invalid rule name in .textlintrc #1063

azu opened this issue Feb 5, 2023 · 1 comment
Labels
Status: Proposal Request for comments

Comments

@azu
Copy link
Member

azu commented Feb 5, 2023

@textlint/config-loader is the only one that treat tetlintrc.

We can improve validation on loading textlintrc.

✅ Detect invalid rule name

  • Already Done

It is just loading error.
textlint try to load invalid-rule module, but it doest not exists.

{
  "rules": {
    "invalid-rule": true
  }
}

Detect invalid child rule name of preset

  • PR: ...

This case preset-abc does not have invalid-rule.
Currently, It will be just ignored, but we can validate it.

{
  "rules": {
    "preset-abc": {
      "a": true,
      "b": false,
      "invalid-rule": { "key": true }
    }
  }
}

📝 We can not validate rule option values
It needs to get option schema #700

Dynamic JSON Schema

Create JSON Schema dynamically.

  • Example:
    • Angular: "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
{
  "$schema": "./node_modules/textlint/schema.json",
  "rules": {
    "preset-abc": {
      "a": true,
      "b": false,
      "invalid-rule": { "key": true }
    }
  }
}

However, It is not useful at current. Blocker: #700

We can start static JSON Schema.

{
  "$schema": "https://textlint.github.io/schema.json",
  "rules": {
    "preset-abc": {
      "a": true,
      "b": false,
      "invalid-rule": { "key": true }
    }
  }
}

More idea...

@azu azu changed the title Validate invliad rule name in .textlintrc Validate invalid rule name in .textlintrc Feb 5, 2023
@azu azu added the Status: Proposal Request for comments label Feb 5, 2023
@azu
Copy link
Member Author

azu commented Feb 24, 2023

📝 Example Case: https://twitter.com/azu_re/status/1628934056883912704

https://github.com/textlint/textlint/releases/tag/v13.0.0

Remove undocumented way to override preset rule option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Proposal Request for comments
Projects
None yet
Development

No branches or pull requests

1 participant