Eslint + typescript paths aliasing with craco Unable to resolve path to module '#SomeFolder/SomeComponent' - import

can someone pls explain to me why I am still getting the error when I'm using
import SomeComponent from '#someFolder/SomeComponent';
this is my error
Unable to resolve the path to module '#SomeFolder/SomeComponent'
this is part of my esLint
"settings": {
"import/resolver": {
"alias": {
"map": [["#", "./src"], ["#someFolder", "./src/components/SomeFolder/*"]],
"extensions": [".ts", ".tsx", ".js", ".jsx", ".json"]
},
}
}
and this is part of my craco.config
webpack: {
alias: {
'#convertor': path.resolve(__dirname, `src/convertors`),
'#someFolder': path.resolve(__dirname, `src/components/SomeFolder`),
},
},
jest: {
configure: {
moduleNameMapper: {
'^#someFolder(.*)$': '<rootDir>/src/components/SomeFolder',
},
},
}, webpack: {
alias: {
'#convertor': path.resolve(__dirname, `src/convertors`),
'#someFolder': path.resolve(__dirname, `src/components/SomeFolder`),
},
},
jest: {
configure: {
moduleNameMapper: {
'^#someFolder(.*)$': '<rootDir>/src/components/SomeFolder',
},
},
},
this is tsconfig.paths.json
{
"compilerOptions": {
"baseUrl": "src",
"paths": {
"#someFolder/*": [ "src/components/SomeFolder/*" ],
"#convertor/*": [ "src/convertors/*" ],
}
}
}
this is full eslingrc
{
"plugins": ["import"],
"extends": [
"airbnb-typescript-prettier",
"plugin:react/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
],
"rules": {
"no-param-reassign": ["error", {
"props": true,
"ignorePropertyModificationsFor": [
"state"
]
}],
"#typescript-eslint/no-explicit-any": 0,
"#typescript-eslint/no-empty-function": 0,
"#typescript-eslint/camelcase": 0,
"#typescript-eslint/no-unused-vars": "warn",
"#typescript-eslint/ban-ts-comment": "warn",
"#typescript-eslint/no-shadow": "warn",
"#typescript-eslint/ban-types": 0,
"react/jsx-props-no-spreading": 0,
"#typescript-eslint/no-use-before-define": 0,
"jsx-a11y/alt-text": 0,
"max-classes-per-file": ["error", 10],
"prettier/prettier": [
"warn",
{
"endOfLine": "auto"
}
],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".ts", ".tsx"] }],
"react/prop-types": 0,
"react/jsx-no-bind": 0,
"react/destructuring-assignment": "warn",
"react/require-default-props": "warn",
"react/react-in-jsx-scope": 0,
"react/button-has-type": 0,
"react/no-array-index-key": "warn",
"react/display-name": 0,
"jsx-a11y/click-events-have-key-events": 0,
"jsx-a11y/no-noninteractive-element-interactions": 0,
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/anchor-is-valid": 0,
"react-hooks/exhaustive-deps": "warn",
"radix": ["error", "as-needed"],
"no-nested-ternary": "warn",
"no-plusplus": 0,
"import/prefer-default-export": 0,
"import/order": "warn",
"import/extensions": "warn",
"import/no-cycle": 0,
"consistent-return": 0,
"camelcase": "warn",
"guard-for-in": 0,
"no-restricted-syntax": 0,
"no-debugger": 1
},
"overrides": [
{
"files": ["**/*.test.js", "**/*.test.jsx", "**/*.test.ts", "**/*.test.tsx"],
"env": {
"jest": true
}
}
],
"settings": {
"import/resolver": {
"alias": {
"map": [["#", "./src"], ["#someFolder", "./src/components/SomeFolder/*"]],
"extensions": [".ts", ".tsx", ".js", ".jsx", ".json"]
},
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
}
}
PS pls don't suggest disabling import/no-unresolved. this isn't fixing problem it's just ignoring it

Related

Inserting data in private ipfs network from outside of server throws timeout error

