`eslint --fix` generates the `multiple spaces` error itself

Viewed 140

I have a strange issue since today. In a ReactNative-Project, I do have setup eslint & prettier.

My config:

// package.json
"eslint": "^8.12.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-native": "^4.0.0",
"prettier-eslint": "^13.0.0",
// .prettierrc.js
module.exports = {
  arrowParens: 'always',
  bracketSpacing: false,
  singleQuote: true,
  trailingComma: 'all'
};
// eslintrc.json
{
  "parser": "@babel/eslint-parser",
  "env": {
    "browser": true,
    "react-native/react-native": true,
    "es6": true,
    "node": true
  },
  "extends": [
    "@react-native-community",
    "plugin:react/recommended",
    "airbnb-base",
    "prettier/react"
  ],
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "plugins": [
    "react",
    "react-native",
    "prettier"
  ],
  "rules": {
    "react/jsx-uses-react": "off",
    "react/react-in-jsx-scope": "off",
    "object-curly-newline": 0,
    "max-len": [
      "error",
      {
        "code": 100,
        "comments": 150,
        "ignoreTrailingComments": true,
        "ignoreUrls": true
      }
    ],
    "indent": [
      "warn",
      2
    ],
    "linebreak-style": [
      "error",
      "unix"
    ],
    "quotes": [
      2,
      "single",
      {
        "avoidEscape": true,
        "allowTemplateLiterals": true
      }
    ],
    "semi": [
      "error",
      "always"
    ],
    "react-native/no-unused-styles": 2,
    "react-native/split-platform-components": 2,
    "react-native/no-inline-styles": 2,
    "react-native/no-color-literals": 2,
    "react-native/no-raw-text": 2,
    "prettier/prettier": [
      "warn",
      {
        "endOfLine": "auto",
        "bracketSpacing": true
      }
    ]
  }
}

The Issue

If I run eslint . --fix for my project, it turn full valid files into files with error by it's own!

The code which will be accidentally destroyed by eslint are the following files (in different files):

const { type, version, copyright, licenseSpecs, licenseText } =      licenseList[libraryName];

const finalGeneratedLicense =    normalizeNodeModulesLicenses(nodeModulesLicenses);

const { title, drawerLabel, drawerIcon } =            descriptors[route.key].options;

resource =        config.supportedLocales[language].translationFileLoader()[namespace];

Do you see the trailing whitespaces after = ?! I could fix them manually, but as I run eslint . --fix again, it will again create those whitespaces.

What might the reason for this?

0 Answers
Related