Skip to content

Airbnb eslint with prettier-atom not indenting plain text children of JSX tags #1859

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

Closed
mileung opened this issue Jun 27, 2018 · 11 comments
Closed

Comments

@mileung
Copy link

mileung commented Jun 27, 2018

in my package.json:

  "devDependencies": {
    "babel-jest": "23.2.0",
    "babel-preset-react-native": "4.0.0",
    "eslint": "^4.19.1",
    "eslint-config-airbnb": "17.0.0",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.9.1",
    "jest": "23.2.0",
    "react-test-renderer": "16.3.1"
  }
@ljharb
Copy link
Member

ljharb commented Jun 27, 2018

Can you provide output from the command line, to ensure it's not an issue with Atom?

@mileung
Copy link
Author

mileung commented Jun 28, 2018

./node_modules/.bin/eslint src/ yields:

  4:16  error  Component should be written as a pure function  react/prefer-stateless-function
  7:7   error  JSX not allowed in files with extension '.js'   react/jsx-filename-extension

I added some more stuff into my .eslintrc

{
  "extends": [
    "airbnb",
    "react"
  ],
  "plugins": [
    "babel"
  ],
  "rules": {
    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
    "babel/new-cap": 1,
    "babel/no-invalid-this": 1,
    "babel/object-curly-spacing": "always",
    "babel/semi": 1,
    "babel/no-unused-expressions": 1
  }
}

and this problem goes away.

@ljharb
Copy link
Member

ljharb commented Jun 28, 2018

So if you run eslint with --fix on the command line, you don't see this behavior?

@mileung
Copy link
Author

mileung commented Jun 28, 2018

No

@ljharb
Copy link
Member

ljharb commented Jun 28, 2018

Sounds like it's a bug with Atom then. I'll close, but happy to reopen if needed.

@ljharb ljharb closed this as completed Jun 28, 2018
@adalbertoteixeira
Copy link

Hi. I'm getting this error using --fix as well, unfortunately.

It happens when react/jsx-one-expression-per-line is set to "error".

@ljharb
Copy link
Member

ljharb commented Jul 20, 2018

@adalbertoteixeira with what code do you see what error on the command line?

This might be better filed on eslint-plugin-react.

@adalbertoteixeira
Copy link

adalbertoteixeira commented Jul 20, 2018

I was seeing the wrong indentation (what @mileung shows on his issue) when running eslint --fix as well, not just when using Atom.

He says he doesn't get the issue when running --fix, but I do.

And I'm sorry, but isn't this eslint-plugin-react?

@ljharb
Copy link
Member

ljharb commented Jul 20, 2018

oh lol my bad, i got confused.

I’ll reopen.

@ljharb ljharb reopened this Jul 20, 2018
@alexzherdev
Copy link
Contributor

Isn't this the same as #1775 ?

@ljharb
Copy link
Member

ljharb commented Jul 20, 2018

Looks like it, thanks.

@ljharb ljharb closed this as completed Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants