[BUG] Unable to parse ES6 object literal shorthand notation
See original GitHub issueOverview of the issue
Getting this error…
[15:29:02] parsing: /[snip]/app/javascript/app/app.component.ts
[15:29:02] RangeError: Invalid array length
… when parsing a module containing ES6 object literal shorthand notation:
@Component({
selector: 'app-root',
template
})
Changing the object literal to “longhand”, { /* ... */, template: template }
, resolves the error.
Operating System, Node.js, npm, compodoc version(s)
- macOS@10.13
- node@8.6.0
- npm@5.3.0
- compodoc@1.0.1
Angular configuration, a package.json
file in the root folder
{
"dependencies": {
"@angular/common": "5.0.0-rc.0",
"@angular/compiler": "5.0.0-rc.0",
"@angular/core": "5.0.0-rc.0",
"@angular/forms": "5.0.0-rc.0",
"@angular/http": "5.0.0-rc.0",
"@angular/platform-browser": "5.0.0-rc.0",
"@angular/platform-browser-dynamic": "5.0.0-rc.0",
"@angular/router": "5.0.0-rc.0",
"@types/lodash": "^4.14.74",
"@types/node": "^8.0.24",
"@types/webpack-env": "^1.13.0",
"autoprefixer": "^7.1.2",
"babel-core": "^6.25.0",
"babel-loader": "7.x",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.6.0",
"compression-webpack-plugin": "^1.0.0",
"core-js": "^2.4.1",
"css-loader": "^0.28.4",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"glob": "^7.1.2",
"honeybadger-js": "^0.5.0",
"html-loader": "^0.5.1",
"js-yaml": "^3.9.1",
"lodash": "^4.17.4",
"node-sass": "^4.5.3",
"octicons": "^6.0.1",
"path-complete-extname": "^0.1.0",
"postcss-loader": "^2.0.6",
"postcss-smart-import": "^0.7.5",
"precss": "^2.0.0",
"rails-erb-loader": "^5.1.0",
"resolve-url-loader": "^2.1.0",
"rxjs": "^5.4.0",
"sass-loader": "^6.0.6",
"sass-rem": "^2.0.0",
"style-loader": "^0.18.2",
"ts-loader": "^2.0.3",
"typescript": "^2.3.2",
"webpack": "^3.5.3",
"webpack-manifest-plugin": "^1.3.0",
"webpack-merge": "^4.1.0",
"zone.js": "^0.8.10"
},
"devDependencies": {
"@compodoc/compodoc": "^1.0.1",
"@types/jasmine": "^2.5.53",
"@types/jasmine-expect": "^3.6.1",
"@types/jasminewd2": "^2.0.2",
"babel-eslint": "^8.0.0",
"eslint": "^4.4.1",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-protractor": "^1.40.0",
"eslint-plugin-standard": "^3.0.1",
"htmlhint": "^0.9.13",
"istanbul": "^0.4.5",
"istanbul-instrumenter-loader": "^3.0.0",
"jasmine-core": "^2.7.0",
"jasmine-expect": "^3.7.1",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-detect-browsers": "^2.2.5",
"karma-firefox-launcher": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-jasmine-matchers": "^3.7.0",
"karma-nyan-reporter": "^0.2.5",
"karma-spec-reporter": "^0.0.31",
"karma-webpack": "^2.0.4",
"ng2-mock-component": "^0.1.0",
"protractor": "^5.1.2",
"sass-lint": "^1.10.2",
"ts-node": "^3.3.0",
"tslint": "^5.6.0",
"tslint-config-standard": "^6.0.1",
"webpack-dev-server": "^2.7.1"
}
}
Compodoc installed globally or locally ?
Locally
Motivation for or Use Case
Using Babel which supports shorthand property notation. It’s the future, today!
Reproduce the error
Use shorthand notation.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
eslint object-shorthand error with variable passed in
An excerpt from eslint regarding the issue: Require Object Literal Shorthand Syntax (object-shorthand) - Rule Details.
Read more >Object initializer - JavaScript - MDN Web Docs - Mozilla
An object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, ...
Read more >object-shorthand - ESLint - Pluggable JavaScript Linter
This rule enforces the use of the shorthand syntax. This applies to all methods (including generators) defined in object literals and any properties...
Read more >25+ JavaScript Shorthand Coding Techniques - SitePoint
Become a faster developer and check out this guide to shorthand JavaScript coding techniques, with longhand versions for comparison.
Read more >Object destructuring best practice in Javascript | by Crunch Tech
Before ES6 object destructuring was even a thing, in addition to regular dot notation or bracket notation for object property access, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in https://github.com/compodoc/compodoc/commit/295a029e69011ab8346dd12be7284809291d1638 for components and directives
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. Why locking ? Having issues with the most up-to-date context.