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

Private identifiers not recognized #98

Open
tbartley opened this issue Sep 13, 2022 · 1 comment
Open

Private identifiers not recognized #98

tbartley opened this issue Sep 13, 2022 · 1 comment

Comments

@tbartley
Copy link

Hi,

If I have some TypeScript like:

export class Secret {
  #secret: string

  constructor() {
    this.#secret = 'secret'
  }

  getSecret(): string {
    return this.#secret
  }
}

I get an error:

Unknown node type PrivateIdentifier.
If you are using the latest version of this plugin, please consider filing an issue noting this message, the offending statement, your ESLint version, and any active ESLint presets and plugins eslint(tree-shaking/no-side-effects-in-initialization)

at the line #secret: string.

eslint: 8.22.0
eslint-plugin-tree-shaking: 1.10.0
eslint-config-prettier: 8.5.0
eslint-plugin-import: 2.26.0
eslint-plugin-prettier: 4.2.1,
typescript: 4.7.4
@typescript-eslint/eslint-plugin: 5.34.0
@typescript-eslint/parser: 5.34.0

Is this likely an issue with the plugin or my tsconfig or ....?

Thanks,

Tim

@tbartley
Copy link
Author

Fix might just be to duplicate the processing for "Identifier" as "PrivateIdentifier" - I have a local build where this resolves the issue for me but I'm not confident that the solution is correct - nor am I certain how best to write unit tests for it or I'd submit a PR.

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

No branches or pull requests

1 participant