Skip to content

Commit

Permalink
ESLint: Allow IE11-friendly ES6
Browse files Browse the repository at this point in the history
* Set ESLint's environment to ES6 to prevent let/const/Map from triggering errors
* Use eslint-plugin-es5 to disallow most of ES6's other features
  * Relies on a fork (nkt/eslint-plugin-es5#39) to exempt jQuery's find() method
    * The exemption also covers ES6's native find() methods (which are unsupported by IE11...)
* Use eslint-plugin-ie11 to detect unsupported use cases in IE11
* Related to wet-boew#9146
  • Loading branch information
EricDunsworth committed Aug 30, 2021
1 parent 965f825 commit fc65729
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{
"plugins": [
"es5",
"ie11"
],
"extends": [
"eslint:recommended",
"jquery"
"jquery",
"plugin:es5/no-es2015"
],
"env": {
"browser": true,
"es6": true,
"jquery": true
},
"globals": {
Expand All @@ -30,7 +36,13 @@
],
"no-irregular-whitespace": 2,
"no-nested-ternary": 0,
"linebreak-style": 0
"linebreak-style": 0,
"es5/no-block-scoping": ["error", { "const": true, "let": true }],
"es5/no-es6-methods": ["error", { "exceptMethods": ["find"] }],
"ie11/no-collection-args": [ "error" ],
"ie11/no-for-in-const": [ "error" ],
"ie11/no-loop-func": [ "error" ],
"ie11/no-weak-collections": [ "error" ]
},
"overrides": [
{
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"autoprefixer": "^10.2.5",
"coffeescript": "^2.5.1",
"eslint-config-jquery": "^3.0.0",
"eslint-plugin-es5": "git+https://github.com/skyway777/eslint-plugin-es5.git#470d588607ff0c9f98a9b570d182cdb708d134cf",
"eslint-plugin-ie11": "^1.0.0",
"expect.js": "^0.3.1",
"grunt": "^1.3.0",
"grunt-assemble": "~0.6.3",
Expand Down

0 comments on commit fc65729

Please sign in to comment.