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
package atom-editor
add a comment |
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
package atom-editor
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
add a comment |
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
package atom-editor
(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
package atom-editor
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
add a comment |
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
add a comment |
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
}
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 addedsetCount
to the file of your view, if it's only used in the other file. You could just as well addsetCount
after yourtoggle
function and call it asthis.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 keptsetCount
in theZenkbarieswordcountView
, I don't see a reason to assign it to a class variable. You could simply call it using the imported nameZenkbarieswordcountView.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
add a comment |
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
}
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 addedsetCount
to the file of your view, if it's only used in the other file. You could just as well addsetCount
after yourtoggle
function and call it asthis.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 keptsetCount
in theZenkbarieswordcountView
, I don't see a reason to assign it to a class variable. You could simply call it using the imported nameZenkbarieswordcountView.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
add a comment |
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
}
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 addedsetCount
to the file of your view, if it's only used in the other file. You could just as well addsetCount
after yourtoggle
function and call it asthis.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 keptsetCount
in theZenkbarieswordcountView
, I don't see a reason to assign it to a class variable. You could simply call it using the imported nameZenkbarieswordcountView.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
add a comment |
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
}
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
}
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 addedsetCount
to the file of your view, if it's only used in the other file. You could just as well addsetCount
after yourtoggle
function and call it asthis.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 keptsetCount
in theZenkbarieswordcountView
, I don't see a reason to assign it to a class variable. You could simply call it using the imported nameZenkbarieswordcountView.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
add a comment |
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 addedsetCount
to the file of your view, if it's only used in the other file. You could just as well addsetCount
after yourtoggle
function and call it asthis.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 keptsetCount
in theZenkbarieswordcountView
, I don't see a reason to assign it to a class variable. You could simply call it using the imported nameZenkbarieswordcountView.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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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