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

Uncaught TypeError: Cannot read property 'style' of undefined #168

Closed
edarblanco opened this issue Mar 1, 2017 · 24 comments
Closed

Uncaught TypeError: Cannot read property 'style' of undefined #168

edarblanco opened this issue Mar 1, 2017 · 24 comments

Comments

@edarblanco
Copy link

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.14.4 x64
Electron: 1.4.15
OS: "Arch Linux"
Thrown From: linter-js-standard package 3.9.0

Stack Trace

Uncaught TypeError: Cannot read property 'style' of undefined

At /home/edar/.atom/packages/linter-js-standard/lib/init.js:111

TypeError: Cannot read property 'style' of undefined
    at Object.__cacheTextEditor (/packages/linter-js-standard/lib/init.js:111:18)
    at storeSettings (/packages/linter-js-standard/lib/init.js:79:14)
    at Function.module.exports.Emitter.simpleDispatch (/usr/lib/atom/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/usr/lib/atom/node_modules/event-kit/lib/emitter.js:129:28)
    at /usr/lib/atom/src/pane-container.js:348:27
    at Function.module.exports.Emitter.simpleDispatch (/usr/lib/atom/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/usr/lib/atom/node_modules/event-kit/lib/emitter.js:129:28)
    at Pane.module.exports.Pane.setActiveItem (/usr/lib/atom/src/pane.js:300:22)
    at Pane.module.exports.Pane.activateItemAtIndex (/usr/lib/atom/src/pane.js:435:19)
    at Pane.module.exports.Pane.activatePreviousItem (/usr/lib/atom/src/pane.js:400:21)
    at Pane.module.exports.Pane.removeItem (/usr/lib/atom/src/pane.js:585:16)
    at Pane.module.exports.Pane.destroyItem (/usr/lib/atom/src/pane.js:658:16)
    at TabBarView.module.exports.TabBarView.closeTab (/usr/lib/atom/node_modules/tabs/lib/tab-bar-view.js:333:26)
    at HTMLDivElement.TabView.didClickCloseIcon (/usr/lib/atom/node_modules/tabs/lib/tab-bar-view.js:222:19)

Commands

     -9:20.7.0 tree-view:show (atom-workspace.workspace.scrollbars-visible-always.theme-atom-dark-fusion-syntax.theme-one-dark-ui)
     -9:14.1.0 editor:join-lines (input.hidden-input)
     -9:07.8.0 settings-view:open (input.hidden-input)
  2x -8:59.9.0 core:confirm (input.hidden-input)

Non-Core Packages

advanced-open-file 0.16.5 
angular-2 0.2.6 
angular-2-typeScript-snippets 0.6.3 
angular-bootstrap 1.0.1 
angular-restful-snippets 0.14.0 
angular2-snippets 0.3.0 
angularjs 0.4.0 
angularjs-snippets 0.10.18 
atom-beautify 0.29.17 
atom-bootstrap3 1.2.12 
atom-bootstrap4 1.4.0 
atom-dark-fusion-syntax 2.0.3 
express-complete 0.2.0 
autocomplete-angular-material 0.4.0 
autocomplete-modules 1.6.7 
cdn-libs 0.1.2 
color-picker 2.2.5 
css-snippets 1.1.0 
emmet 2.4.3 
expressjs 1.2.0 
file-icons 2.0.16 
flexbox-snippets 0.3.0 
git-plus 7.3.3 
git-plus-plus 1.1.0 
hyperclick 0.0.40 
js-hyperclick 1.10.1 
js-hyperx 1.1.0 
js-refactor 0.7.5 
language-babel 2.55.6 
language-graphql 0.8.0 
language-html-angular 1.0.16 
language-mongodb 0.3.1 
less-autocompile 1.0.0 
linter 1.11.23 
linter-eslint 8.1.2 
linter-js-standard 3.9.0 
linter-less 2.6.0 
linter-sass-lint 1.7.4 
linter-stylelint 3.9.0 
minimap 4.26.8 
minimap-autohide 0.10.1 
minimap-highlight-selected 4.5.0 
path-hyperclick 0.3.0 
pigments 0.39.0 
platformio-ide-terminal 2.3.1 
refactor 0.11.3 
rest-client 1.3.1 
smart-daemon-control 0.8.7 
template-generator 0.15.0 
todo-show 1.11.0 
@ricardofbarros
Copy link
Owner

Hey @edarblanco some steps to reproduce would be cool.

@edarblanco
Copy link
Author

Oh, my apologies, but apparently I solved the problem precisely today, I deleted the configuration folder of the plugin and to reinstall it everything was perfect, I give the thread as closed, thanks

@sonicdoe
Copy link
Collaborator

sonicdoe commented Mar 9, 2017

I have just had the same issue with Atom v1.14.4 on macOS. To reproduce:

  1. touch foo.js
  2. atom foo.js
  3. Type something into foo.js but do not save the file
  4. Open another tab, for example Settings
  5. rm foo.js
  6. Switch back to foo.js in Atom

@jarryd999
Copy link

This mostly happens to me when I switch between branches. I'll leave files open (in background tabs) that do not exist on another branch, and if I switch back to one of those tabs (manually or just when closing other tabs and they are supposed to come to the foreground) I run into this issue.

@rankida
Copy link

