How do i disable prettierrc from giving a error for snake_case asking to convert it to camelCase? - prettier

I am working on a reactJS project and have added prettierrc file to maintain the coding standards.
The issue i am facing right now is a few of the identifiers are in snake_case and i need to maintain them in the same way, but prettier is flagging it as a error and asking me to convert it to camelCase.
Below is my prettierrc file contents in JSON.
{
"semi": false,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"jsxSingleQuote": true,
"bracketSpacing": true
}
I tried adding conditions to ignore the camelCase error as per a few solutions on StackOverflow, but none of them seem to work for me.
Can someone help me out with this?

Related

Google Document AI training fails due to an error that is already addressed

I am training a model using Google's Document AI. The training fails with the following error (I have included only a part of the JSON file for simplicity but the error is identical for all documents in my dataset):
"trainingDatasetValidation": {
"documentErrors": [
{
"code": 3,
"message": "Invalid document.",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "INVALID_DOCUMENT",
"domain": "documentai.googleapis.com",
"metadata": {
"num_fields": "0",
"num_fields_needed": "1",
"document": "5e88c5e4cc05ddb8.json",
"annotation_name": "INCOME_ADJUSTMENTS",
"field_name": "entities.text_anchor.text_segments"
}
}
]
}
What I understand from this error is that the model expects the field INCOME_ADJUSTMENTS to appear (at least) once in the document but instead, it finds zero instances of it.
That would have been understandable except I have already defined the field INCOME_ADJUSTMENTS in my schema as "Optional Once", i.e., this field can appear either zero or one time.
Am I missing something? Why does this error persist despite the fact that it is addressed in the schema?
p.s. I have also tried "Optional multiple" (and "Required once" and "Required multiple") and the error persists.
EDIT: As requested, here's what one of the JSON files looks like. Note that there is no PII here as the details (name, SSN, etc.) are synthetic data.
I have/had the same issue as you in the past and also having it right now.
What I managed to do was to get the document string from the error message and then searching for the images in the Storage bucket that has the dataset.
Then I opened the image and searched for that image in my 1000+ images dataset.
Then I deleted the bounding box for the label with the issue and then relabeled it. This seemed to solve 90%of the issues I had.
It`s a ton of manual work and I wish google thought of more when they released the Web app for Doc AI because the ML part is great but the app is really lackluster.
I would also be very happy for any other fixes
EDIT: another quicker workaround I have found is deleting the latest revision of the labeled documents from the Dataset in cloud storage. Like, take faulty document name from the operation json dump, then search for it in documents/ and then just delete latest revision.
Will probably mess up labeling and make you lose work, but it`s a quick fix to at least make some progress if you want.
Removed a few empty boxes and a lot of intersecting boxes fixed it for me.
i had the same problem.
so i deleted all my dataset and imported and re-labeled again.
then the training worked fine.

Should not have a 'bearerformat' property without 'scheme: bearer' being set

When importing an OpenAPI JSON file into Postman, Postman won't save the API definition because there's a syntax error with the JSON:
Should not have a 'bearerformat' property without 'scheme: bearer' being set
If I change the "scheme": "Bearer" to "scheme": "bearer" (lower case B) then Postman is happy, but the schema definition says it should be "Bearer".
What I don't understand is; this problem doesn't show up in a Google search, how can I be the only one having this problem? How can Postman not like the proper casing of Bearer? Am I missing something really obvious?
The scheme value is case-insensitive, so both "scheme": "bearer" and "scheme": "Bearer" (and even "scheme": "BeArEr") are valid.
This looks like an issue with Postman. I suggest you report it to Postman's support.
As a workaround, change your definition to use lowercase "scheme": "bearer".

Gtag.js optmize server_side implementation not working