I installed private ipfs network on my server and after that i tested it with entering a file and getting it which works perfectly,now when i try to follow the same steps from my local machine,getting data is working with the url - http://{server's ip}:8080/ipfs/{hash} but when i created api on Nodejs to insert data using url - http://{server's ip}:5001 then i am getting the error of timeout,though this api is working on deploying on server and changing the server's ip to localhost.
IPFS config is as follows -
{
"API": {
"HTTPHeaders": {
"Access-Control-Allow-Methods": [
"PUT",
"GET",
"POST"
],
"Access-Control-Allow-Origin": [
"*"
]
}
},
"Addresses": {
"API": "/ip4/0.0.0.0/tcp/5001",
"Announce": [],
"Gateway": "/ip4/0.0.0.0/tcp/8080",
"NoAnnounce": [],
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip6/::/tcp/4001"
]
},
"Bootstrap": [
"/ip4/{server's ip}/tcp/4001/ipfs/<peer identity hash of bootnode>"
],
"Datastore": {
"BloomFilterSize": 0,
"GCPeriod": "1h",
"HashOnRead": false,
"Spec": {
"mounts": [
{
"child": {
"path": "blocks",
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
"sync": true,
"type": "flatfs"
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
},
{
"child": {
"compression": "none",
"path": "datastore",
"type": "levelds"
},
"mountpoint": "/",
"prefix": "leveldb.datastore",
"type": "measure"
}
],
"type": "mount"
},
"StorageGCWatermark": 90,
"StorageMax": "10GB"
},
"Discovery": {
"MDNS": {
"Enabled": true,
"Interval": 10
}
},
"Experimental": {
"FilestoreEnabled": false,
"Libp2pStreamMounting": false,
"P2pHttpProxy": false,
"QUIC": false,
"ShardingEnabled": false,
"UrlstoreEnabled": false
},
"Gateway": {
"APICommands": [],
"HTTPHeaders": {
"Access-Control-Allow-Headers": [
"X-Requested-With",
"Range"
],
"Access-Control-Allow-Methods": [
"GET"
],
"Access-Control-Allow-Origin": [
"*"
]
},
"PathPrefixes": [],
"RootRedirect": "",
"Writable": false
},
"Identity": {
"PeerID": "<peer identity hash of bootnode>"
},
"Ipns": {
"RecordLifetime": "",
"RepublishPeriod": "",
"ResolveCacheSize": 128
},
"Mounts": {
"FuseAllowOther": false,
"IPFS": "/ipfs",
"IPNS": "/ipns"
},
"Pubsub": {
"DisableSigning": false,
"Router": "",
"StrictSignatureVerification": false
},
"Reprovider": {
"Interval": "12h",
"Strategy": "all"
},
"Routing": {
"Type": "dht"
},
"Swarm": {
"AddrFilters": null,
"ConnMgr": {
"GracePeriod": "20s",
"HighWater": 900,
"LowWater": 600,
"Type": "basic"
},
"DisableBandwidthMetrics": false,
"DisableNatPortMap": false,
"DisableRelay": false,
"EnableRelayHop": true
}
}

orientdb oetl error / I want to have pokec data