rankida commented Mar 21, 2017

Yep I just got the same issue too

[Enter steps to reproduce:]

  1. I just opened my editor via atom .. I did have other instances of atom already open for different directories. Worth nothing that this was not a standardlinted project (just regular eslint) so I would not have expected anything from standard.

Atom: 1.15.0 x64
Electron: 1.3.13
OS: Mac OS X 10.11.6
Thrown From: linter-js-standard package 3.9.0

Stack Trace

Uncaught TypeError: Cannot read property 'style' of undefined

At /Users/rankida/.atom/packages/linter-js-standard/lib/init.js:111

TypeError: Cannot read property 'style' of undefined
    at Object.__cacheTextEditor (/packages/linter-js-standard/lib/init.js:111:18)
    at storeSettings (/packages/linter-js-standard/lib/init.js:79:14)
    at Function.module.exports.Emitter.simpleDispatch (/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
    at /app.asar/src/pane-container.js:348:27
    at Function.module.exports.Emitter.simpleDispatch (/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
    at Emitter.module.exports.Emitter.emit (/app.asar/node_modules/event-kit/lib/emitter.js:129:28)
    at Pane.module.exports.Pane.setActiveItem (/app.asar/src/pane.js:300:22)
    at Pane.module.exports.Pane.activateItem (/app.asar/src/pane.js:452:21)
    at TabBarView.module.exports.TabBarView.onMouseDown (/app.asar/node_modules/tabs/lib/tab-bar-view.js:678:19)

Commands

Non-Core Packages

atom-beautify 0.29.17 
atom-typescript 11.0.1 
busy-signal 1.3.0 
intentions 1.1.2 
linter 2.1.0 
linter-eslint 8.1.4 
linter-js-standard 3.9.0 
linter-ui-default 1.2.1 
platformio-ide-terminal 2.5.0 
react 0.16.2 

@tjmehta
Copy link

tjmehta commented Mar 23, 2017

I repro'd this when I renamed a dir and touched files in atom with pathnames that did not exist (after the move).

@tjmehta
Copy link

tjmehta commented Mar 23, 2017

When the file does not exist checkStyleSettings ignores the error, and returns undefined:

console.error('Could not get project path', e)

Which causes opts to be undefined here:

var opts = config.honorStyleSettings ? styleSettings.checkStyleSettings(filePath) : {}

Which causes Cannot read property 'style' of undefined here:

style: opts.style || config.style,

@whmountains
Copy link

whmountains commented Apr 4, 2017

I get this error whenever I checkout a new branch with git. Atom suddenly randomly marks some tabs as unsaved and throws gazillions of these errors.

I can't say it happens 100% of the time, but definitely most of the time. I'd be happy to do debugging on my end if needed.

@dcalhoun
Copy link

dcalhoun commented May 1, 2017

@ricardofbarros will you please re-open this issue. It is definitely an active bug and there is now explicit steps to reproduce it.

@edarblanco edarblanco reopened this May 1, 2017
@edarblanco
Copy link
Author

Now this is my solution, save the atom package list, and remove or save in another location the atom packages configuration, and install with apm install the list of all the packages, for my work, but my problem was one package outdated

@alancnet
Copy link

alancnet commented May 3, 2017

My steps to reproduce:

  1. Create x.js
  2. Rename x.js to y.js
  3. Open y.js
  4. Select the x.js tab

@whmountains
Copy link

@alancnet Yes, I've frequently gotten that error doing similar actions.

But strangely I just tried it and couldn't manage to cause the error. Atom picked up the change immediately.

Maybe we're dealing with a sketchy file watcher here?

@whmountains
Copy link

I can reproduce the error by deleting a file that Atom currently has open in an inactive tab, then switching to the tab.

To eliminate as much unpredictability as possible, here is a command line that will generate the error 100% of the time.

touch foo.js && touch bar.js && atom foo.js && sleep 10 && rm foo.js && atom bar.js

Now just click back on the tab for foo.js and you'll see the error. At least I do, on Mac OS 10.12.4.

@mattfysh
Copy link

mattfysh commented May 5, 2017

Create a new file and switch from, then switch to, the new file. Since atom hasn't created the file in the filesystem yet (because it hasn't yet been saved), this error will be thrown

@reneolivo
Copy link

Got the issue too....

@mattfysh
Copy link

mattfysh commented Jul 5, 2017

I ended up switching to prettier

@binarykitchen
Copy link

come on, when will this be fixed??

@binarykitchen
Copy link

if i submit a pr would you accept it?

@whmountains
Copy link

whmountains commented Jul 6, 2017

I'll install from your fork if it doesn't get merged or fixed in some other way.

@nikmartin
Copy link
Contributor

This bug is very reproducible when trying to edit JSX files with a .js extension. It makes atom unusable in fact since it pops up every time you try to switch tabs. Uninstalled linter-js-standard and installed prettier

@binarykitchen
Copy link

likewise, switched to prettier

@laughedelic
Copy link

I have this problem too.
Almost 5 months, a lot of angry users and no reaction from the maintainer? Bad impression... 👎

@sonicdoe
Copy link
Collaborator

This will be fixed in an upcoming patch version.

@sonicdoe
Copy link
Collaborator

Released in v3.9.2 🎉

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

No branches or pull requests