Code Monkey home page Code Monkey logo

Comments (6)

Torniojaws avatar Torniojaws commented on June 7, 2024 3

Also getting this issue with eslint 8.11.0, prettier 2.2.1 and prettier-atom 0.60.1 and using TypeScript (in case it matters).

However, if I uncheck ESLint Integration in prettier-atom config, then it works and the prettier rules take effect normally.

from prettier-atom.

robwise avatar robwise commented on June 7, 2024

@M1CK431 are you using prettier-eslint with prettier-atom? This should already be working fine if you are not. If you are, the error you are getting is because prettier-eslint is not eslint 8 compatible (yet). See: prettier/prettier-eslint#656

I would highly recommend, however, that you drop using prettier-eslint in your projects and instead use https://github.com/prettier/eslint-config-prettier and https://github.com/prettier/eslint-plugin-prettier to just have eslint run your formatting.

from prettier-atom.

M1CK431 avatar M1CK431 commented on June 7, 2024

Hi @robwise, sorry for my late reply.

Here is my dev dependencies (from package.json):

{
  "devDependencies": {
    "@babel/core": "^7.12.16",
    "@babel/eslint-parser": "^7.12.16",
    "@vue/cli-plugin-babel": "~5.0.0-rc.1",
    "@vue/cli-plugin-eslint": "~5.0.0-rc.1",
    "@vue/cli-plugin-router": "~5.0.0-rc.1",
    "@vue/cli-service": "~5.0.0-rc.1",
    "autoprefixer": "^10.4.0",
    "eslint": "^8.10.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-vue": "^8.0.3",
    "naive-ui": "^2.21.4",
    "postcss": "^8.4.4",
    "prettier": "^2.4.1",
    "tailwindcss": "^3.0.0"
  }
}

As you can see, there isn't prettier-eslint installed and even I have check in my node-modules directory (just in case of indirect dependency) and I haven't found any prettier-eslint entry:

ls -l node_modules/prettier-eslint
ls: cannot access 'node_modules/prettier-eslint': No such file or directory

In addition, eslint-config-prettier and eslint-plugin-prettier are both already installed.

In Atom, I'm using prettier-atom v0.60.1 with the following settings:
image

EDIT: here is my .eslintrc.js

module.exports = {
  root: true,
  env: { node: true },
  extends: [
    "plugin:vue/vue3-essential",
    "eslint:recommended",
    "plugin:prettier/recommended"
  ],
  parserOptions: { parser: "@babel/eslint-parser" },
  rules: {
    "prettier/prettier": [
      "warn",
      { trailingComma: "none", arrowParens: "avoid" }
    ],
    "vue/multi-word-component-names": "off",
    "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
    "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off"
  }
};

Any idea? 🥺

from prettier-atom.

M1CK431 avatar M1CK431 commented on June 7, 2024

up! @robwise 🙏 🙃

from prettier-atom.

dlindahl avatar dlindahl commented on June 7, 2024

Sharing in case it helps. I created a brand new folder with nothing in it and ran npm init, pressing Enter to select all of the defaults.

I then added a prettier.config.js with the following:

module.exports = {
  arrowParens: 'always',
  semi: false,
  singleQuote: true,
  trailingComma: 'es5',
}

Making any modification that would trigger one of the formatting rules would cause prettier-atom to re-format the file as expected.

I then added a .eslintrc.js file with the following:

module.exports = {
  extends: []
}

Making simple formatting changes to this file caused prettier-atom to re-format the file as expected.

I then added eslint via npm add -D eslint which caused npm to install ESLint ^8.17.0.

I then attempted to make a formatting change to both of the above files and each time was presented with a prettier-atom failed: CLIEngine is not a constructor error:

Screen Shot 2022-06-07 at 9 41 35 AM

Downgrading eslint to v7.32.0 and restarting Atom seems to "fix" the issue in that formatting is run as expecting along with no error message.

This is with prettier-atom v0.60.1 which appears to install eslint v5? 🤷

[email protected] ~/.atom/packages/prettier-atom
└─┬ @lewisl9029/[email protected]
  └── [email protected] 

from prettier-atom.

shellscape avatar shellscape commented on June 7, 2024

@robwise premature close. prettier-eslint was updated and this issue still occurs.

from prettier-atom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.