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

Exported var was used before it was defined in 2.9.0 #2662

Closed
robrich opened this issue Sep 3, 2015 · 8 comments
Closed

Exported var was used before it was defined in 2.9.0 #2662

robrich opened this issue Sep 3, 2015 · 8 comments

Comments

@robrich
Copy link
Contributor

robrich commented Sep 3, 2015

Using JSHint 2.9.0, I get this error: common-lib.js: line 2, col 5, 'commonLib' was used before it was defined. and in previous versions of JSHint I did not. Moving the /* exported ... /* line to the end of the file resolves the symptom. Here is a minimum sample repro project:

.jshintrc:

{
  "latedef": true
}

common-lib.js:

/* exported commonLib */
var commonLib = (function () {
  'use strict';

  return 'the common lib';
}());

command I run:
jshint .

@nicolo-ribaudo
Copy link
Contributor

Possible duplicate of gh-2658

@nicolo-ribaudo
Copy link
Contributor

The regression has been introduced in 08eb4e2

@lukeapage
Copy link
Member

@nicolo-ribaudo please comment if you are working on a fix and I won't start working on one..

@lukeapage
Copy link
Member

Assuming not..

@lukeapage
Copy link
Member

lukeapage commented Sep 4, 2015 via email

@lukeapage
Copy link
Member

lukeapage commented Sep 4, 2015 via email

@nicolo-ribaudo
Copy link
Contributor

I have a fix which is almost working... (It just has a bug when exporting variables defined using /* globals) - d5381db

nicolo-ribaudo added a commit to nicolo-ribaudo/jshint that referenced this issue Sep 4, 2015
@lukeapage
Copy link
Member

lukeapage commented Sep 4, 2015 via email

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

No branches or pull requests

3 participants