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

TypeError: Invalid Version: null #284

Closed
LouiseReid opened this issue Jan 21, 2020 · 8 comments · Fixed by #285
Closed

TypeError: Invalid Version: null #284

LouiseReid opened this issue Jan 21, 2020 · 8 comments · Fixed by #285

Comments

@LouiseReid
Copy link

I'm getting the above error when trying to run eslint with this plugin.

.eslintrc

{
  "env": {
    "browser": true,
    "es6": true,
    "jest": true
  },
  "extends": ["airbnb", "prettier", "prettier/react"],
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "plugins": ["react", "prettier", "react-hooks", "compat"],
  "parser": "babel-eslint",
  "rules": {
    "prettier/prettier": "error",
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn",
    "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
    "import/prefer-default-export": 0,
    "no-shadow": 0,
    "react/forbid-prop-types": 0,
    "no-param-reassign": 0,
    "import/no-extraneous-dependencies": [
      "error",
      {
        "devDependencies": [
          "**/*.test.js",
          "**/*.spec.js",
          "**/*.stories.js",
          "**/*.story.js",
          "setupTests.js"
        ]
      }
    ],
    "react/require-default-props": 0,
    "strict": 0,
    "compat/compat": "warn"
  }
}

package.json

"scripts: {
    "lint": "eslint \"./src/**/*.{js,jsx}\"",
},
"devDependencies": {
    "eslint": "5.16.0",
    "eslint-config-airbnb": "17.1.1",
    "eslint-config-prettier": "6.1.0",
    "eslint-plugin-compat": "3.1.1",
    "eslint-plugin-import": "2.18.2",
    "eslint-plugin-jsx-a11y": "6.2.3",
    "eslint-plugin-prettier": "3.1.0",
    "eslint-plugin-react": "7.14.3",
    "eslint-plugin-react-hooks": "1.7.0",
}

What might this be coming from?

@eligao
Copy link
Contributor

eligao commented Jan 21, 2020

I met the same problem today and it comes from here: browserslist/browserslist#439

@amilajack
Copy link
Owner

@eligao thanks for spotting this! If you have time can you PR to downgrade the dependency to a working version? Thanks in advance!

@ljharb
Copy link
Collaborator

ljharb commented Jan 21, 2020

It seems like it’s still a bug here - “Safari TP” is a valid option and shouldn’t break the plugin.

@eligao
Copy link
Contributor

eligao commented Jan 21, 2020

@eligao thanks for spotting this! If you have time can you PR to downgrade the dependency to a working version? Thanks in advance!

I've already opened a PR to fix our dependency browserslist here: browserslist/browserslist#438
Might just wait for that PR to pass.
Meanwhile I might also make another PR to address Safari TP compatibility bug.

@eligao
Copy link
Contributor

eligao commented Jan 21, 2020

It seems like it’s still a bug here - “Safari TP” is a valid option and shouldn’t break the plugin.

You're right. It's because TP was processed as a semantic version here, while it isn't. This generates an invalid version null and broke the lint.

@eligao
Copy link
Contributor

eligao commented Jan 21, 2020

It seems like it’s still a bug here - “Safari TP” is a valid option and shouldn’t break the plugin.

A quick question: any suggestions to integrate TP into the semver comparisons? I don't really want to hardcode it.

@ljharb
Copy link
Collaborator

ljharb commented Jan 21, 2020

Technically it’s a prerelease of the next version i think, but it’s special enough that i think it’s fine to hardcode.

@eligao
Copy link
Contributor

eligao commented Jan 21, 2020

Technically it’s a prerelease of the next version i think, but it’s special enough that i think it’s fine to hardcode.

Yes, it should be something like Safari 13.1-TP for now. Just couldn't find somewhere to reliably derive that 13.1 without installing Safari TP myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants