codemix / codemix/babel-plugin-contracts

Unexpected token (2:9)

Open
#11 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
266
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Hello,

I used to use contracts in Racket of all languages, so glad to see something similar exists for JS!

Anyway, every time I try to compile anything with the contracts plugin, I get `Unexpected token (2:9)`. It doesn't matter what is at position 2:9, even comments will trigger the same error.

.babelrc
```json
{
"plugins": [
["contracts", {
"names": {
"assert": "assert",
"precondition": "pre",
"postcondition": "post",
"invariant": "invariant",
"return": "it",
"old": "old"
}
}]
]
}
```
test.js
```js
const add1 = n => {
pre: typeof n === 'number';
return n + 1
}
```

babel --version
```
6.26.0 (babel-core 6.26.3)
```

Do I need babel 7 for this? 6.26.3 is the latest version in npm.

https://www.npmjs.com/package/babel-core

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.