How do I use the CLI to fix all files?
question: How to execute prettier with yarn?
yarnpkg - ESLint with Prettier issues on Yarn global install - Stack Overflow
yarn run prettier throws an error, but directly invoking prettier works
I just ran into the same issue myself. It appears to be an issue with the newest version of eslint, mine was 4.2.0. To fix this I:
run: Yarn remove eslint
or
run: npm uninstall eslint
this will remove it locally, then
run: yarn add [email protected]
or run: npm install [email protected]
run: eslint **/*.{js,jsx} --quiet
my paths may be set up different so do this in conjunction with "Daydream Nation" answer you should get it working. I'm not sure what version os eslint Brian is using and I'm sure if you pull down one of his most recent repo's it will tell you but hopefully this will guide you in the right direction.
I was missing several packages. Here is how I fixed it.
npm i eslint-config-prettier -save-dev
npm i eslint-config-standard -save-dev
npm i eslint-plugin-node -save-dev
npm i eslint-plugin-promise -save-dev
Here is my package.json
{
"name": "rpp-react",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"babel-runtime": "^6.20.0",
"meteor-node-stubs": "~0.2.4",
"prop-types": "^15.5.10",
"react": "^15.6.1",
"react-addons-pure-render-mixin": "^15.6.0",
"react-dom": "^15.6.1",
"react-tap-event-plugin": "^2.0.1"
},
"devDependencies": {
"babel-eslint": "^8.0.0",
"eslint": "^4.7.2",
"eslint-config-prettier": "^2.5.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-flowtype": "^2.35.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-react": "^7.3.0",
"eslint-plugin-standard": "^3.0.1",
"prettier": "^1.7.0"
}
}
Here is my .eslintrc.json
{
"extends": [
"standard",
"plugin:flowtype/recommended",
"plugin:react/recommended",
"prettier",
"prettier/flowtype",
"prettier/react",
"prettier/standard"
],
"plugins": [
"flowtype",
"react",
"prettier",
"standard"
],
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"es6": true,
"node": true
},
"rules": {
"prettier/prettier": "error"
}
}
I am using Prettier and ESLint together on a project within IntelliJ and I am little confused on what I need to do to resolve a conflict I am having between the two.
I am getting an error that looks like this:
ESLint: Replace \··········` with `····················`(prettier/prettier)`
If I try and run Ctrl-Alt-L which runs Prettier within IntelliJ then it will reformat the file and I get the error above.
I am not sure which one should be preferred and how to go about making sure they don't conflict. Currently If i leave the active window the files will proactively reformat based on the ESlint settings.
My ESLint config file looks like this:
require('@rushstack/eslint-patch/modern-module-resolution');
module.exports = {
root: true,
extends: ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/eslint-config-prettier'],
parserOptions: {
ecmaVersion: 'latest',
useTabs: false,
},
rules: {
'vue/multi-word-component-names': 'off',
'vue/no-reserved-component-names': 'off',
},
};
And my .prettierrc looks like this:
{
"tabWidth": 4,
"printWidth": 250,
"jsxBracketSameLine": true,
"singleQuote": true,
"trailingComma": "es5"
}Could someone give me some advice on how to properly configure these two? Thanks!