To configure the current pokec db ./oetl.sh I'm trying. However, the pipeline exit keeps occurring. I don't know what the problem is. Help me.The dburl is also a code that was well written but is now erased. I've tried all the settings, but they can't. If you do this, the data will be good, but it will not shut down automatically.
{
"config": {
"parallel": true
},
"source": {
"file": {
"path": "/home/yuna/soc-pokec-profiles.txt",
"lock" : true ,
"encoding" : "UTF-8"
}
},
"extractor": { "row": {} },
"transformers": [
{ "csv": {"columns":["id","public","completion_percentage","gender","region","region2","last_login","registration","AGE","body","I_am_working_in_field","spoken_languages","hobbies","I_most_enjoy_good_food","pets","body_type","my_eyesight","eye_color","hair_color","hair_type","completed_level_of_education","favourite_color","relation_to_smoking","relation_to_alcohol","on_pokec_i_am_looking_for","love_is_for_me","relation_to_casual_sex","my_partner_should_be","marital_status","children","relation_to_children","I_like_movies","I_like_watching_movie","I_like_music","I_mostly_like_listening_to_music","the_idea_of_good_evening","I_like_specialties_from_kitchen","fun","I_am_going_to_concerts","my_active_sports","my_passive_sports","profession","I_like_books","life_style","music","cars","politics","relationships","art_culture","hobbies_interests","science_technologies","computers_internet","education","sport","movies","travelling","health","companies_brands","more"],"separator": "/t","nullValue": "NULL"} },
{ "vertex": { "class": "Profile"} },
{"field":
{ "fieldName" : "id",
"expression" : "id.prefix('P')"
}
},
{"field":
{ "fieldNames" :
["region2","body","I_am_working_in_field","spoken_languages","hobbies","I_most_enjoy_good_food","pets","body_type","my_eyesight","eye_color","hair_color","hair_type","completed_level_of_education","favourite_color","relation_to_smoking","relation_to_alcohol","on_pokec_i_am_looking_for","love_is_for_me","relation_to_casual_sex","my_partner_should_be","marital_status","children","relation_to_children","I_like_movies","I_like_watching_movie","I_like_music","I_mostly_like_listening_to_music","the_idea_of_good_evening","I_like_specialties_from_kitchen","fun","I_am_going_to_concerts","my_active_sports","my_passive_sports","profession","I_like_books","life_style","music","cars","politics","relationships","art_culture","hobbies_interests","science_technologies","computers_internet","education","sport","movies","travelling","health","companies_brands","more"],
"operation": "remove"
}
}
],
"loader": {
"orientdb": {
"dbURL": "",
"dbType": "graph",
"wal": false,
"batchCommit": 10000,
"useLightweightEdges" : true,
"dbAutoCreateProperties": true,
"classes": [
{"name": "Profile", "extends": "V", "clusters": 3},
{"name": "Relation", "extends": "E"}
], "indexes": [
{"class":"Profile", "fields":["id:string"], "type":"UNIQUE" }
],
"settings": {
}
}
}

How to configure Prettier formatter - vscode plugin inconsistent with npm module installed

I'm using Prettier 1.14.0 with Prettier Formatter for Visual Studio Code. I've encountered problem with inconstancy of function arguments formatting.
For example demands me to keep string compose(field('tags'), orEmpty, commaList, usertag())()(user), inline while the second one forces it to be like this
compose(
field('tags'),
orEmpty,
commaList,
usertag(),
)()(user),
I want both to be like the second case. It looks like parser does not apply in package.json...
Here are some pieces of configs:
package.json
"prettier": {
"parser": "flow",
"printWidth": 80
},
"eslintConfig": {
"parser": "babel-eslint",
"extends": [
"standard",
"prettier",
"plugin:import/recommended"
],
"plugins": [
"prettier",
"simple-complexity",
"import",
"import-order-autofix",
"filenames"
],
"settings": {
"import/resolver": "webpack",
"import/ignore": [
"node_modules"
]
},
"rules": {
"filenames/match-exported": [
"error"
],
"import-order-autofix/order": [
"error",
{
"newlines-between": "always"
}
],
"prettier/prettier": [
"error",
{
"parser": "flow",
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": false,
"semi": false,
"requirePragma": true,
"insertPragma": true
}
],
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "always-multiline"
}
],
"complexity": [
"error",
{
"max": 15
}
],
"max-nested-callbacks": [
"error",
{
"max": 3
}
],
"max-statements": [
"error",
{
"max": 10
}
],
"max-params": [
"error",
{
"max": 4
}
],
"max-lines": [
"error",
{
"max": 350,
"skipBlankLines": true,
"skipComments": true
}
],
"max-depth": [
"error",
{
"max": 3
}
],
"simple-complexity/max-indent": [
"error",
{
"max": 20
}
]
}
},
.eslintrc
{
"extends": "react-app",
"plugins": [
"prettier",
"simple-complexity",
"import",
"import-order-autofix",
"filenames"
],
"rules": {
"filenames/match-exported": ["error"],
"import-order-autofix/order": [
"error",
{
"newlines-between": "always"
}
],
"prettier/prettier": [
"error",
{
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": false,
"semi": false,
"requirePragma": true,
"insertPragma": true
}
],
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "always-multiline"
}
],
"complexity": [
"error",
{
"max": 15
}
],
"max-nested-callbacks": [
"error",
{
"max": 3
}
],
"max-statements": [
"error",
{
"max": 10
}
],
"max-params": [
"error",
{
"max": 4
}
],
"max-lines": [
"error",
{
"max": 350,
"skipBlankLines": true,
"skipComments": true
}
],
"max-depth": [
"error",
{
"max": 3
}
],
"simple-complexity/max-indent": [
"error",
{
"max": 20
}
]
}
}
.vscode/settings
{
"[javascript]": {
"editor.formatOnSave": true,
},
"prettier.eslintIntegration": true,
"editor.tabSize": 2,
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true
},
}

ESlint - #connect react-redux unexpected character

I have a problem with configuring ESlint:
I have this code:
#connect((store) => {
return {
user: store.user.user,
userFetched: store.user.fetched,
tweets: store.tweets.tweets,
};
})
and I can't find a way to configure ESlint, so it does not throw an 'Unexpected token' for the '#connect'.
This is my '.eslintrc.json':
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"indent": [
1,
2
],
"linebreak-style": [
0,
"unix"
],
"quotes": [
1,
"double"
],
"semi": [
2,
"always"
]
}
}
Can someone help me with this problem?
I am most certain that there is a plugin for that but I can't find one.
Thanks!

Need help in mongodb $pull

I have a mongodb document that is like this:
{
"_id": ObjectId("5231718f042f8bc215000007"),
"ApplicationId": "YVo9bEQiDLg2",
"Network": {
"Millennial Media": {
"Active": true,
"RefreshInterval": 300000,
"NetworkId": 352,
"App": [
{
"AppId": "APID - Banner",
"AppValue": "76970",
"Priority": 100
}
]
},
"Buzzcity": {
"Active": true,
"RefreshInterval": 300000,
"NetworkId": 353,
"App": [
{
"AppId": "Partner ID",
"AppValue": "80624",
"Priority": 100
}
]
},
"Adiquity": {
"Active": true,
"RefreshInterval": 300000,
"NetworkId": 354,
"App": [
{
"AppId": "package",
"AppValue": "com.ristomobile.giftntake",
"Priority": 0
},
{
"AppId": "Site ID",
"AppValue": "adqkkqkk-14eo91zj-qv6qt",
"Priority": 100
},
{
"AppId": "appName",
"AppValue": "Gift&Take",
"Priority": 0
}
]
},
"Smaato": {
"Active": true,
"RefreshInterval": 300000,
"NetworkId": 351,
"App": [
{
"AppId": "Adspace ID",
"AppValue": "65766605",
"Priority": 100
}
],
"Partner": [
{
"PartnerId": "Publisher ID",
"PartnerValue": "923862008"
}
]
},
"AdNear": {
"Active": true,
"RefreshInterval": 300000,
"NetworkId": 367,
"Partner": [
{
"PartnerId": "pubid",
"PartnerValue": "rs-1328"
},
{
"PartnerId": "api_key",
"PartnerValue": "RSW78:QH8HHM389M7YP"
}
]
},
"twinpine": {
"Active": true,
"RefreshInterval": 300000,
"NetworkId": 371,
"Partner": [
{
"PartnerId": "pid",
"PartnerValue": "1551a74d1df075a"
},
{
"PartnerId": "alid",
"PartnerValue": "405"
}
]
},
"Vserv.mobi": {
"Active": true,
"RefreshInterval": 300000,
"NetworkId": 370,
"Partner": [
{
"PartnerId": "Zone Id",
"PartnerValue": "32024"
},
{
"PartnerId": "Publisher Id",
"PartnerValue": "12649"
}
]
}
},
"LastUpdate": ISODate("2013-06-24T01:44:22.865Z")
}
and i tried to pull away the Millenial Media data:
db.MediationSetup.update(
{
ApplicationId: "YVo9bEQiDLg2"
},
{
$pull: {
Network: {
"Millennial Media": {
"Active": true,
"RefreshInterval": 300000,
"NetworkId": 352,
"App": [
{
"AppId": "APID - Banner",
"AppValue": "76970",
"Priority": 100
}
]
}
}
}
})
but it gives
Cannot apply $pull/$pullAll modifier to non-array
I am puzzled, I am indeed pulling an array! so what is going on?
When I understood you correctly, you want to remove an entry from the array in Network.Millennial Media.App. In that case you have to reference a field nested in sub-documents by using the dot-notation:
db.MediationSetup.update(
{
ApplicationId: "YVo9bEQiDLg2"
},
{
$pull: { "Network.Millennial Media.App": {
"AppId": "APID - Banner",
"AppValue": "76970",
"Priority": 100
}
}
});