Unexpected Token - Atom Tutorial- WordCount











up vote
0
down vote

favorite












(I revised this questions to be more informative at User idleberg's suggestion)



I'm using Atom editor. And I'm learning how to create package. I use atom's documentation and tutorial to learn how to customize the Atom. I used the 'wordcount' tutorial. (https://flight-manual.atom.io/hacking-atom/sections/package-word-count/).



I follow everything up to right before Basic Debugging section. I get the Unexpected token error. I couldn't figure out how to solve it. I did research on the net and all.



I just need to get that solved before I moved on to next section (Basic Debugging section.)



Here are info about my setup and error. Any help would be appreciated.



Atom: 1.32.1 x64



Electron: 2.0.9



OS: Mac OS X 10.14



Thrown From: zenkbarieswordcount package 0.0.0



Stack Trace



Failed to activate the zenkbarieswordcount package


At /Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount-view.js: Unexpected token (31:16)

SyntaxError: /Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount-view.js: Unexpected token (31:16)
}


Here is the code where the SyntaxError orginate. The first line is line 31.



31  setCount(count) {
32 const displayText = `There are ${count} words.`;
33 this.element.children[0].textContent = displayText;
34 }


here are the trace:



at Parser.pp.raise (/app.asar/node_modules/babylon/lib/parser/location.js:24:13)
at Parser.pp.unexpected (/app.asar/node_modules/babylon/lib/parser/util.js:82:8)
at Parser.pp.semicolon (/app.asar/node_modules/babylon/lib/parser/util.js:69:81)
at Parser.pp.parseExpressionStatement (/app.asar/node_modules/babylon/lib/parser/statement.js:427:8)
at Parser.parseExpressionStatement (/app.asar/node_modules/babylon/lib/plugins/flow.js:676:20)
at Parser.pp.parseStatement (/app.asar/node_modules/babylon/lib/parser/statement.js:142:21)
at Parser.parseStatement (/app.asar/node_modules/babylon/lib/plugins/flow.js:655:22)
at Parser.pp.parseTopLevel (/app.asar/node_modules/babylon/lib/parser/statement.js:30:21)
at Parser.parse (/app.asar/node_modules/babylon/lib/parser/index.js:70:17)
at Object.parse (/app.asar/node_modules/babylon/lib/index.js:45:50)
at Object.exports.default (/app.asar/node_modules/babel-core/lib/helpers/parse.js:36:18)
at File.parse (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:574:40)
at File.parseCode (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:691:20)
at /app.asar/node_modules/babel-core/lib/transformation/pipeline.js:167:12
at File.wrap (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:639:16)
at Pipeline.transform (/app.asar/node_modules/babel-core/lib/transformation/pipeline.js:165:17)
at Object.e.compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:573903)
at Object.compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:570702)
at compileFileAtPath (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:147501)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:149898)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (/app.asar/static/index.js:47:45)
at require (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:145675)
at Object.<anonymous> (/Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount.js:7:32)
at Object.<anonymous> (/Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount.js:51:2)
at Module.get_Module._compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:146385)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:149932)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (/app.asar/static/index.js:47:45)
at require (internal/module.js:11:18)
at customRequire (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:620607)
at Package.requireMainModule (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:2966969)


Commands I used that triggered the error




-0:04.1.0 zenkbarieswordcount:toggle (atom-pane.pane.active)



Mr GitHub repo for this code is:
https://github.com/zenkbaries/zenkbarieswordcount



Non-Core Packages (that are installed on atom)




  • atom-beautify 0.33.4

  • busy-signal 1.4.3

  • intentions 1.1.5

  • jekyll 2.1.0

  • jekyll-syntax-highlighting 0.1.0

  • language-liquid 0.7.0

  • linter 2.2.0

  • linter-markdown 5.2.2

  • linter-stylelint 4.3.2

  • linter-ui-default 1.7.1

  • markdown-preview-kramdown 0.6.1

  • markdown-writer 2.10.3

  • platformio-ide-terminal 2.8.4

  • zenkbarieswordcount 0.0.0










