Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest eslint-config-prettier v8.0.0 breaks end.js #13

Closed
softwarespot opened this issue Feb 21, 2021 · 3 comments
Closed

Latest eslint-config-prettier v8.0.0 breaks end.js #13

softwarespot opened this issue Feb 21, 2021 · 3 comments

Comments

@softwarespot
Copy link

There seems to be an issue with the latest eslint-config-prettier v8.0.0 which is breaking this configuration. The previous version v7.2.0 was OK

Reproducer

  • Create a new directory
  • Save the files below
  • Open the index.js and it should show errors - OK
  • Now change eslint-config-prettier to v8.0.0 and npm i
  • Open the index.js and it should show errors - Not OK

The error I am seeing at least, with the latest version in VSCode and the "Ouput" section is:

[Info  - 18:02:36] Failed to load config "prettier/standard" to extend from. Referenced from: /home/me/testing/node_modules/eslint-config-prettier-standard/end.js 

Hopefully this gives you some indication of the problem

================================

Node.js

nvm use 14.15.5 

Files
package.json

{
  "name": "debugging",
  "devDependencies": {
    "eslint": "^7.20.0",
    "eslint-config-prettier": "^7.2.0",
    "eslint-config-prettier-standard": "^4.0.0",
    "eslint-config-standard": "^16.0.2",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-promise": "^4.3.1",
    "prettier": "2.2.1",
    "prettier-config-standard": "^4.0.0"
  }
}

.eslintrc.json

{
    "extends": [
        "prettier-standard"
    ],
    "plugins": [],
    "env": {
        "browser": true
    },
    "rules": {
        "prettier/prettier": [
            "error",
            {
                "printWidth": 120,
                "singleQuote": true,
                "tabWidth": 4
            }
        ]
    }
}

index.js

console.log("Testing");
@npetruzzelli
Copy link
Owner

@softwarespot - Thanks for reporting this quickly.

v8 was released yesterday, and with it, they've changed a few things.

One of the changes is the following:

ℹ️ Note: You might find guides on the Internet saying you should also extend stuff like "prettier/react". Since version 8.0.0 of eslint-config-prettier, all you need to extend is "prettier"! That includes all plugins.

So I need to update my config and the README with that in mind.

Additionally, eslint-plugin-standard itself is deprecated, which you can read more about in eslint-plugin-standard#1316. The short version is, there is no longer a need for JavaScript Standard Style to have a plugin with special rules for JSS. The one rule that they would have needed has been adopted by eslint-plugin-node

I originally "caught" this with the release of eslint-config-prettier-standard@4.0.0, but I failed to remove the reference to prettier/standard from:

extends: ['prettier', 'prettier/standard']

This failed silently since eslint-config-prettier still had a file called standard.js. Version 8 removed this file, causing the config to now fail loudly. Its on me for missing the bit in end.js, but fortunately it should be a quick and simple fix.

This change may also mean that it is time for a change in how eslint-config-prettier-standard itself is structured, but that is a breaking change, so I'll keep that for a new major version and patch this for now. I'll try to get it done soon.

@npetruzzelli
Copy link
Owner

npetruzzelli commented Feb 22, 2021

Patch 4.0.1 has been released, I've tested it and it appears to be working on my end, please reply and confirm whether or not it fixes the problem for you.

{
  "private": true,
  "scripts": {
    "lint": "eslint",
  },
  "devDependencies": {
    "eslint": "^7.20.0",
    "eslint-config-prettier": "^8.0.0",
    "eslint-config-prettier-standard": "^4.0.1",
    "eslint-config-standard": "^16.0.2",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-prettier": "^3.3.1",
    "eslint-plugin-promise": "^4.3.1",
    "prettier": "2.2.1",
    "prettier-config-standard": "^4.0.0"
  },
  "eslintConfig": {
    "extends": [
      "prettier-standard"
    ]
  }
}

(README updates will come soon once I have time to dive deeper into documentation for v.8)

@softwarespot
Copy link
Author

softwarespot commented Feb 22, 2021

Awesome service. I have verified your solution works and just want to say thanks for quickly fixing and a detailed explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants