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

func-names with ES6 classes #2103

Closed
Marsup opened this issue Mar 18, 2015 · 3 comments
Closed

func-names with ES6 classes #2103

Marsup opened this issue Mar 18, 2015 · 3 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@Marsup
Copy link
Contributor

Marsup commented Mar 18, 2015

ESLint seems to misunderstand ES6 classes definitions.

test.js :

class A {
  constructor() {}
  foo() {}
}

.eslintrc

ecmaFeatures:
  classes: true
rules:
  func-names: 2

Errors :

test.js
  2:13  error  Missing function expression name  func-names
  3:5   error  Missing function expression name  func-names

I can make probably make a patch but I don't know if the problem is in the parser or in ESLint.

@nzakas nzakas added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion labels Mar 18, 2015
@nzakas
Copy link
Member

nzakas commented Mar 18, 2015

The problem is in the rule. Concise methods are represented by FunctionExpression, so we'd need to check to see if the parent is MethodDefinition and, if so, ignore it.

Feel free to take a stab at it, please take moment to read our contribution guidelines before you start: http://eslint.org/docs/developer-guide/contributing.html

@Marsup
Copy link
Contributor Author

Marsup commented Mar 18, 2015

I'm working on it, almost done. Is it normal that a setter missing its argument provides 0:0 error Message reference must be in range as error ? It took me a while to notice that's what was missing.

@nzakas
Copy link
Member

nzakas commented Mar 18, 2015

I'm unfamiliar with that error message. Please file an issue with Espree describing the code you're using and the error you're seeing.

@nzakas nzakas closed this as completed in 2a27f1e Mar 19, 2015
nzakas added a commit that referenced this issue Mar 19, 2015
Fix: func-names with ES6 classes (fixes #2103)
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

2 participants