-
Notifications
You must be signed in to change notification settings - Fork 48
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
Uncaught TypeError: Cannot read property 'messages' of undefined #214
Comments
Thanks for reporting this error. Are you able to reproduce this or was this a one-time error? |
Sorry for keeping my reporting so short. In the meantime I did some investigation: Interestingly I have issues with a particular file in a particular project. When I copy it to e.g. desktop the problem disappears. Very strange … |
The file looks like this function main () {
processMenuItems()
insertMainMenuCover()
handleLangMenu()
}
function handleLangMenu () {
const langswitch = Array.from(document.getElementsByClassName('module-metamenu--langswitch'))[0]
const langmenu = Array.from(document.getElementsByClassName('module-metamenu--langmenu'))[0]
langswitch.addEventListener('click', function (event) {
if (!hasClass(langmenu, '-expanded')) {
addClass(langmenu, '-expanded')
} else {
removeClass(langmenu, '-expanded')
}
})
}
function processMenuItems () {
let menuItems = Array.from(document.getElementsByClassName('module-mainmenu--level-0'))[0].childNodes
// Zap separator items
for (let i = 0; i < menuItems.length; i++) {
let item = menuItems[i]
if (hasClass(item, 'separator')) {
item.parentNode.removeChild(item)
}
}
// Process others
for (let i = 0; i < menuItems.length; i++) {
let item = menuItems[i]
let anchor = item.childNodes[0]
let ul = Array.from(item.childNodes).filter((item) => item.nodeName === 'UL')
const title = anchor.textContent
const id = item.className.slice(1)
const itemTop = item.offsetTop
// attach Click handler
if (ul.length) {
anchor.addEventListener('click', function (event) {
event.preventDefault()
event.stopPropagation()
addClass(ul[0].parentNode, '-expanded')
let cover = document.getElementsByClassName('module-mainmenu--cover')[0]
addClass(cover, '-expanded')
return false
})
let container = document.createElement('div')
addClass(container, 'module-mainmenu--level-1-container')
container.style.paddingTop = itemTop + 'px'
wrapElement(ul[0], container)
let backbutton = document.createElement('button')
backbutton.innerHTML = 'zurück'
backbutton.addEventListener('click', function (event) {
removeClass(this.parentNode, '-expanded')
let cover = document.getElementsByClassName('module-mainmenu--cover')[0]
removeClass(cover, '-expanded')
})
// addClass(backbutton, 'module-mainmenu--level-1-backbutton')
insertBefore(backbutton, ul[0])
let submenuheader = document.createElement('h2')
submenuheader.innerHTML = title
addClass(submenuheader, '-' + id)
insertBefore(submenuheader, ul[0])
}
// Add icon container, wrap text
anchor.innerHTML = `<div class="module-mainmenu--icon-level-0 -${id}"></div><div class="module-mainmenu--link-level-0">${title}</div>`
}
// Show menu when ready
document.getElementsByClassName('module-mainmenu--level-0')[0].style.visibility = 'visible'
}
function insertMainMenuCover () {
const cover = document.createElement('div')
addClass(cover, 'module-mainmenu--cover')
insertBefore(cover, document.getElementsByClassName('module-mainmenu--level-0')[0])
}
function hasClass (el, className) {
return el.classList ? el.classList.contains(className) : new RegExp('\\b' + className + '\\b').test(el.className)
}
function addClass (el, className) {
if (el.classList) el.classList.add(className)
else if (!hasClass(el, className)) el.className += ' ' + className
}
function removeClass (el, className) {
if (el.classList) el.classList.remove(className)
else el.className = el.className.replace(new RegExp('\\b' + className + '\\b', 'g'), '')
}
function insertBefore (el, referenceNode) {
referenceNode.parentNode.insertBefore(el, referenceNode)
}
function wrapElement (toWrap, wrapper = document.createElement('div')) {
toWrap.parentNode.appendChild(wrapper)
return wrapper.appendChild(toWrap)
}
// ---------------------------------------------------------------------------
if (document.readyState !== 'loading') {
main()
} else if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', main)
} else {
document.attachEvent('onreadystatechange', function () {
if (document.readyState === 'complete') main()
})
} |
Do you have |
Yes, if I e.g. put an extra semicolon at the end of a line and run |
Which Could you also try running the following command (after putting an extra semicolon at the end of a line)?
This runs the linter using |
I have this problem when I prepend any .js file with a dot foo.js works fine It fails also if I prepend any parent folder with a dor foo/bar.js works fine
|
Same here. I have a dot in the path as my file resides somewhere in ".eclipse-workspace" And no, I don't have any special Version or settings in my package.json.
|
@hacknlove @gorkarod Thanks for the info, I was now able to reproduce this error.
I’ll take a closer look at fixing this soon. Any help would be appreciated though 🙂 |
Great! Thanks @sonicdoe! |
@sonicdoe Hi, I don't really understand why you reverted given option. If standard ignores, given files, then they should be ignored. But is there way to do at least trade-off to introduce settings which allows disables/enables sending file to standard engine. Reverting the commit introduces back original problem #212. (Guys we have spent lot of time to identify given issue). |
I agree that if |
@sonicdoe ok, thanks for update. Until 5.0.0 released, we manually stick with 4.1.0. |
v5.0.0 has now been released and includes this fix. |
[Enter steps to reproduce:]
Atom: 1.22.1 x64
Electron: 1.6.15
OS: Mac OS X 10.11.6
Thrown From: linter-js-standard package 4.1.0
Stack Trace
Uncaught TypeError: Cannot read property 'messages' of undefined
Commands
Non-Core Packages
The text was updated successfully, but these errors were encountered: