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

Some js methods not supported on IE 11 #445

Open
teepobharu opened this issue Jan 5, 2021 · 4 comments
Open

Some js methods not supported on IE 11 #445

teepobharu opened this issue Jan 5, 2021 · 4 comments

Comments

@teepobharu
Copy link

teepobharu commented Jan 5, 2021

Problem

  • It seems like support for IE 11 does not work on some function such as
    [].includes() , "strsd".includes()
  • only fetch works in this case

How to solve this problem and are their workarounds ?
Thanks 👍

image

image

image

Code

packge.json

{
  "name": "testproject",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "eslint": "^7.17.0",
    "eslint-plugin-compat": "^3.9.0"
  }
}

test.js

// IE 11 No Support

Array.includes();

Array.from(Set(1,2,3));

[3,2,1].includes(1);

"asdasd".includes("a");

fetch('asdasd');

.eslintrc.js

module.exports = {
    "env": {
        "browser": true,
        "es2020": true
    },
    "settings": {
        targets: [
            "ie >= 11"
        ],
        polyfills: [],
    },
    "extends": [ ],
    "plugins": [ "compat" ],
    "rules": {
        "compat/compat": "error"
    }
};
@TomPradat
Copy link

Object.assign is not detected either. Any news about this ?

@kaysonwu
Copy link

I have the same issue.

@HansBrende
Copy link

HansBrende commented Jan 11, 2022

@teepobharu @TomPradat

Half of this issue can be solved by applying #507: just add "lintAllEsApis": true to your settings. Fixes:

new Array().includes()  // errors with: ESLint: Array.includes() is not supported in IE 11(compat/compat)
new String().includes()  // errors with: ESLint: String.includes() is not supported in IE 11(compat/compat)
Array.from()  // errors with: ESLint: Array.from() is not supported in IE 11(compat/compat)
Object.assign()  // errors with: ESLint: Object.assign() is not supported in IE 11(compat/compat)

The other half of this issue (calling methods from literals) still appears to be broken:

"abc".includes()  // false negative
[].includes() // false negative

@HansBrende
Copy link

@teepobharu given my above ^ comment I would suggest renaming this issue to "String and array literals not supported".

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

4 participants