willhoney7 / eslint-plugin-import-helpers

ESLint plugin to help enforce a configurable order for import statements
288 stars 17 forks source link

It's doens't works with Prettier #23

Closed HigorAlves closed 4 years ago

HigorAlves commented 4 years ago

When we have prettier on the project, import helpers doens't works, i tried many times to make this work but have no success.

Anyone could help?

{
    "env": {
        "browser": true,
        "es6": true
    },
    "parser": "@typescript-eslint/parser",
    "plugins": [
        "eslint-plugin-import-helpers",
        "react-hooks",
        "react/recommended",
        "@typescript-eslint/recommended",
        "jsx-a11y/recommended",
        "prettier/recommended"
    ],
    "extends": ["prettier/@typescript-eslint"],
    "parserOptions": {
        "ecmaVersion": 2018,
        "sourceType": "module",
        "ecmaFeatures": {
            "jsx": true
        }
    },
    "settings": {
        "react": {
            "version": "detect"
        }
    },
    "rules": {
        "import-helpers/order-imports": [
            "error",
            {
                "newlinesBetween": "always", // new line between groups
                "groups": ["/ˆreact/", "module", ["parent", "sibling", "index"]],
                "alphabetize": { "order": "asc", "ignoreCase": true }
            }
        ],
        "@typescript-eslint/explicit-function-return-type": 0,
        "react/display-name": 0,
        "jsx-a11y/anchor-is-valid": 0,
        "react-hooks/rules-of-hooks": "error",
        "react-hooks/exhaustive-deps": "warn"
    }
}
RaphaelOliveiraMoura commented 4 years ago

I fix the problem of auto fix on save with this settings inside the VSCode settings.json :

"editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
}
willhoney7 commented 4 years ago

@HigorAlves apologies for the slow response on this one. I hope @RaphaelOliveiraMoura's response is helpful.

I'd like to add some documentation to the readme on how to get this to work in conjunction with prettier (especially with VSCode). I'll just say it works as that's the only way I've used it. PRs are welcome (you'll probably get it done faster than me).

HigorAlves commented 4 years ago

@RaphaelOliveiraMoura its work for me, and I reinstall some plugins and remove others... Thanks guys!

igorbpf commented 4 years ago

Hello, guys!

Still not working for me. Any other workaround?

fnoquiq commented 3 years ago

@RaphaelOliveiraMoura works for me to

"editor.codeActionsOnSave": {
   "source.organizeImports": true, // i removed it
   "source.fixAll.eslint": true
}