I have a function that accepts an object that has a property named "ignore" and returns a new object that has a property named "ignore". JSLint doesn't like the "ignore" property in the returned object.

/*jslint es6 */

function f({a, b, c, ignore}) {
return {
abc: a + b + c,
ignore // <-- Unexpected 'ignore'.
};
}

I think JSLint should allow shorthand property named "ignore".

More computing sins are committed in the name
of efficiency (without necessarily achieving it)
than for any other single reason--including blind
stupidity.

William A. Wulf

Post has attachment
JSLint currently allows two conventions of indentation.

There is the closed form, where you can break a line pretty much anywhere and indent the continuation 8 space.

a = method(b,
c, d);

And there is the open form in which you break after ( { or [, and the closing ) } or ] will be aligned with the beginning of the thing, and the stuff in between is indented 4. It generalizes the K&R block convention to object literals, array literals, and parameter/argument lists.

a = method(
b,
c,
d
);

I have been receiving complaints that JSLint should not like the old closed form. What say you?
41 votes
-
votes visible to Public
37%
Allow both forms
63%
Allow only the open form

/*jslint es6 */

const backtick = `\``;
const backslash = `\\`;

JSLint was unable to finish.
Unexpected escapement in mega literal.

JSLint should allow escaping backticks and backslashes in mega literals.

Post has attachment
I'm implementing a service worker using code provided by Google. I can't get the code to pass JSLint; I'm using the ES6 option, and JSLint seems flummoxed by the arrow (=>) function parameters. Here is the code in question, and below that is the link to its source at Google:

// From: https://googlechrome.github.io/samples/service-worker/basic/index.html

// Names of the two caches used in this version of the service worker.
// Change to v2, etc. when you update any of the local resources, which will
// in turn trigger the install event again.
const PRECACHE = 'precache-v1';
const RUNTIME = 'runtime';

// A list of local resources we always want to be cached.
const PRECACHE_URLS = [
'./' // Alias for index.html
];

// The install handler takes care of precaching the resources we always need.
self.addEventListener('install', event => {
event.waitUntil(
caches.open(PRECACHE)
.then(cache => cache.addAll(PRECACHE_URLS))
.then(self.skipWaiting())
);
});

// The activate handler takes care of cleaning up old caches.
self.addEventListener('activate', event => {
const currentCaches = [PRECACHE, RUNTIME];
event.waitUntil(
caches.keys().then(cacheNames => {
return cacheNames.filter(cacheName => !currentCaches.includes(cacheName));
}).then(cachesToDelete => {
return Promise.all(cachesToDelete.map(cacheToDelete => {
return caches.delete(cacheToDelete);
}));
}).then(() => self.clients.claim())
);
});

// The fetch handler serves responses for same-origin resources from a cache.
// If no response is found, it populates the runtime cache with the response
// from the network before returning it to the page.
self.addEventListener('fetch', event => {
// Skip cross-origin requests, like those for Google Analytics.
if (event.request.url.startsWith(self.location.origin)) {
event.respondWith(
caches.match(event.request).then(cachedResponse => {
if (cachedResponse) {
return cachedResponse;
}

return caches.open(RUNTIME).then(cache => {
return fetch(event.request).then(response => {
// Put a copy of the response in the runtime cache.
return cache.put(event.request, response.clone()).then(() => {
return response;
});
});
});
})
);
}
});

Post has attachment
Quick spacing issue with the following code:

/*jslint devel, browser */
/*global $, QB */

(function () {
"use strict";
$("#chat-test").click(function () {
QB.users.listUsers({
id: [7615, 7616, 7617]
},
function (err, result) {
console.log(err
? JSON.stringify(err)
: JSON.stringify(result));
});
});
}());

JSLint on JSLint.com right now wants that `function (err, result)...` to be indented two tabs from the previous parameter as shown above. That is, the above code's whitespace does lint.

I believe what it's really asking is for the `{` in the first parameter to be on a new line, indented properly, as below (which also lints):

/*jslint devel, browser */
/*global $, QB */

(function () {
"use strict";
$("#chat-test").click(function () {
QB.users.listUsers(
{
id: [7615, 7616, 7617]
},
function (err, result) {
console.log(err
? JSON.stringify(err)
: JSON.stringify(result));
}
);
});
}());

More briefly, the first example should not pass JSLint, but currently does.

If these examples have their whitespace mangled by G+, here's a pastebin with both:

http://pastebin.com/raw/sD7eTkWi

Hi everyone, I'm a little bit confused about ¿how to describe a JavaScript runtime environment ?, I think is the side when I execute some JavaScript code, but I need more feedbacks to define it.

When I explain about JSLint, I need to explain about that
, but I would like to be explain it more clear.

Can we please include the FileReader global variable when the "browser" switch is enabled?

I've run into something, while I was assigning boolean values via the conditional (ternary) operator.

var myState = true;
function toggle() {
myState = myState
? false
: true;
}

This doesn't lint. The error output wasn't particularly helpful to me:
"Expected '!' and instead saw '?'."

You can get it to lint by twice inverting the value:

myState = myState
? !!false
: !!true;

Is this working as intended? Or could the recognition of booleans be improved here?

JSLint says: Expected '{' and instead saw 'a'.

Why is:

if (E.a(val) != undefined)
a.push(E.a(val));

considered to be an error?

And there are many statements similar to this in my application, why JSLint only warns me about this one?
Wait while more posts are being loaded