Open kangax opened 5 years ago
Interesting, do you have babel in your project? It might not be picking up the local copy and then won't be able to transpile your JS
@orta we're on babel 7.20; could this have to do with:
"resolutions": {
"babel-core": "7.0.0-bridge.0"
},
in package.json?
+1 for this. We still have old babel in our project, no resolutions.
Error: new Octokit({headers}) is deprecated. Use {userAgent, previews} instead. See https://github.com/octokit/rest.js#client-options
at parseOptions (/app/node_modules/@octokit/rest/lib/parse-client-options.js:43:14)
at new Octokit (/app/node_modules/@octokit/rest/lib/constructor.js:21:50)
at apiForDSL (/app/node_modules/danger/distribution/runner/jsonToDSL.js:114:15)
at Object.<anonymous> (/app/node_modules/danger/distribution/runner/jsonToDSL.js:72:23)
at step (/app/node_modules/danger/distribution/runner/jsonToDSL.js:43:23)
at Object.next (/app/node_modules/danger/distribution/runner/jsonToDSL.js:24:53)
at /app/node_modules/danger/distribution/runner/jsonToDSL.js:18:71
at new Promise (<anonymous>)
at __awaiter (/app/node_modules/danger/distribution/runner/jsonToDSL.js:14:12)
at Object.exports.jsonToDSL (/app/node_modules/danger/distribution/runner/jsonToDSL.js:65:53)
Error: octokit.authenticate() is deprecated. Use "auth" constructor option instead.
at authenticate (/app/node_modules/@octokit/rest/plugins/authentication-deprecated/authenticate.js:4:26)
at apiForDSL (/app/node_modules/danger/distribution/runner/jsonToDSL.js:116:13)
at Object.<anonymous> (/app/node_modules/danger/distribution/runner/jsonToDSL.js:72:23)
at step (/app/node_modules/danger/distribution/runner/jsonToDSL.js:43:23)
at Object.next (/app/node_modules/danger/distribution/runner/jsonToDSL.js:24:53)
at /app/node_modules/danger/distribution/runner/jsonToDSL.js:18:71
at new Promise (<anonymous>)
at __awaiter (/app/node_modules/danger/distribution/runner/jsonToDSL.js:14:12)
at Object.exports.jsonToDSL (/app/node_modules/danger/distribution/runner/jsonToDSL.js:65:53)
at Object.<anonymous> (/app/node_modules/danger/distribution/runner/jsonToContext.js:55:54)
Error: new Octokit({headers}) is deprecated. Use {userAgent, previews} instead. See https://github.com/octokit/rest.js#client-options
at parseOptions (/app/node_modules/@octokit/rest/lib/parse-client-options.js:43:14)
at new Octokit (/app/node_modules/@octokit/rest/lib/constructor.js:21:50)
at apiForDSL (/app/node_modules/danger/distribution/runner/jsonToDSL.js:114:15)
at Object.<anonymous> (/app/node_modules/danger/distribution/runner/jsonToDSL.js:72:23)
at step (/app/node_modules/danger/distribution/runner/jsonToDSL.js:43:23)
at Object.next (/app/node_modules/danger/distribution/runner/jsonToDSL.js:24:53)
at /app/node_modules/danger/distribution/runner/jsonToDSL.js:18:71
at new Promise (<anonymous>)
at __awaiter (/app/node_modules/danger/distribution/runner/jsonToDSL.js:14:12)
at Object.exports.jsonToDSL (/app/node_modules/danger/distribution/runner/jsonToDSL.js:65:53)
Error: octokit.authenticate() is deprecated. Use "auth" constructor option instead.
at authenticate (/app/node_modules/@octokit/rest/plugins/authentication-deprecated/authenticate.js:4:26)
at apiForDSL (/app/node_modules/danger/distribution/runner/jsonToDSL.js:116:13)
at Object.<anonymous> (/app/node_modules/danger/distribution/runner/jsonToDSL.js:72:23)
at step (/app/node_modules/danger/distribution/runner/jsonToDSL.js:43:23)
at Object.next (/app/node_modules/danger/distribution/runner/jsonToDSL.js:24:53)
at /app/node_modules/danger/distribution/runner/jsonToDSL.js:18:71
at new Promise (<anonymous>)
at __awaiter (/app/node_modules/danger/distribution/runner/jsonToDSL.js:14:12)
at Object.exports.jsonToDSL (/app/node_modules/danger/distribution/runner/jsonToDSL.js:65:53)
at Object.<anonymous> (/app/node_modules/danger/distribution/commands/utils/runDangerSubprocess.js:159:54)
Danger: ✓ passed review, received no feedback.
The deprecation message is visible also on danger-swift's CI
Just tried this with 7.0.9 and there're no more deprecation warnings but the syntax error is still there:
Unexpected token {
dangerfile.js:14
import { readFileSync } from 'fs';
Any ideas on how to fix this?
I think this is something to do with how the automatic babel setup is working on your project, try run DEBUG="*" danger pr [a pre url]
and see what it says about your babel stack
@orta Thanks! The relevant output seems to be:
2019-02-12T18:45:39.679Z danger:inline_runner Handling custom module: /Users/jzaytsev/dev/spacestation-v2/babel.config.js
2019-02-12T18:45:39.680Z babel:config:loading:files:configuration Auto-ignoring usage of config '/Users/jzaytsev/dev/spacestation-v2/babel.config.js'.
2019-02-12T18:45:39.680Z babel:config:loading:files:configuration Found root config 'babel.config.js' in $o. /Users/jzaytsev/dev/spacestation-v2
2019-02-12T18:45:39.692Z babel:config:loading:files:plugins Loaded plugin '@babel/plugin-transform-flow-strip-types' from '/Users/jzaytsev/dev/spacestation-v2'.
2019-02-12T18:45:39.692Z babel:config:loading:files:configuration Auto-ignoring usage of config '/Users/jzaytsev/dev/spacestation-v2/babel.config.js'.
2019-02-12T18:45:39.692Z babel:config:loading:files:configuration Found root config 'babel.config.js' in $o. /Users/jzaytsev/dev/spacestation-v2
so it finds config but then ignores it?
It seems after working with @kangax on this that regular node module imports work fine (like 'lodash', and 'danger'), but native imports like fs and path, it seems as though you have to use require('module')
and not use import module from 'module'
as then you hot the error that @kangax had.
I will try to look into the danger code to see if there is anything I can do for a PR to fix this issue
I'm running a simple example dangerfile.js straight from the docs, using the latest 7.0.2:
and
yarn danger local
throws both syntax error and deprecation notice:Am I missing something?