skip to Main Content

I have this error, I got this error on compilation process:

"@typescript-eslint" was conflicted between ".eslintrc.js" and ".eslintrc.js » @react-native-community/eslint-config#overrides[1]"

My eslint configuration is:

module.exports = {
  root: true,
  extends: ['@react-native-community', 'plugin:storybook/recommended'],
  parser: '@typescript-eslint/parser',
  plugins: ['@typescript-eslint'],
  overrides: [{
    files: ['*.ts', '*.tsx'],
    rules: {
      '@typescript-eslint/no-shadow': ['error'],
      'no-shadow': 'off',
      'no-undef': 'off'
    }
  }]
};

Any solutions/fixes?

2

Answers


  1. Chosen as BEST ANSWER

    Finally, I fixed this error:

    Check your project's dependencies and make sure that you don't have conflicting versions of the eslint-plugin-react package installed. You can do this by running the following command in your project directory:

    npm ls eslint-plugin-react
    

    This will show you a tree of your project's dependencies, including any conflicting versions of the eslint-plugin-react package. If you see any conflicts, you can try running npm dedupe to resolve them.


    1. If you are not using React Native, you may not need the @react-native-community/eslint-config. You can remove it from your project by running:
        npm uninstall @react-native-community/eslint-config
    
    1. If you do need both configurations, you can merge them into a single configuration object in your .eslintrc.js file by:
        module.exports = {
          extends: [
            '@react-native-community',
            'plugin:@typescript-eslint/recommended',
          ],
          plugins: ['@typescript-eslint'],
          rules: {
            // Add any additional rules here
          },
        };
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search