I need some help with a server side implementation of optimize with gtag.js (the new global tag from Google).
With analytics.js it was as simple as ga('set', 'exp', 'experimentid.0'); The manual can be found here
With gtag.js set should work like this:gtag('set', {'exp': 'experimentid.0'});, but the values are not picked up by Google Optimize/Analytics. I tried putting it before the config tag and in the config tag as additional config information. gtag('config', '<target_ID>', {<additional_config_info>});
Furthermore i also tried changing exp in expId (like in an example on this page)
To no avail.
Does someone have a working server_side optimize code or can help me out?
Google Optimize Team Posted the following:
gtag('config', 'UA-XXXXXX-1', {experiments: [
{ id: 'ExperimentID 1', variant: '1' },
{ id: 'ExperimentID 2', variant: '8' },
]});
https://support.google.com/optimize/thread/36142685?hl=en&msgid=36785067
I've had a response from the Google Optimise team:
gtag.js does not yet support setting the experiment parameters you might be familiar with from the measurement protocol. We're looking into adding support.
So it looks like the only way at the moment is to revert to analytics.js

enum option "new" not working

I am trying to create an enum on my model and I would like one of the states to be "new"
e.g.
enum status: { stale: 0, new: 1, converted: 2 }
It seems rails rejects this with the following error.
You tried to define an enum named "status" on the model "Lead", but this will generate a class method "new", which is already defined by Active Record.
I understand why this is happening, but I was wondering if there is no way to get around this?
The error clearly states that you cannot have an enum with new key as it will conflict with an existing ActiveRecord method. There is no way out of this.
This issue is not new and it has been discussed before.
I would recommend you to read
enum: Option not to generate "dangerous" class methods
As per Godfrey Chan, Collaborator of Rails:
In this case, if you want to use enum, you are probably better off
renaming your label to something else. This is not unique to enums – a
lot of Active Record features generates methods for you and usually
there aren't ways to opt-out of those generated methods.
Gonna give this one a close for now....
I solved my problem by leaving config / environments / production.rb as default and everything returned to normal without errors
This issue occurs due to reserved words in Rails. To solve this issue, you can use two options:
Rename the attribute status to another non reserved word. E.g.: kind
Or just add the _prefix: :status in the enum. E.g: enum status: { stale: 0, new: 1, converted: 2 }, _prefix: :status

Can't any CouchDB _list function to work

Struggling to get any list function to work. I've been fine with _show and _view functions, but lists don't seem to be working, or I have misunderstood what to do! (I'll admit to needing an idiot's guide!)
My design document looks like:
{
"_id": "_design/lists",
"_rev": "3-d22225b4a28a6ca11484723c3a37201b",
"language": "javascript",
"views": {
"variants": {
"map": "function(doc) { emit(doc.var, doc.number_of_results); }"
}
},
"lists": {
"results": "function(head, req) { var row; while(row = getRow()) {send(row.value);}}"
}
}
When I enter http://localhost:5984/mydb/_design/lists/_view/variants I get a list of variant names, like:
...{"id":"f050ad9b9f725443cb8c4071f40583b","key":"rs1013940","value":19008},
{"id":"f050ad9b9f725443cb8c4071f40daff","key":"rs1013940","value":19008},
{"id":"f050ad9b9f725443cb8c4071f40b985","key":"rs1021188","value":10197}...
but when I enter http://localhost:5984/mydb/_design/lists/_list/results I get:
{"error":"list_error","reason":"Invalid path."}
Does anyone know what I'm doing wrong? I've tried everything I can think of and swapping the function for one from any of the online tutorials.
I'm using CouchDB version 1.0.1 on Ubuntu 12.04
Many thanks, hope someone can help!
You need to include both a view name as well as a list name in your URL:
http://localhost:5984/:db/_design/:ddoc/_list/:list/:view
which in your case translates to:
http://localhost:5984/mydb/_design/lists/_list/results/variants
I had the exact same condundrum; It wasn't easy to immediatley discern the difference in using views, shows, and lists from a beginner's perspective. In the offical docs I read this:
While Show functions are used to customize document presentation, List functions are used for same purpose, but against View functions results.
And it confused me slightly. I thought similarly that one could use a list alone to collate documents, perhaps in a nice juicy HTML coating, but I really only figured out what was going on after reading this page of the definitive guide (which is an incredible resource!)
http://guide.couchdb.org/draft/transforming.html
Like Dominic says, it should have been obvious to me based on the API :)