web-dev-qa-db-ja.com

Eslint構成エラー。 ESLintは拡張元の構成 "dev"を見つけることができませんでした

TS反応プロジェクトにeslintを設定しようとしていますが、エラーが発生します。

> eslint .


Oops! Something went wrong! :(

ESLint: 6.8.0.

ESLint couldn't find the config "dev" to extend from. Please check that the name of the config is correct.

The config "dev" was referenced from the config file in "C:\Users\User\Desktop\priority-style-react\example\node_modules\@csstools\convert-colors\package.json".

If you still have problems, please stop by https://gitter.im/eslint/eslint to chat with the team.

私のpackage.jsonは次のようになります:

{
  "name": "######",
  "version": "####",
  "description": "none",
  "author": "iLavs",
  "license": "MIT",
  "repository": "#####",
  "main": "dist/index.js",
  "module": "dist/index.es.js",
  "jsnext:main": "dist/index.es.js",
  "engines": {
    "node": ">=8",
    "npm": ">=5"
  },
  "scripts": {
    "lint": "eslint .",
    "build": "rollup -c",
    "start": "rollup -c -w",
  },
  "dependencies": {
    "classnames": "^2.2.6"
  },
  "peerDependencies": {
    "prop-types": "15.x",
    "react": "^15.0.0 || ^16.0.0",
    "react-dom": "^15.0.0 || ^16.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/plugin-proposal-class-properties": "^7.8.3",
    "@babel/preset-env": "^7.8.4",
    "@babel/preset-react": "^7.8.3",
    "@babel/preset-TypeScript": "^7.8.3",
    "@svgr/rollup": "^2.4.1",
    "awesome-TypeScript-loader": "^5.2.1",
    "babel-loader": "^8.0.6",
    "babel-plugin-import": "^1.12.0",
    "babel-plugin-require-context-hook": "^1.0.0",
    "babel-runtime": "^6.26.0",
    "cross-env": "^5.2.1",
    "declaration-bundler-webpack-plugin": "^1.0.3",
    "eslint": "^6.8.0",
    "eslint-config-airbnb": "^18.0.1",
    "eslint-plugin-import": "^2.20.1",
    "eslint-plugin-jsx-a11y": "^6.2.3",
    "eslint-plugin-react": "^7.18.3",
    "eslint-plugin-react-hooks": "^1.7.0",
    "markdown-loader": "^5.1.0",
    "mini-css-extract-plugin": "^0.7.0",
    "postcss-loader": "^2.1.6",
    "prettier": "^1.19.1",
    "react": "^16.12.0",
    "rollup": "^1.27.1",
    "rollup-plugin-babel": "^4.3.3",
    "rollup-plugin-commonjs": "^10.1.0",
    "rollup-plugin-node-resolve": "^5.2.0",
    "rollup-plugin-peer-deps-external": "^2.2.0",
    "rollup-plugin-postcss": "^2.0.3",
    "rollup-plugin-TypeScript2": "^0.25.2",
    "rollup-plugin-url": "^3.0.0",
    "sass-loader": "^7.1.0",
    "ts-loader": "^2.3.7",
    "ts-loader-decleration": "^0.10.4",
    "TypeScript": "^3.7.2",
    "url-loader": "^2.0.1"
  },
  "files": [
    "dist",
    "fonts",
    "style"
  ]
}

私の.eslintrc.js:

module.exports = {
  env: {
    browser: true,
    es6: true,
  },
  extends: [
    'plugin:react/recommended',
    'airbnb',
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
  },
  parser: '@TypeScript-eslint/parser',
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 2018,
    sourceType: 'module',
  },
  plugins: [
    'react',
    '@TypeScript-eslint',
  ],
  rules: {
  },
};

誰かが私を助けてくれますか?

4
Ihor Lavs

最後に、問題を修正しました。 package-lock.fileを削除し、すべての依存関係を再インストールしました。問題はなくなった。

0
Ihor Lavs

Eslintがノードモジュールで実行されているため、これはおそらく問題です。 eslintコマンドに--ignore-pattern node_modulesを追加してみてください

0
Charles L.