davidjbradshaw / eslint-config-auto

Automatically configure ESLint based on project dependencies
402 stars 13 forks source link

Allow prettier to be run directly #11

Closed Juice10 closed 3 years ago

Juice10 commented 3 years ago

When installing eslint-config-prettier but not eslint-plugin-prettier the eslint command returns the following error:

Oops! Something went wrong! :(

eslint-config-auto could not find the following package

  eslint-plugin-prettier

To install the missing package, please run the following command:

npm install eslint-plugin-prettier@latest --save-dev

It would be great if this would work without the plugin version of prettier as recommended by the prettier docs.

My package.json dependencies:

  "devDependencies": {
    "@types/chai": "^4.2.14",
    "@types/mocha": "^8.0.3",
    "@types/node": "^14.14.2",
    "@types/node-fetch": "^2.5.7",
    "@types/test-console": "^1.1.0",
    "@typescript-eslint/eslint-plugin": "^4.13.0",
    "@typescript-eslint/parser": "^4.13.0",
    "babel-eslint": "^10.1.0",
    "chai": "^4.2.0",
    "eslint": "^7.17.0",
    "eslint-config-adjunct": "^4.9.0",
    "eslint-config-airbnb-base": "^14.2.0",
    "eslint-config-airbnb-typescript": "^12.3.1",
    "eslint-config-auto": "^0.6.6",
    "eslint-config-prettier": "^7.2.0",
    "eslint-plugin-array-func": "^3.1.7",
    "eslint-plugin-chai-expect": "^2.2.0",
    "eslint-plugin-chai-friendly": "^0.6.0",
    "eslint-plugin-eslint-comments": "^3.2.0",
    "eslint-plugin-html": "^6.1.1",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-json": "^2.1.2",
    "eslint-plugin-markdown": "^1.0.2",
    "eslint-plugin-mocha": "^8.0.0",
    "eslint-plugin-mocha-cleanup": "^1.9.1",
    "eslint-plugin-no-constructor-bind": "^2.0.4",
    "eslint-plugin-no-secrets": "^0.6.8",
    "eslint-plugin-no-unsanitized": "^3.1.4",
    "eslint-plugin-no-use-extend-native": "^0.5.0",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-optimize-regex": "^1.2.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-scanjs-rules": "^0.2.1",
    "eslint-plugin-security": "^1.4.0",
    "eslint-plugin-simple-import-sort": "^7.0.0",
    "eslint-plugin-sonarjs": "^0.5.0",
    "eslint-plugin-switch-case": "^1.1.2",
    "eslint-plugin-unicorn": "^27.0.0",
    "gts": "^3.0.1",
    "mocha": "^8.2.0",
    "nock": "^13.0.5",
    "nyc": "^15.1.0",
    "prettier": "2.2.1",
    "release-it": "^14.2.2",
    "request": "^2.88.2",
    "test-console": "^1.1.0",
    "ts-node": "^9.0.0",
    "tslint-config-prettier": "^1.18.0",
    "typescript": "^4.0.3"
  },
  "dependencies": {
    "@types/base-64": "^0.1.3",
    "@types/jsdom": "^16.2.6",
    "@types/spark-md5": "^3.0.2",
    "base-64": "^1.0.0",
    "isomorphic-unfetch": "^3.1.0",
    "jsdom": "^16.4.0",
    "postcss": "^8.2.4",
    "postcss-import-url": "^6.0.0",
    "postcss-js": "^3.0.3",
    "postcss-url": "^10.1.1",
    "spark-md5": "^3.0.1"
  }
davidjbradshaw commented 3 years ago

That seems a fair idea, only use the plugin if it is detected. Fancy making a PR?

Juice10 commented 3 years ago

That seems a fair idea, only use the plugin if it is detected. Fancy making a PR?

@davidjbradshaw Yes I'd be happy to! Since I'm new to this project I've been searching through the code to try and figure out where I should make the change and I got a little stuck. Any chance you could give me some pointers. I'd be happy to take it from there!

davidjbradshaw commented 3 years ago

Ah yes, it can be found here in eslint-config-adjunct

https://github.com/davidjbradshaw/eslint-config-adjunct/blob/c22e4623378235cd3971c9c5a11fbd6ad5c24ca1/configs.js#L65

davidjbradshaw commented 3 years ago

Just disabled eslint-plugin-prettier due to this bug

Juice10 commented 3 years ago

Thank you @davidjbradshaw! Apologies for not making the time to do it myself yet. Thanks again for your amazing work making everyone’s eslint configs manageable again!