share|improve this question
























  • You should post the relevant parts of your code, ideally as MCV. The error log shows errors in line 7, 32 and 57. What's in those lines?
    – idleberg
    Nov 8 at 10:33












  • Thanks for you suggestion. I added more info (and cleaned and organized the questions bit better to make it more 'organized')
    – John Towery
    Nov 10 at 17:54















up vote
0
down vote

favorite












(I revised this questions to be more informative at User idleberg's suggestion)



I'm using Atom editor. And I'm learning how to create package. I use atom's documentation and tutorial to learn how to customize the Atom. I used the 'wordcount' tutorial. (https://flight-manual.atom.io/hacking-atom/sections/package-word-count/).



I follow everything up to right before Basic Debugging section. I get the Unexpected token error. I couldn't figure out how to solve it. I did research on the net and all.



I just need to get that solved before I moved on to next section (Basic Debugging section.)



Here are info about my setup and error. Any help would be appreciated.



Atom: 1.32.1 x64



Electron: 2.0.9



OS: Mac OS X 10.14



Thrown From: zenkbarieswordcount package 0.0.0



Stack Trace



Failed to activate the zenkbarieswordcount package


At /Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount-view.js: Unexpected token (31:16)

SyntaxError: /Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount-view.js: Unexpected token (31:16)
}


Here is the code where the SyntaxError orginate. The first line is line 31.



31  setCount(count) {
32 const displayText = `There are ${count} words.`;
33 this.element.children[0].textContent = displayText;
34 }


here are the trace:



at Parser.pp.raise (/app.asar/node_modules/babylon/lib/parser/location.js:24:13)
at Parser.pp.unexpected (/app.asar/node_modules/babylon/lib/parser/util.js:82:8)
at Parser.pp.semicolon (/app.asar/node_modules/babylon/lib/parser/util.js:69:81)
at Parser.pp.parseExpressionStatement (/app.asar/node_modules/babylon/lib/parser/statement.js:427:8)
at Parser.parseExpressionStatement (/app.asar/node_modules/babylon/lib/plugins/flow.js:676:20)
at Parser.pp.parseStatement (/app.asar/node_modules/babylon/lib/parser/statement.js:142:21)
at Parser.parseStatement (/app.asar/node_modules/babylon/lib/plugins/flow.js:655:22)
at Parser.pp.parseTopLevel (/app.asar/node_modules/babylon/lib/parser/statement.js:30:21)
at Parser.parse (/app.asar/node_modules/babylon/lib/parser/index.js:70:17)
at Object.parse (/app.asar/node_modules/babylon/lib/index.js:45:50)
at Object.exports.default (/app.asar/node_modules/babel-core/lib/helpers/parse.js:36:18)
at File.parse (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:574:40)
at File.parseCode (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:691:20)
at /app.asar/node_modules/babel-core/lib/transformation/pipeline.js:167:12
at File.wrap (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:639:16)
at Pipeline.transform (/app.asar/node_modules/babel-core/lib/transformation/pipeline.js:165:17)
at Object.e.compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:573903)
at Object.compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:570702)
at compileFileAtPath (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:147501)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:149898)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (/app.asar/static/index.js:47:45)
at require (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:145675)
at Object.<anonymous> (/Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount.js:7:32)
at Object.<anonymous> (/Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount.js:51:2)
at Module.get_Module._compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:146385)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:149932)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (/app.asar/static/index.js:47:45)
at require (internal/module.js:11:18)
at customRequire (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:620607)
at Package.requireMainModule (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:2966969)


Commands I used that triggered the error




-0:04.1.0 zenkbarieswordcount:toggle (atom-pane.pane.active)



Mr GitHub repo for this code is:
https://github.com/zenkbaries/zenkbarieswordcount



