prettier / eslint-config-prettier

Turns off all rules that are unnecessary or might conflict with Prettier.
MIT License
5.39k stars 255 forks source link

Help with troubleshooting #196

Closed leonardofaria closed 3 years ago

leonardofaria commented 3 years ago

Hi!

Thanks for this project, it helps a lot keeping codebases tidy :)

I am moving a project from eslint-config-prettier 6.11 to 8.3 and I am getting lots of changes. This used to be fine:

const {
    items,
    isLoading,
  } = myFunctionCall(flowId);
const someVar = new PromotionalDealMutation();

Eslint is suggesting replacing X with Y - eslint(pretier/pretier):

const { items, isLoading } =
    myFunctionCall(flowId);
const someVar =
  new PromotionalDealMutation();

What is the best way to identify which role is causing this?

I've tried: yarn eslint path/to/file.js --debug but it didn't help.

I used to use the prettier/react and I've followed the changelog to use only the prettier recommend extends.

The eslint.js file:

module.exports = {
  extends: [
    'airbnb',
    'eslint:recommended',
    'plugin:import/errors',
    'plugin:react/recommended',
    'plugin:jsx-a11y/recommended',
    'plugin:prettier/recommended',
  ],
  plugins: ['react-hooks'],
  rules: {
    'import/extensions': 'off',
    'import/no-dynamic-require': 'off',
    'import/no-extraneous-dependencies': 'off',
    'import/no-named-as-default': 'off',
    'import/no-unresolved': 'off',
    'import/prefer-default-export': 'off',
    'jsx-a11y/label-has-associated-control': 'warn',
    'newline-per-chained-call': 'off',
    'no-confusing-arrow': 'off',
    'no-use-before-define': 'off',
    'prefer-template': 'error',
    'require-yield': 'off',
    'react/forbid-prop-types': 'off',
    'react/jsx-filename-extension': 'off',
    'react/jsx-no-target-blank': 'off',
    'react/jsx-props-no-spreading': 'off',
    'react/jsx-sort-props': [
      'warn',
      {
        callbacksLast: true,
        shorthandFirst: false,
        shorthandLast: true,
        ignoreCase: true,
        noSortAlphabetically: false,
      },
    ],
    'react/require-extension': 'off',
    'react/sort-prop-types': [
      'warn',
      {
        callbacksLast: true,
        ignoreCase: true,
        requiredFirst: false,
        sortShapeProp: true,
      },
    ],
  },
};
lydell commented 3 years ago

Hi! Did you update the Prettier version (or other packages) at the same time? It sounds like you did, and like that’s what causing the changes for you.

leonardofaria commented 3 years ago

Good catch @lydell , moved from 2.1.2 to 2.3.2.

What I captured here is linked to the Format assignments more consistently change introduced in the 2.3.0 version of prettier.

Closing the issue, thank you so much for the guidance