amilajack / eslint-plugin-compat

Check the browser compatibility of your code
MIT License
3.08k stars 106 forks source link

Doesn't Flag LookBehind Regexp on Firefox 77 #382

Open TheSecMaven opened 4 years ago

TheSecMaven commented 4 years ago

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 commented 4 years ago

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

amilajack commented 4 years ago

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

TheSecMaven commented 4 years ago

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

ljharb commented 4 years ago

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

eight04 commented 3 years ago

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

JonasBa commented 2 years ago

@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.

curiousdannii commented 2 years ago

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?