Non-Core Packages (that are installed on atom)




  • atom-beautify 0.33.4

  • busy-signal 1.4.3

  • intentions 1.1.5

  • jekyll 2.1.0

  • jekyll-syntax-highlighting 0.1.0

  • language-liquid 0.7.0

  • linter 2.2.0

  • linter-markdown 5.2.2

  • linter-stylelint 4.3.2

  • linter-ui-default 1.7.1

  • markdown-preview-kramdown 0.6.1

  • markdown-writer 2.10.3

  • platformio-ide-terminal 2.8.4

  • zenkbarieswordcount 0.0.0










share|improve this question
























  • You should post the relevant parts of your code, ideally as MCV. The error log shows errors in line 7, 32 and 57. What's in those lines?
    – idleberg
    Nov 8 at 10:33












  • Thanks for you suggestion. I added more info (and cleaned and organized the questions bit better to make it more 'organized')
    – John Towery
    Nov 10 at 17:54













up vote
0
down vote

favorite









up vote
0
down vote

favorite











(I revised this questions to be more informative at User idleberg's suggestion)



I'm using Atom editor. And I'm learning how to create package. I use atom's documentation and tutorial to learn how to customize the Atom. I used the 'wordcount' tutorial. (https://flight-manual.atom.io/hacking-atom/sections/package-word-count/).



I follow everything up to right before Basic Debugging section. I get the Unexpected token error. I couldn't figure out how to solve it. I did research on the net and all.



I just need to get that solved before I moved on to next section (Basic Debugging section.)



Here are info about my setup and error. Any help would be appreciated.



Atom: 1.32.1 x64



Electron: 2.0.9



OS: Mac OS X 10.14



Thrown From: zenkbarieswordcount package 0.0.0



Stack Trace



Failed to activate the zenkbarieswordcount package


At /Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount-view.js: Unexpected token (31:16)

SyntaxError: /Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount-view.js: Unexpected token (31:16)
}


Here is the code where the SyntaxError orginate. The first line is line 31.



31  setCount(count) {
32 const displayText = `There are ${count} words.`;
33 this.element.children[0].textContent = displayText;
34 }


here are the trace:



at Parser.pp.raise (/app.asar/node_modules/babylon/lib/parser/location.js:24:13)
at Parser.pp.unexpected (/app.asar/node_modules/babylon/lib/parser/util.js:82:8)
at Parser.pp.semicolon (/app.asar/node_modules/babylon/lib/parser/util.js:69:81)
at Parser.pp.parseExpressionStatement (/app.asar/node_modules/babylon/lib/parser/statement.js:427:8)
at Parser.parseExpressionStatement (/app.asar/node_modules/babylon/lib/plugins/flow.js:676:20)
at Parser.pp.parseStatement (/app.asar/node_modules/babylon/lib/parser/statement.js:142:21)
at Parser.parseStatement (/app.asar/node_modules/babylon/lib/plugins/flow.js:655:22)
at Parser.pp.parseTopLevel (/app.asar/node_modules/babylon/lib/parser/statement.js:30:21)
at Parser.parse (/app.asar/node_modules/babylon/lib/parser/index.js:70:17)
at Object.parse (/app.asar/node_modules/babylon/lib/index.js:45:50)
at Object.exports.default (/app.asar/node_modules/babel-core/lib/helpers/parse.js:36:18)
at File.parse (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:574:40)
at File.parseCode (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:691:20)
at /app.asar/node_modules/babel-core/lib/transformation/pipeline.js:167:12
at File.wrap (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:639:16)
at Pipeline.transform (/app.asar/node_modules/babel-core/lib/transformation/pipeline.js:165:17)
at Object.e.compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:573903)
at Object.compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:570702)
at compileFileAtPath (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:147501)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:149898)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (/app.asar/static/index.js:47:45)
at require (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:145675)
at Object.<anonymous> (/Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount.js:7:32)
at Object.<anonymous> (/Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount.js:51:2)
at Module.get_Module._compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:146385)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:149932)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (/app.asar/static/index.js:47:45)
at require (internal/module.js:11:18)
at customRequire (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:620607)
at Package.requireMainModule (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:2966969)


