Используйте .eslintrc из / home с eslint, установленным глобально в VScode - PullRequest
0 голосов
/ 04 июля 2018

Можно использовать .eslintrc для всех проектов, которые я открываю в VScode с глобально установленным eslint?

Я бы хотел использовать мой .eslintrc у себя дома, при открытии проекта в консоли VScode появляется ошибка eslint.

Failed to load plugin prettier: Cannot find module 'eslint-plugin-prettier' Happened while validating /home/**/**/**/constants.js This can happen for a couple of reasons: 1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc). 2. If ESLint is installed globally, then make sure 'eslint-plugin-prettier' is installed globally as well. 3. If ESLint is installed locally, then 'eslint-plugin-prettier' isn't installed correctly.

Но перед тем, как запустить эту команду:

npm install -g eslint@^3.19.0 eslint-config-airbnb@^15.0.1 eslint-config-prettier@^2.9.0 eslint-loader@^1.8.0 eslint-plugin-import@^2.7.0 eslint-plugin-jsx-a11y@^5.0.1 eslint-plugin-prettier@^2.6.1 eslint-plugin-react@^7.1.0

вот мой .eslintrc в /user/home/.eslintrc

{
"parser": "babel-eslint",
"plugins": ["react", "jsx-a11y", "import", "prettier"],
"extends": ["react-app", "airbnb", "prettier", "prettier/react"],
"env": {
    "browser": true
},
"rules": {
    "import/prefer-default-export": 0,
    "jsx-a11y/no-static-element-interactions": 0,
    "react/jsx-filename-extension": 0,
    "import/no-extraneous-dependencies": 0,
    "import/extensions": 0,
    "import/no-unresolved": 0,
    "no-console": 0,
    "react/jsx-closing-bracket-location": 2,
    "no-confusing-arrow": 0,
    "import/no-webpack-loader-syntax": 0,
    "no-return-assign": 0,
    "jsx-a11y/label-has-for": 0,
    "react/no-array-index-key": 0,
    "no-mixed-operators": 0,
    "react/no-did-mount-set-state": 0,
    "react/require-default-props": 0,
    "prettier/prettier": [
        "error",
        {
            "trailingComma": "es5",
            "singleQuote": true,
            "printWidth": 120
        }
    ]
  }
}
...