Skip to content

Commit

Permalink
client: Change target from ES6 to ES2016 (ES7)
Browse files Browse the repository at this point in the history
As all mainstream browsers passing the current MediaWiki feature checks support ES2016, raise the default wikimedia/client configuration to allow ES2016 syntax and methods.

Bug: T381537
  • Loading branch information
siddharthvp committed Dec 19, 2024
1 parent cbfe6ea commit 04085a3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "./client/es6"
"extends": "./client/es2016"
}
7 changes: 7 additions & 0 deletions client/es2016.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": [
"./common",
"../language/es2016",
"../vue/es2016"
]
}
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ Then, [configure ESLint](https://eslint.org/docs/user-guide/configuring) with on
Below are some potential recommended uses:

### A typical front-end project
This config allows ES6 code and browser native functions. It will complain about ES2016+ code and language features.
This config allows ES2016 code and browser native functions. It will complain about ES2017+ code and language features.
It also automatically applies the Vue plugin and Vue-specific rules to `.vue` files.

`.eslintrc.json`:
```json
{
"extends": "wikimedia/client/es6"
"extends": "wikimedia/client/es2016"
}
```
If you want to only allow ES5 code and browser native functions, you can use `wikimedia/client/es5` instead.

#### jQuery
This config adds the jQuery `$` global, and additional rules preventing the use of jQuery features which are deprecated, have performance issues, or have simple ES6 alternatives.
This config adds the jQuery `$` global, and additional rules preventing the use of jQuery features which are deprecated, have performance issues, or have simple ES2016 alternatives.
`.eslintrc.json`:
```json
{
"extends": [
"wikimedia/client/es6",
"wikimedia/client/es2016",
"wikimedia/jquery"
]
}
Expand All @@ -41,7 +41,7 @@ Code that runs in MediaWiki can use this config. It enforces rules that are spec
```json
{
"extends": [
"wikimedia/client/es6",
"wikimedia/client/es2016",
"wikimedia/mediawiki"
]
}
Expand Down
3 changes: 3 additions & 0 deletions vue/es2016.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../vue3/es2016"
}
12 changes: 12 additions & 0 deletions vue3/es2016.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

/* eslint-disable quote-props, quotes */
module.exports = {
"overrides": [ {
"files": [ "**/*.vue" ],
"extends": [
"../vue3/common",
"../language/es2016"
]
} ]
};

0 comments on commit 04085a3

Please sign in to comment.