eslint-plugin-compat icon indicating copy to clipboard operation
eslint-plugin-compat copied to clipboard

Doesn't Flag LookBehind Regexp on Firefox 77

Open TheSecMaven opened this issue 3 years ago • 7 comments

https://kangax.github.io/compat-table/es2016plus/ shows Firefox 77 isn't compatible with the regexp lookbehind feature, firefox 78 release notes show it added it in that release (same table shows and confirms the same)

npx browserslist shows firefox 77 is in the defaults, which we use. why wasn't this caught? we had a look behind that passed the linter, and caused our app to fail on Firefox 77.

eslintrc config:

env:
  browser: true
  es6: true
extends:
  - standard
  - plugin:compat/recommended
globals:
  Atomics: readonly
  SharedArrayBuffer: readonly
parser: babel-eslint
parserOptions:
  ecmaFeatures:
    jsx: true
    experimentalObjectRestSpread: true
  ecmaVersion: 2018
  sourceType: module
plugins:
  - react
  - unused-imports
  - compat
  - es
rules: {
  "react/jsx-uses-react" : "error", 
 # "max-len" : ['error',{ code: 120,ignorePattern: 'import.*| .*:.*' }], #these ignore import statements as well as the agent.js file example where we have a dictionary of constants that can be long.
  "react/jsx-uses-vars": "error",
  "compat/compat": "error",
  "no-console": 1,
  "unused-imports/no-unused-imports": 2,
  "unused-imports/no-unused-vars": 1,
  "lines-between-class-members": 2,
  "padding-line-between-statements": ['error',{ blankLine: "always", prev: "function", next: "function" },{ blankLine: "always", prev: "multiline-const", next: "multiline-const" }],
  "import/newline-after-import": ["error"]
}

TheSecMaven avatar Jul 31 '20 21:07 TheSecMaven

we did find - plugin:es/no-2018 has a rule for catching it, but giiven this is the plugin that is supposed to catch browser stuff, we are wondering what we did wrong

TheSecMaven avatar Jul 31 '20 21:07 TheSecMaven

We currently don't lint syntatic ES features. We only lint ES/WebAPIs at the moment.

amilajack avatar Aug 21 '20 01:08 amilajack

anything out there that does? or a roadmap to include support for that? seems like a pretty big gap.

TheSecMaven avatar Aug 25 '20 02:08 TheSecMaven

That's what babel and babel-eslint is for.

ljharb avatar Aug 25 '20 03:08 ljharb

How does babel and babel-eslint solve this issue? Does babel compile look-behind regexp?

eight04 avatar Jul 06 '21 06:07 eight04

@mkkeffeler I went ahead and created a small eslint plugin no-lookahead-lookbehind-regexp to do this as I didnt want to rely on the whole es/no-2018 as it's a bit of an overkill imo. I published it as a beta tag so feel free to test it and drop some feedback. I just noticed that safari actually compile lookahead and lookbehind and it's just the negative lookahead and lookbehind that break, but I will fix that asap.

JonasBa avatar Dec 02 '21 15:12 JonasBa

Look behinds are unsupported in Safari but this plugin didn't show the problem. I don't use Babel, and @babel/eslint-parser doesn't appear to do browser checking like this plugin does.

It's fine for this project to set its scope firmly (though I wish that was explained a little more clearly in the readme). Anyone know of any other packages that can test ES syntax features?

curiousdannii avatar Jan 19 '22 02:01 curiousdannii