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

Location of `version` property is inconsistent between core APIs #9271

Closed
not-an-aardvark opened this issue Sep 9, 2017 · 1 comment

Comments

@not-an-aardvark
Copy link
Member

commented Sep 9, 2017

In ESLint 4.6.1, we have a version property on CLIEngine and Linter indicating the version of ESLint being used. However, the version property appears in different places; it's placed on CLIEngine directly, but it's placed on instances of Linter.

const eslint = require("eslint");

eslint.CLIEngine.version // 4.6.1
eslint.Linter.version // undefined

new eslint.CLIEngine().version // undefined
new eslint.Linter().version // 4.6.1

This happened because the version property was added when Linter was a singleton rather than a constructor, so users were previously expected to access eslint.linter.version.

This could be mildly annoying; for example, an integration that only has access to Linter (like https://eslint.org/demo) would need to create a throwaway instance of Linter to get the version.

I propose that we add version as a static property of Linter. We could also copy it to Linter.prototype to prevent integrations from breaking if they were checking for the version property on instances.

@nzakas

This comment has been minimized.

Copy link
Member

commented Oct 23, 2018

Looks like everyone thought this was a good idea and it just fell through the cracks. I'll tackle this.

@nzakas nzakas added accepted and removed evaluating labels Oct 23, 2018

@nzakas nzakas self-assigned this Oct 23, 2018

nzakas added a commit that referenced this issue Oct 23, 2018

@nzakas nzakas closed this in 3943635 Oct 24, 2018

@eslint eslint bot locked and limited conversation to collaborators Apr 23, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.