Commands I used that triggered the error




-0:04.1.0 zenkbarieswordcount:toggle (atom-pane.pane.active)



Mr GitHub repo for this code is:
https://github.com/zenkbaries/zenkbarieswordcount



Non-Core Packages (that are installed on atom)




  • atom-beautify 0.33.4

  • busy-signal 1.4.3

  • intentions 1.1.5

  • jekyll 2.1.0

  • jekyll-syntax-highlighting 0.1.0

  • language-liquid 0.7.0

  • linter 2.2.0

  • linter-markdown 5.2.2

  • linter-stylelint 4.3.2

  • linter-ui-default 1.7.1

  • markdown-preview-kramdown 0.6.1

  • markdown-writer 2.10.3

  • platformio-ide-terminal 2.8.4

  • zenkbarieswordcount 0.0.0










share|improve this question















(I revised this questions to be more informative at User idleberg's suggestion)



I'm using Atom editor. And I'm learning how to create package. I use atom's documentation and tutorial to learn how to customize the Atom. I used the 'wordcount' tutorial. (https://flight-manual.atom.io/hacking-atom/sections/package-word-count/).



I follow everything up to right before Basic Debugging section. I get the Unexpected token error. I couldn't figure out how to solve it. I did research on the net and all.



I just need to get that solved before I moved on to next section (Basic Debugging section.)



Here are info about my setup and error. Any help would be appreciated.



Atom: 1.32.1 x64



Electron: 2.0.9



OS: Mac OS X 10.14



Thrown From: zenkbarieswordcount package 0.0.0



Stack Trace



Failed to activate the zenkbarieswordcount package


At /Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount-view.js: Unexpected token (31:16)

SyntaxError: /Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount-view.js: Unexpected token (31:16)
}


Here is the code where the SyntaxError orginate. The first line is line 31.



31  setCount(count) {
32 const displayText = `There are ${count} words.`;
33 this.element.children[0].textContent = displayText;
34 }


here are the trace:



at Parser.pp.raise (/app.asar/node_modules/babylon/lib/parser/location.js:24:13)
at Parser.pp.unexpected (/app.asar/node_modules/babylon/lib/parser/util.js:82:8)
at Parser.pp.semicolon (/app.asar/node_modules/babylon/lib/parser/util.js:69:81)
at Parser.pp.parseExpressionStatement (/app.asar/node_modules/babylon/lib/parser/statement.js:427:8)
at Parser.parseExpressionStatement (/app.asar/node_modules/babylon/lib/plugins/flow.js:676:20)
at Parser.pp.parseStatement (/app.asar/node_modules/babylon/lib/parser/statement.js:142:21)
at Parser.parseStatement (/app.asar/node_modules/babylon/lib/plugins/flow.js:655:22)
at Parser.pp.parseTopLevel (/app.asar/node_modules/babylon/lib/parser/statement.js:30:21)
at Parser.parse (/app.asar/node_modules/babylon/lib/parser/index.js:70:17)
at Object.parse (/app.asar/node_modules/babylon/lib/index.js:45:50)
at Object.exports.default (/app.asar/node_modules/babel-core/lib/helpers/parse.js:36:18)
at File.parse (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:574:40)
at File.parseCode (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:691:20)
at /app.asar/node_modules/babel-core/lib/transformation/pipeline.js:167:12
at File.wrap (/app.asar/node_modules/babel-core/lib/transformation/file/index.js:639:16)
at Pipeline.transform (/app.asar/node_modules/babel-core/lib/transformation/pipeline.js:165:17)
at Object.e.compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:573903)
at Object.compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:570702)
at compileFileAtPath (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:147501)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:149898)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (/app.asar/static/index.js:47:45)
at require (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:145675)
at Object.<anonymous> (/Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount.js:7:32)
at Object.<anonymous> (/Users/kellyboy/github/zenkbarieswordcount/lib/zenkbarieswordcount.js:51:2)
at Module.get_Module._compile (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:146385)
at Object.value [as .js] (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:149932)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (/app.asar/static/index.js:47:45)
at require (internal/module.js:11:18)
at customRequire (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:1:620607)
at Package.requireMainModule (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:2966969)


