Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Invalid position given by 'W033' #429

Closed
twhite96 opened this issue Jun 27, 2017 · 1 comment
Closed

Invalid position given by 'W033' #429

twhite96 opened this issue Jun 27, 2017 · 1 comment

Comments

@twhite96
Copy link

JSHint returned a point that did not exist in the document being edited.
Rule: W033
Requested start point: 6:16
Just updated to the latest Atom and got this error.

code:

// Testing for localStorage
// Wanted to use localStorage instead of a database because the data is just very small text files
// Testing code can be found here: MDN Github https://github.com/mdn/dom-examples/blob/master/web-storage/main.js

function storageAvailable(type) {
	'use strict'
	try {
		var storage = window[type], x = "__storage_test__";
		storage.setItem(x, x);
		storage.removeItem(x);
		return true;
	} catch (e) {
		return (
			e instanceof DOMException && // everything except Firefox
			(e.code === 22 || // Firefox
			e.code === 1014 || // test name field too, because code might not be present // everything except Firefox
			e.name === "QuotaExceededError" || // Firefox
				e.name === "NS_ERROR_DOM_QUOTA_REACHED") && // acknowledge QuotaExceededError only if there's something already stored
			storage.length !== 0
		);
	}
}

console.log(storageAvailable());

// Example functions to populate storage and set styles.
// Can comment out or edit
// Using so that I can see if the browser is capabale of calling localStorage on the DOM.
// Commenting out for now so that I can edit

var htmlElem = document.querySelector('html');
var pElem = document.querySelector('p');
var bgcolorForm = document.getElementById('bgcolor');
var fontForm = document.getElementById('font');

// Test for localStorage

if(!localStorage.getItem('bgcolor')) {
  populateStorage();
} else {
  setStyles();
}

function populateStorage() {
  localStorage.setItem('bgcolor', document.getElementById('bgcolor').value);
  localStorage.setItem('font', document.getElementById('font').value);
  localStorage.setItem('image', document.getElementById('image').value);
  setStyles();
}
function setStyles() {
  var currentColor = localStorage.getItem('bgcolor');
  var currentFont = localStorage.getItem('font');
  document.getElementById('bgcolor').value = currentColor;
  document.getElementById('font').value = currentFont;
  htmlElem.style.backgroundColor = '#' + currentColor;
  pElem.style.fontFamily = currentFont;
}
bgcolorForm.onchange = populateStorage;
fontForm.onchange = populateStorage;

/* App Starts Here */
$('#texts').val('New Text');
$('#texts').trigger('autoresize');
var writeGood = require('write-good');
var suggestions = writeGood(userInput, {weasel: false});

suggestions: [{

}];

Debug information:

Atom version: 1.18.0
linter-jshint version: v3.1.4
JSHint version: jshint v2.9.5
Hours since last Atom restart: 0.2
Platform: darwin
Current file's scopes: [
  "source.js",
  "comment.line.double-slash.js",
  "punctuation.definition.comment.js"
]
linter-jshint configuration: {
  "disableWhenNoJshintrcFileInPath": true,
  "executablePath": "",
  "lintInlineJavaScript": false,
  "scopes": [
    "source.js",
    "source.js-semantic"
  ],
  "jshintFileName": ".jshintrc",
  "jshintignoreFilename": ".jshintignore"
}
@Arcanemagus
Copy link
Member

Since your example code is indented using tabs, you are hitting a bug in JSHint where almost (?) all rules are broken when using tabs. Please follow jshint/jshint#3151 for further updates on getting this fixed in JSHint.

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

No branches or pull requests

2 participants