Skip to content
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

Bug: Fix objects must not be overlapped in a report. #11

Closed
2 tasks done
Stringsaeed opened this issue Jun 9, 2023 · 4 comments
Closed
2 tasks done

Bug: Fix objects must not be overlapped in a report. #11

Stringsaeed opened this issue Jun 9, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@Stringsaeed
Copy link

Describe the bug

When running this command

eslint . --ext .js,.jsx,.ts,.tsx --fix --cache

I get this error

Oops! Something went wrong! :(

ESLint: 8.41.0


AssertionError [ERR_ASSERTION]: Fix objects must not be overlapped in a report.
    at mergeFixes (PROJECT_PATH/node_modules/eslint/lib/linter/report-translator.js:152:9)
    at normalizeFixes (PROJECT_PATH/node_modules/eslint/lib/linter/report-translator.js:182:16)
    at PROJECT_PATH/node_modules/eslint/lib/linter/report-translator.js:349:49
    at Object.report (PROJECT_PATH/node_modules/eslint/lib/linter/linter.js:1021:41)
    at PROJECT_PATH/node_modules/eslint-plugin-perfectionist/dist/index.js:3:217
    at I (PROJECT_PATH/node_modules/eslint-plugin-perfectionist/dist/index.js:1:2481)
    at PROJECT_PATH/node_modules/eslint-plugin-perfectionist/dist/index.js:3:143
    at Array.forEach (<anonymous>)
    at Program:exit (PROJECT_PATH/node_modules/eslint-plugin-perfectionist/dist/index.js:3:131)
    at ruleErrorHandler (PROJECT_PATH/node_modules/eslint/lib/linter/linter.js:1050:28)
    at PROJECT_PATH/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (PROJECT_PATH/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (PROJECT_PATH/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (PROJECT_PATH/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.leaveNode (PROJECT_PATH/node_modules/eslint/lib/linter/node-event-generator.js:349:14)
    at CodePathAnalyzer.leaveNode (PROJECT_PATH/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:816:23)
    at PROJECT_PATH/node_modules/eslint/lib/linter/linter.js:1087:32
    at Array.forEach (<anonymous>)
    at runRules (PROJECT_PATH/node_modules/eslint/lib/linter/linter.js:1080:15)
    at Linter._verifyWithoutProcessors (PROJECT_PATH/node_modules/eslint/lib/linter/linter.js:1330:31)
    at Linter._verifyWithConfigArray (PROJECT_PATH/node_modules/eslint/lib/linter/linter.js:1706:21)
    at Linter.verify (PROJECT_PATH/node_modules/eslint/lib/linter/linter.js:1412:65)
    at Linter.verifyAndFix (PROJECT_PATH/node_modules/eslint/lib/linter/linter.js:1967:29)
    at verifyText (PROJECT_PATH/node_modules/eslint/lib/cli-engine/cli-engine.js:245:48)
    at CLIEngine.executeOnFiles (PROJECT_PATH/node_modules/eslint/lib/cli-engine/cli-engine.js:825:28)
    at ESLint.lintFiles (PROJECT_PATH/node_modules/eslint/lib/eslint/eslint.js:551:23)
    at Object.execute (PROJECT_PATH/node_modules/eslint/lib/cli.js:391:36)
    at async main (PROJECT_PATH/node_modules/eslint/bin/eslint.js:135:24)

Code example

{
  "extends": ["@callstack", "plugin:perfectionist/recommended-line-length"],
  "plugins": ["perfectionist"],

  "settings": {
    "import/parsers": {
      "@typescript-eslint/parser": [".ts", ".tsx"]
    },
    "import/resolver": {
      "typescript": {},
      "babel-module": {}
    }
  },
  "rules": {
    "perfectionist/sort-objects": [
      "error",
      {
        "type": "line-length",
        "order": "desc"
      }
    ],
    "import/newline-after-import": ["error", { "count": 1 }],
    "react-native/no-raw-text": [
      "off",
      {
        "skip": ["Heading", "Body", "Title", "Button"]
      }
    ],
    "react-native/no-color-literals": "off"
  },
  "overrides": [
    {
      "files": ["*.stories.tsx", "test/**", "*.config.js", "*.config.ts"],
      "rules": {
        "import/no-default-export": "off",
        "import/no-extraneous-dependencies": "off"
      }
    },
    {
      "files": ["test/**"],
      "env": {
        "jest": true,
        "jest/globals": true
      }
    }
  ]
}

ESLint version

v8.41.0

ESLint Plugin Perfectionist version

v1.1.0

Additional comments

{
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@callstack/eslint-config": "^13.0.2",
    "@testing-library/jest-native": "^5.4.2",
    "@testing-library/react-native": "^12.1.2",
    "@types/jest": "^29.2.1",
    "@types/lodash.debounce": "^4.0.7",
    "@types/react": "~18.0.14",
    "babel-plugin-module-resolver": "^5.0.0",
    "eslint": "^8.41.0",
    "eslint-import-resolver-babel-module": "^5.3.2",
    "eslint-import-resolver-typescript": "^3.5.5",
    "eslint-plugin-import": "^2.27.5",
    "eslint-plugin-jest": "^27.2.1",
    "eslint-plugin-perfectionist": "^1.1.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint_d": "^12.2.1",
    "jest": "^29.2.1",
    "jest-expo": "^48.0.2",
    "prettier": "^2.8.8",
    "typescript": "^4.9.4"
  }
}

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@Stringsaeed Stringsaeed added the bug Something isn't working label Jun 9, 2023
@azat-io
Copy link
Owner

azat-io commented Jun 10, 2023

We need to understand which object is the problem.

Can you run ESLint with the --debug flag? Then around the end of the output you will see the file after which ESLint ended with an error.

We need to examine this file and see how this object is different from the others.

@moshie
Copy link

moshie commented Jun 10, 2023

I managed to solve this by removing a comment block we had in our interface:

e.g

interface ActionParams extends UTMSearchParams {
  term: number;
  amount: string;
  channel: string;
  clickId?: string;
  origination_journey: string; // Needs to be snake case
}

@azat-io
Copy link
Owner

azat-io commented Jun 10, 2023

@moshie Nice catch. I will fix this problem soon.

@azat-io
Copy link
Owner

azat-io commented Jun 10, 2023

Fixed in 03e5508

Released in v1.1.2

@azat-io azat-io closed this as completed Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants