ESlint - #connect react-redux unexpected character - plugins

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!

Related

Definition for rule '#nrwl/nx/nx-plugin-checks' was not found

Using NX v14.1.4, I'm trying to run linting on a lib that contains a custom executor and I get this error.
My config is:
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["./package.json", "./generators.json", "./executors.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"#nrwl/nx/nx-plugin-checks": "error"
}
}
]
}
The parent config is
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["#nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"#nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:#nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:#nrwl/nx/javascript"],
"rules": {}
},
{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
}
]
}

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

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

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
}
}

Angular-6 Protractor E2E test: Chrome crash issue

I am running e2e test in simple angular-6 application just have basic application,
though it is always giving me below error,
protractor.conf.js:
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
tsconfig.e2e.json:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
angular.json:
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"Angular6App": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/Angular6App",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "Angular6App:build"
},
"configurations": {
"production": {
"browserTarget": "Angular6App:build:production"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "Angular6App:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"Angular6App-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "Angular6App:serve"
},
"configurations": {
"production": {
"devServerTarget": "Angular6App:serve:production"
}
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "Angular6App"
}
app.po.ts:
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
app.e2e-spec.ts:
import { AppPage } from './app.po';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to Angular6App!');
});
});
I have tried to run app using ng serve then it is working fine. But while running test ng e2e it shows message chrome crash.
So someone knows about how to fix this issue?

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
},
}