Sjlver
Sjlver

Reputation: 1295

JSHint reports undefined global despite `globals` setting

JSHint is reporting undefined variables despite the globals setting. Here is a minimal example:

file.js:

// jshint esversion: 6, node: true
// globals Intl

'use strict';
let percent = new Intl.NumberFormat("en-US", { style: "percent" }).format;

Running jshint file.js

index2.js: line 5, col 19, 'Intl' is not defined.

1 error

Any idea what could be wrong with my configuration? Note that there is no .jshintrc, the only configuration for JSHint are the comments at the beginning of file.js.

Upvotes: 1

Views: 196

Answers (1)

juanmirocks
juanmirocks

Reputation: 6171

To be honest, I never saw the use of a simple single-line comment like // to configure jshint/globals.

Try with with multi-line comment style, like /* globals MY_LIB: false */ as per defined in: http://jshint.com/docs/

Upvotes: 1

Related Questions