Arc lint error on a new Go Service with an error in parsing output - lint

While Running arc lint on a service
I am seeing this error
Exception
Some linters failed:
- Exception: Linter failed to parse output!
STDOUT
STDERR
<standard input>:40:1: expected statement, found 'package'
<standard input>:59:27: expected ';', found error
(Run with `--trace` for a full exception trace.)
It suddenly started happening.

I was facing a similar issue. Here was the observation to fix the same. Whenever you do execute lint it automatically adjusts the code accordingly. In case if the new line is not present in the end of the file, lint copied the entire file so code become like below
package mypackage
import (
"go.uber.org/fx"
)
// Module is an FX module used when initializing the app
var Module = fx.Provide(
NewNewClient,
package mypackage
import (
"go.uber.org/fx"
)
// Module is an FX module used when initializing the app
var Module = fx.Provide(
NewNewClient,
)
Note that package is repeated here hence cause the issue.

Related

Error with the dependency of a dependency in nodejs

I have forked a repo to here:
https://github.com/unegma/react-three-fpscontrols
and am trying to convert the package to use typescript..
The error I keep getting is:
TypeError: three_1.Vector3 is not a constructor
which is occurring on this line here:
https://github.com/unegma/react-three-fpscontrols/blob/c89176ab5ce71e8e89332c088047ff85f804306e/src/FPSControls.tsx#L11
Checking the 'three' object in my console shows this: /static/media/three.c679b86df6ce78a00d67.cjs
instead of an Object containing Vector3, which leads me to think I'm doing the import of the import incorrectly.
I've tried including the #types/three in the dev dependencies, and the dependencies, and the peer dependencies, but nothing seems to work. Any clues?

Cannot use import statement outside a module when using wrangler v2

I'm new to using cloudflare and wrangler. I've a project that I've been working on, and I'm now trying to deploy it using wrangler publish, but I keep running into issues. My product is coded in node.js, and I'm using version 2 of wrangler. When I execute wrangler publish I get:
Basic JavaScript project found. Skipping unnecessary build!
Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
at worker.js:2Basic JavaScript project found. Skipping unnecessary build!
Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
at worker.js:2
I've searched for a solution, and one of them that I found said to change module in wrangler.toml from type="javascript"to type="webpack" however that gives me a bunch of errors:
./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'fs' ... Parsed request is a module...resolve as module
/Users/Desktop/APIs/cpiCalculator2/node_modules/destroy/node_modules doesn't exist or is not a directory
...
Error: webpack returned an error. You may be able to resolve this issue by running npm install.
I've tried reinstalling npm as it suggests and then wrangler publish again, but that just gives me the same error message.
I'm really not sure what the issue is, and I would really appreciate any help or advice on how to resolve this issue. Thank you!
Also, just a note, I'm not sure if this is affecting it, but I do have two other js documents in the main area of my project (where my index.js file is).

Why might webpack/babel stop compiling randomly?

I have encountered a few times that either the babel loader in webpack begins throwing errors unexpectedly despite nothing directly relating to webpack or babel etc being altered. As an example I was recently unable to compile due to babel not being able to handle private methods in classes, despite this supposedly being covered as part of babel 7.14+
ERROR in ./node_modules/pdfjs-dist/build/pdf.js 1413:9
Module parse failed: Unexpected character '#' (1413:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| class PDFDocumentLoadingTask {
> static #docId = 0;
|
The problem persisted even after I rolled back changes to the previous working commit and in the end I was only able to get webpack to compile after reinstalling all npm packages.
What are the possible causes of this?

Flow generates many errors for new project

Flow seems to generate a lot of errors on a new project. What am I doing wrong ?
What I did:
Created a new React Native project using react-native init FlowProject
Followed the set-up for Flow with yarn and Babel
yarn add --dev babel-cli babel-preset-flow
yarn add --dev flow-bin
Ran yarn run flow (.flowconfig was generated by the init)
Here is the error I get:
.flowconfig:53 Unsupported option specified! (unsafe.enable_getters_and_setters)
error Command failed with exit code 8.
Now if I remove the specified line (and version number), I get a bunch of these two errors:
Error: node_modules/react-native/Libraries/Inspector/Inspector.js:104
104: clearTimeout(_hideWait);
^^^^^^^^^ null. This type is incompatible with the expected param type of
733: declare function clearTimeout(timeoutId?: TimeoutID): void;
^^^^^^^^^ TimeoutID. See lib: /private/tmp/flow/flowlib_171966cc/core.js:733
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:1094
1094: this.props.onEndReachedThreshold * visibleLength / 2;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ undefined. The operand of an arithmetic operation must be a number.
Found 19 errors
error Command failed with exit code 2.
If I delete the generated .flowconfig file (see at the end), recreate it with yarn run flow init, and run yarn run flow again, I get the following errors (I'm just showing those 5, most of them were similar to each other):
Error: node_modules/react-native/Libraries/Animated/src/AnimatedEvent.js:101
101: if (__DEV__) {
^^^^^^^ __DEV__. Could not resolve name
Error: node_modules/react-native/Libraries/Inspector/Inspector.js:104
104: clearTimeout(_hideWait);
^^^^^^^^^ null. This type is incompatible with the expected param type of
733: declare function clearTimeout(timeoutId?: TimeoutID): void;
^^^^^^^^^ TimeoutID. See lib: /private/tmp/flow/flowlib_15451c3f/core.js:733
Error: node_modules/react-native/Libraries/Interaction/InteractionManager.js:107
107: return promise.done(...args);
^^^^^^^^^^^^^^^^^^^^^ call of method `done`. Function cannot be called on
107: return promise.done(...args);
^^^^^^^^^^^^^^^^^^^^^ property `done` of unknown type
Error: node_modules/react-native/Libraries/Interaction/TaskQueue.js:165
165: .done();
^^^^ property `done`. Property not found in
v---------
152: task.gen()
153: .then(() => {
154: DEBUG && infoLog(
...:
164: })
-^ Promise
Error: node_modules/react-native/Libraries/Lists/VirtualizedList.js:1016
1016: distanceFromEnd < onEndReachedThreshold * visibleLength &&
^^^^^^^^^^^^^^^^^^^^^ undefined. The operand of an arithmetic operation must be a number.
... 16 more errors (only 50 out of 66 errors displayed)
To see all errors, re-run Flow with --show-all-errors
error Command failed with exit code 2.
Now I know that I can tell flow to ignore certain files, but first, it seems weird to me that flow gives me these errors for code that I have not produced. I've also seen on a github issue that we shouldn't tell flow to ignore the node_modules. So is the solution to ignore every single file that this first flow analysis gives us ?
Here's a list of the files concerned:
Error node_modules/react-native/Libraries/Inspector/Inspector.js:
Error node_modules/react-native/Libraries/Interaction/InteractionManager.js
Error node_modules/react-native/Libraries/Lists/FlatList.js
Error node_modules/react-native/Libraries/Lists/ViewabilityHelper.js
Error node_modules/react-native/Libraries/Lists/VirtualizedList.js
Error node_modules/react-native/Libraries/Lists/VirtualizedSectionList.js
Error node_modules/react-native/Libraries/StyleSheet/flattenStyle.js
Generated .flowconfig file
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore unexpected extra "#providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
; Ignore polyfills
.*/Libraries/polyfills/.*
; Ignore metro
.*/node_modules/metro/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/react-native/flow-github/
[options]
emoji=true
module.system=haste
munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version]
^0.61.0
You cannot delete the React Native .flowconfig, because it defines a lot of custom configuration required for the project to typecheck cleanly.
Let's instead look at the initial error:
.flowconfig:53 Unsupported option specified! (unsafe.enable_getters_and_setters)
error Command failed with exit code 8.
This is caused by the version of Flow you installed with yarn add flow-bin no longer supporting this option (It was removed in 0.62). You'll need to install the exact version of Flow defined on the last line of your .flowconfig
[version]
^0.61.0
You can do this with:
yarn add flow-bin#0.61
Now the project should type check correctly.
Note that in the future, if you upgrade your project template with react-native upgrade and you accept the changes to .flowconfig, you may need to manually upgrade your flow-bin dependency to match.
Found this semi-related issue which recommended updating the flowconfig to use the latest version from create-react-native-app. Seems to have worked for me.
Go to .flowconfig file in your root project folder.
Delete this lines:
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable
Done!

Installing Torch Extension fb-caffe-exts from github

I am trying to install the fb-caffe-exts extension for Torch from Github fb-caffe-exts, specifically I am trying to use torch2caffe.
I am trying to run the test.lua demo for torch2caffe, but I am getting the following error, which refers to a line in the test.lua file:
t2c.run(opts, module) --attempt to call field 'run' (a nil value)
All the tests fail, with the stack trace referring to this error. I have installed the dependencies (fb.lualib etc) and added the lua packages to my path. Fb.python and the other dependencies import without producing errors.
Any help appreciated.