Skip to content

[explicit-module-boundary-types] add pattern option for args #2686

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

Closed
3 tasks done
bennypowers opened this issue Oct 18, 2020 · 1 comment
Closed
3 tasks done

[explicit-module-boundary-types] add pattern option for args #2686

bennypowers opened this issue Oct 18, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@bennypowers
Copy link

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

explicit-module-boundary-types should provide an option to exclude method and function args by pattern, e.g.

{
  "allowPattern": "/^_/"
}

Repro

{
  "extends": [
      "plugin:@typescript-eslint/eslint-recommended",
      "plugin:@typescript-eslint/recommended",
  ]
}
import { FieldFunctionOptions, TypePolicy } from '@apollo/client/core';

export const Query: TypePolicy = {
  fields: {
    location(_, { args }: FieldFunctionOptions): Location {
      // function body is irrelevant
      return args as unknown as Location;
    },
  },
};
{
  "include": ["src", "lib"],
  "exclude": ["node_modules", "**/node_modules/**/node_modules"],
  "compilerOptions": {
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "resolveJsonModule": true,
    "moduleResolution": "Node",
    "target": "ES2019",
    "module": "ESNext",
    "noEmitOnError": false,
    "baseUrl": ".",
    "sourceMap": true,
    "plugins": [
      { "transform": "@zerollup/ts-transform-paths" },
      { "name": "ts-lit-plugin" }
    ],
  },
  "lib": [
    "ESNext.array",
    "ES2020",
    "ES2019.array",
    "ES2020.Intl.d.ts",
    "DOM",
    "DOM.iterable"
  ]
}

Expected Result

I expect unused params (_) should not trigger lint warnings

Actual Result

95:14 warning Argument '_' should be typed @typescript-eslint/explicit-module-boundary-types

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin ^4.4.0
@typescript-eslint/parser ^4.4.0
TypeScript ^4.0.3
ESLint ^7.11.0
node 12.17.0
@bennypowers bennypowers added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Oct 18, 2020
@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for team members to take a look labels Oct 18, 2020
@bradzacher
Copy link
Member

This would be fixed by #2183

The problem here is you're having to unnecessarily annotate parameters.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants