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

Lookbehind in regular expressions not reported even though it is not supported on Safari browser #555

Open
Zhouqchao opened this issue Mar 23, 2023 · 2 comments

Comments

@Zhouqchao
Copy link

Zhouqchao commented Mar 23, 2023

lookbehind in regular expresions should report an error because it is not supported on Safari browser.
image

here is my browserslist config:

{
	"browserslist": [
	    "last 2 years",
	    "not dead"
	  ]
}

and here is my eslint config:

module.exports = {
	root: true,
	env: {
	  browser: true,
	},
	plugins: ['compat'],
	settings: {
	  lintAllEsApis: true,
	},
	extends: ['plugin:compat/recommended'],
	parserOptions: {
	  ecmaVersion: 2018,
	  parser: 'babel-eslint',
	  sourceType: 'module',
	},
	rules: {
	  'compat/compat': 'error',
	}
}

I do get an error for OffscreenCanvas not being supported on Safari 14, so it looks like I have set up the plugin correctly.
image

@MrHBS
Copy link

MrHBS commented Jul 21, 2023

I was literally about to install this plugin to lint for this use case. This is a bummer

@RobinBlomberg
Copy link

RobinBlomberg commented Jun 24, 2024

For a basic workaround (that unfortunately doesn't take Browserslist settings into account):

rules: {
  "no-restricted-syntax": [
    "error",
    {
      selector: "Literal[regex][raw=/\\(\\?<[=!]/]",
      message:
        "Lookbehind assertions are not supported in some browsers (e.g. Safari 16.3).",
    },
  ],
},

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

No branches or pull requests

3 participants