Commands I used that triggered the error




-0:04.1.0 zenkbarieswordcount:toggle (atom-pane.pane.active)



Mr GitHub repo for this code is:
https://github.com/zenkbaries/zenkbarieswordcount



Non-Core Packages (that are installed on atom)




  • atom-beautify 0.33.4

  • busy-signal 1.4.3

  • intentions 1.1.5

  • jekyll 2.1.0

  • jekyll-syntax-highlighting 0.1.0

  • language-liquid 0.7.0

  • linter 2.2.0

  • linter-markdown 5.2.2

  • linter-stylelint 4.3.2

  • linter-ui-default 1.7.1

  • markdown-preview-kramdown 0.6.1

  • markdown-writer 2.10.3

  • platformio-ide-terminal 2.8.4

  • zenkbarieswordcount 0.0.0







package atom-editor






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 17:53

























asked Nov 8 at 1:20









John Towery

205




205












  • You should post the relevant parts of your code, ideally as MCV. The error log shows errors in line 7, 32 and 57. What's in those lines?
    – idleberg
    Nov 8 at 10:33












  • Thanks for you suggestion. I added more info (and cleaned and organized the questions bit better to make it more 'organized')
    – John Towery
    Nov 10 at 17:54


















  • You should post the relevant parts of your code, ideally as MCV. The error log shows errors in line 7, 32 and 57. What's in those lines?
    – idleberg
    Nov 8 at 10:33












  • Thanks for you suggestion. I added more info (and cleaned and organized the questions bit better to make it more 'organized')
    – John Towery
    Nov 10 at 17:54
















You should post the relevant parts of your code, ideally as MCV. The error log shows errors in line 7, 32 and 57. What's in those lines?
– idleberg
Nov 8 at 10:33






You should post the relevant parts of your code, ideally as MCV. The error log shows errors in line 7, 32 and 57. What's in those lines?
– idleberg
Nov 8 at 10:33














Thanks for you suggestion. I added more info (and cleaned and organized the questions bit better to make it more 'organized')
– John Towery
Nov 10 at 17:54




Thanks for you suggestion. I added more info (and cleaned and organized the questions bit better to make it more 'organized')
– John Towery
Nov 10 at 17:54












1 Answer
1






active

oldest

votes

















up vote
0
down vote













This looks like a simple syntax error. Without knowing the logic of your code, consider the following. You either need to move setCount() inside your class, or use the correct syntax to declare a function.



Example:



function setCount() {
// your code
}


or, if you prefer using ES6 syntax, use an arrow function



setCount() => {
// your code
}





share|improve this answer





















  • I tried all your suggestions. Each one gives an error: 1. Moving setCount inside the ZenkbarieswordcountView class: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined. 2. Fix syntax to declare function: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined 3. using ES6 syntax, with an arrow function: unsuccessful No change. Just same original error as my posted questions. (Unexpected token)
    – John Towery
    Nov 12 at 14:13












  • I looked at your code and wonder why you have added setCount to the file of your view, if it's only used in the other file. You could just as well add setCount after your toggle function and call it as this.setCount(). In any case, I recommend reading about imports/exports to better understand what you are actually doing.
    – idleberg
    Nov 12 at 15:16










  • Another remark: if you kept setCount in the ZenkbarieswordcountView, I don't see a reason to assign it to a class variable. You could simply call it using the imported name ZenkbarieswordcountView.setCount().
    – idleberg
    Nov 12 at 15:20










  • it seems the tutorial that I'm using to code this is written incorrectly? im using this...flight-manual.atom.io/hacking-atom/sections/package-word-count . I follow this tutorial exactly as written.
    – John Towery
    Nov 12 at 16:55













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53200266%2funexpected-token-atom-tutorial-wordcount%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













This looks like a simple syntax error. Without knowing the logic of your code, consider the following. You either need to move setCount() inside your class, or use the correct syntax to declare a function.



Example:



function setCount() {
// your code
}


or, if you prefer using ES6 syntax, use an arrow function



setCount() => {
// your code
}





share|improve this answer





















  • I tried all your suggestions. Each one gives an error: 1. Moving setCount inside the ZenkbarieswordcountView class: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined. 2. Fix syntax to declare function: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined 3. using ES6 syntax, with an arrow function: unsuccessful No change. Just same original error as my posted questions. (Unexpected token)
    – John Towery
    Nov 12 at 14:13












  • I looked at your code and wonder why you have added setCount to the file of your view, if it's only used in the other file. You could just as well add setCount after your toggle function and call it as this.setCount(). In any case, I recommend reading about imports/exports to better understand what you are actually doing.
    – idleberg
    Nov 12 at 15:16










  • Another remark: if you kept setCount in the ZenkbarieswordcountView, I don't see a reason to assign it to a class variable. You could simply call it using the imported name ZenkbarieswordcountView.setCount().
    – idleberg
    Nov 12 at 15:20










  • it seems the tutorial that I'm using to code this is written incorrectly? im using this...flight-manual.atom.io/hacking-atom/sections/package-word-count . I follow this tutorial exactly as written.
    – John Towery
    Nov 12 at 16:55

















up vote
0
down vote













This looks like a simple syntax error. Without knowing the logic of your code, consider the following. You either need to move setCount() inside your class, or use the correct syntax to declare a function.



Example:



function setCount() {
// your code
}


or, if you prefer using ES6 syntax, use an arrow function



setCount() => {
// your code
}





share|improve this answer





















  • I tried all your suggestions. Each one gives an error: 1. Moving setCount inside the ZenkbarieswordcountView class: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined. 2. Fix syntax to declare function: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined 3. using ES6 syntax, with an arrow function: unsuccessful No change. Just same original error as my posted questions. (Unexpected token)
    – John Towery
    Nov 12 at 14:13












  • I looked at your code and wonder why you have added setCount to the file of your view, if it's only used in the other file. You could just as well add setCount after your toggle function and call it as this.setCount(). In any case, I recommend reading about imports/exports to better understand what you are actually doing.
    – idleberg
    Nov 12 at 15:16










  • Another remark: if you kept setCount in the ZenkbarieswordcountView, I don't see a reason to assign it to a class variable. You could simply call it using the imported name ZenkbarieswordcountView.setCount().
    – idleberg
    Nov 12 at 15:20










  • it seems the tutorial that I'm using to code this is written incorrectly? im using this...flight-manual.atom.io/hacking-atom/sections/package-word-count . I follow this tutorial exactly as written.
    – John Towery
    Nov 12 at 16:55















up vote
0
down vote










up vote
0
down vote









This looks like a simple syntax error. Without knowing the logic of your code, consider the following. You either need to move setCount() inside your class, or use the correct syntax to declare a function.



Example:



function setCount() {
// your code
}


or, if you prefer using ES6 syntax, use an arrow function



setCount() => {
// your code
}





share|improve this answer












This looks like a simple syntax error. Without knowing the logic of your code, consider the following. You either need to move setCount() inside your class, or use the correct syntax to declare a function.



Example:



function setCount() {
// your code
}


or, if you prefer using ES6 syntax, use an arrow function



setCount() => {
// your code
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 11:09









idleberg

6,71042539




6,71042539












  • I tried all your suggestions. Each one gives an error: 1. Moving setCount inside the ZenkbarieswordcountView class: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined. 2. Fix syntax to declare function: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined 3. using ES6 syntax, with an arrow function: unsuccessful No change. Just same original error as my posted questions. (Unexpected token)
    – John Towery
    Nov 12 at 14:13












  • I looked at your code and wonder why you have added setCount to the file of your view, if it's only used in the other file. You could just as well add setCount after your toggle function and call it as this.setCount(). In any case, I recommend reading about imports/exports to better understand what you are actually doing.
    – idleberg
    Nov 12 at 15:16










  • Another remark: if you kept setCount in the ZenkbarieswordcountView, I don't see a reason to assign it to a class variable. You could simply call it using the imported name ZenkbarieswordcountView.setCount().
    – idleberg
    Nov 12 at 15:20










  • it seems the tutorial that I'm using to code this is written incorrectly? im using this...flight-manual.atom.io/hacking-atom/sections/package-word-count . I follow this tutorial exactly as written.
    – John Towery
    Nov 12 at 16:55




















  • I tried all your suggestions. Each one gives an error: 1. Moving setCount inside the ZenkbarieswordcountView class: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined. 2. Fix syntax to declare function: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined 3. using ES6 syntax, with an arrow function: unsuccessful No change. Just same original error as my posted questions. (Unexpected token)
    – John Towery
    Nov 12 at 14:13












  • I looked at your code and wonder why you have added setCount to the file of your view, if it's only used in the other file. You could just as well add setCount after your toggle function and call it as this.setCount(). In any case, I recommend reading about imports/exports to better understand what you are actually doing.
    – idleberg
    Nov 12 at 15:16










  • Another remark: if you kept setCount in the ZenkbarieswordcountView, I don't see a reason to assign it to a class variable. You could simply call it using the imported name ZenkbarieswordcountView.setCount().
    – idleberg
    Nov 12 at 15:20










  • it seems the tutorial that I'm using to code this is written incorrectly? im using this...flight-manual.atom.io/hacking-atom/sections/package-word-count . I follow this tutorial exactly as written.
    – John Towery
    Nov 12 at 16:55


















I tried all your suggestions. Each one gives an error: 1. Moving setCount inside the ZenkbarieswordcountView class: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined. 2. Fix syntax to declare function: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined 3. using ES6 syntax, with an arrow function: unsuccessful No change. Just same original error as my posted questions. (Unexpected token)
– John Towery
Nov 12 at 14:13






I tried all your suggestions. Each one gives an error: 1. Moving setCount inside the ZenkbarieswordcountView class: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined. 2. Fix syntax to declare function: unsuccessful Errortype: Uncaught TypeError: Cannot read property 'setCount' of undefined 3. using ES6 syntax, with an arrow function: unsuccessful No change. Just same original error as my posted questions. (Unexpected token)
– John Towery
Nov 12 at 14:13














I looked at your code and wonder why you have added setCount to the file of your view, if it's only used in the other file. You could just as well add setCount after your toggle function and call it as this.setCount(). In any case, I recommend reading about imports/exports to better understand what you are actually doing.
– idleberg
Nov 12 at 15:16




I looked at your code and wonder why you have added setCount to the file of your view, if it's only used in the other file. You could just as well add setCount after your toggle function and call it as this.setCount(). In any case, I recommend reading about imports/exports to better understand what you are actually doing.
– idleberg
Nov 12 at 15:16












Another remark: if you kept setCount in the ZenkbarieswordcountView, I don't see a reason to assign it to a class variable. You could simply call it using the imported name ZenkbarieswordcountView.setCount().
– idleberg
Nov 12 at 15:20




Another remark: if you kept setCount in the ZenkbarieswordcountView, I don't see a reason to assign it to a class variable. You could simply call it using the imported name ZenkbarieswordcountView.setCount().
– idleberg
Nov 12 at 15:20












it seems the tutorial that I'm using to code this is written incorrectly? im using this...flight-manual.atom.io/hacking-atom/sections/package-word-count . I follow this tutorial exactly as written.
– John Towery
Nov 12 at 16:55






it seems the tutorial that I'm using to code this is written incorrectly? im using this...flight-manual.atom.io/hacking-atom/sections/package-word-count . I follow this tutorial exactly as written.
– John Towery
Nov 12 at 16:55




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53200266%2funexpected-token-atom-tutorial-wordcount%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Full-time equivalent

さくらももこ

13 indicted, 8 arrested in Calif. drug cartel investigation