web-dev-qa-db-fra.com

Erreur de configuration Eslint. ESLint n'a pas pu trouver la configuration "dev" à partir de laquelle étendre

J'essaie de configurer eslint au projet TS react, mais je rencontre err:

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

mon package.json ressemble à:

{
  "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"
  ]
}

mon .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: {
  },
};

Est-ce que quelqu'un peut m'aider?

4
Ihor Lavs

Enfin, j'ai résolu le problème. J'ai supprimé mon package-lock.file et réinstaller toutes les dépendances. Le problème est parti.

0
Ihor Lavs

C'est probablement un problème car eslint s'exécute sur les modules de nœuds. Essayez d'ajouter --ignore-pattern node_modules à votre commande eslint

0
Charles L.