Hi,
For some reason eslint and prettier is not working correctly. I have used these same config for all projects, and i just clone from my github when i need to setup a new project, however in this occasion its not working.
App.js:
import React, { Component } from "react";
import logo from "./logo.svg"; // Erros here as its using " instead of ';
import "./App.css";
class App extends Component {
render() {
return (
<div className="App"> // prettier says should be tabs not spaces but it doesnt fix it!
</div>
);
}
}
export default App;
.eslintrc:
{
"extends": "react-app",
"plugins": ["prettier"],
"rules": {
"prettier/prettier": [
"error",
{
"useTabs": true,
"tabWidth": 4,
"singleQuote": true,
"object-curly-spacing": ["error", "always"],
"array-bracket-spacing": ["error", "always"],
"computed-property-spacing": ["error", "always"]
}
],
"comma-dangle": [
"error",
{
"arrays": "never",
"objects": "never",
"imports": "never",
"exports": "never",
"functions": "ignore"
}
]
}
}
package.json:
{
"name": "create-react-app-base",
"version": "0.1.0",
"private": true,
"dependencies": {
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
"eslint-plugin-prettier": "^3.0.1",
"prettier": "^1.6.4",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-scripts": "2.1.1",
"react-test-renderer": "^16.6.3",
"styled-components": "^4.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
As i said, these config settings work on my projects using Vscode on mac, but using vscode on windows prettier rules are not being applied on save.
Is anyone picking this up?
I have this problem as well, it was working fine until a couple of days ago. Using VSCode
mines with .eslintrc.json
VS code Version 1.33.1 (1.33.1)
+1
Also experiencing this issue. Followed this article step by step:
https://dev.to/robertcoopercode/using-eslint-and-prettier-in-a-typescript-project-53jb
I ran into something like this and the problem was a conflict with the @typescript-eslint/indent rule. Turning it off fixed it:
"@typescript-eslint/indent": "off",
Stale issue
I ran into something like this and the problem was a conflict with the
@typescript-eslint/indentrule. Turning it off fixed it:"@typescript-eslint/indent": "off",
This fixed for me
Most helpful comment
Also experiencing this issue. Followed this article step by step:
https://dev.to/robertcoopercode/using-eslint-and-prettier-in-a-typescript-project-53jb