Skip to content

[@typescript-eslint/naming-convention] @typescript-eslint/naming-convention should disable camelcase #2062

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
Mister-Hope opened this issue May 22, 2020 · 1 comment · Fixed by #2070
Labels
documentation Documentation ("docs") that needs adding/updating package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@Mister-Hope
Copy link
Contributor

Mister-Hope commented May 22, 2020

The @typescript-eslint/camelcase is changed to @typescript-eslint/naming-convention in V3, that's cool, but @typescript-eslint/camelcase disable camelcase for ts files in V2, so should the new @typescript-eslint/naming-convention in V3.

Now, file like this will throw camelcase error:

/* eslint-disable @typescript-eslint/naming-convention */

  md.renderer.rules.footnote_ref = renderFootnoteRef;
  md.renderer.rules.footnote_block_open = renderFootnoteBlockOpen;
  md.renderer.rules.footnote_block_close = renderFootnoteBlockClose;
  md.renderer.rules.footnote_open = renderFootnoteOpen;
  md.renderer.rules.footnote_close = renderFootnoteClose;
  md.renderer.rules.footnote_anchor = renderFootnoteAnchor;

  // helpers (only used in other rules, no tokens are attached to those)
  md.renderer.rules.footnote_caption = renderFootnoteCaption;
  md.renderer.rules.footnote_anchor_name = renderFootnoteAnchorName;
Z:\npm\vuepress-theme-hope\packages\md-enhance\src\markdown-it\footnote.ts
  110:21  error  Identifier 'footnote_ref' is not in camel case          camelcase
  111:21  error  Identifier 'footnote_block_open' is not in camel case   camelcase
  112:21  error  Identifier 'footnote_block_close' is not in camel case  camelcase
  113:21  error  Identifier 'footnote_open' is not in camel case         camelcase
  114:21  error  Identifier 'footnote_close' is not in camel case        camelcase
  115:21  error  Identifier 'footnote_anchor' is not in camel case       camelcase
  118:21  error  Identifier 'footnote_caption' is not in camel case      camelcase
  119:21  error  Identifier 'footnote_anchor_name' is not in camel case  camelcase
@Mister-Hope Mister-Hope added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels May 22, 2020
@Mister-Hope Mister-Hope changed the title [@typescript-eslint/camelcase] Uable to disable this rule in certain file. [@typescript-eslint/naming-convention] @typescript-eslint/naming-convention should disable camelcase May 22, 2020
@bradzacher
Copy link
Member

In v2, we had our camelcase rule recommended, so that's why it disabled the base camelcase rule.

In v3 we've removed all naming rules from our recommended set due to the number of users that disagreed with the stylistic choice being in recommended.
Because it's not recommended, we can't automatically disable the rule.

Unfortunately eslint provides no mechanism for one rule to influence the config of another rule.
Every rule is run in isolation, and configuration is locked in ahead of time.

I've updated the rule's docs to suggest disabling camelcase.

@bradzacher bradzacher added documentation Documentation ("docs") that needs adding/updating and removed triage Waiting for team members to take a look labels May 22, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Documentation ("docs") that needs adding/updating package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants