Skip to content

fix: add missing types for no-implicit-coercion options#18903

Merged
snitin315 merged 1 commit intoeslint:mainfrom
kripod:patch-4
Sep 16, 2024
Merged

fix: add missing types for no-implicit-coercion options#18903
snitin315 merged 1 commit intoeslint:mainfrom
kripod:patch-4

Conversation

@kripod
Copy link
Copy Markdown
Contributor

@kripod kripod commented Sep 14, 2024

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

Tell us about your environment (npx eslint --env-info):

  • Node version: v22.8.0
  • npm version: v10.8.2
  • Local ESLint version: v9.10.0 (Currently used)
  • Global ESLint version: Not found
  • Operating System: darwin 23.6.0

What parser are you using (place an "X" next to just one item)?

N/A

Please show your full configuration:

N/A

What did you do? Please include the actual source code causing the issue.

Tried to create a custom config using TypeScript as follows:

import type { Linter } from "eslint";
import type { ESLintRules } from "eslint/rules";

export default {
  rules: {
    "no-implicit-coercion": [
      "warn",
      {
        allow: [
          "!!",
          "- -", // does not exist in type
          "-", // does not exist in type
        ],
      },
    ],
  },
} satisfies Linter.Config<ESLintRules>;

What did you expect to happen?

Options existing at runtime should be available on the type level.

What actually happened? Please include the actual, raw output from ESLint.

TypeScript flagged a type-level issue as highlighted in the comments above.

What changes did you make? (Give an overview)

Fixed the types to include missing ALLOWABLE_OPERATORS in the allow option for the no-implicit-coercion rule.

Is there anything you'd like reviewers to focus on?

N/A

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug ESLint is working incorrectly contributor pool

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

4 participants