Skip to content

Commit

Permalink
Merge branch 'main' into node-20-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jdforrester authored Nov 13, 2023
2 parents cd83ba3 + 2f495b5 commit cab49c5
Show file tree
Hide file tree
Showing 74 changed files with 270 additions and 210 deletions.
15 changes: 1 addition & 14 deletions client-common.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
{
"extends": [
"./common"
],
"env": {
"browser": true
},
"plugins": [ "unicorn" ],
"rules": {
"no-alert": "error",
"no-console": "error",
"no-implied-eval": "error",
"unicorn/no-invalid-remove-event-listener": "error",
"security/detect-possible-timing-attacks": "off"
}
"extends": "./client/common"
}
3 changes: 3 additions & 0 deletions client-es5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./client/es5"
}
6 changes: 1 addition & 5 deletions client-es6.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"extends": [
"./client-common",
"./language/es6",
"./vue-es6"
]
"extends": "./client/es6"
}
4 changes: 1 addition & 3 deletions client.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"extends": [
"./client-es6"
]
"extends": "./client/es6"
}
16 changes: 16 additions & 0 deletions client/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": [
"../common"
],
"env": {
"browser": true
},
"plugins": [ "unicorn" ],
"rules": {
"no-alert": "error",
"no-console": "error",
"no-implied-eval": "error",
"unicorn/no-invalid-remove-event-listener": "error",
"security/detect-possible-timing-attacks": "off"
}
}
13 changes: 5 additions & 8 deletions client-es5.js → client/es5.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
'use strict';

/* eslint-disable quote-props, quotes */
module.exports = {
{
"extends": [
"./client-common",
"./language/es5",
"./vue2-es5"
"./common",
"../language/es5",
"../vue2/es5"
],
"rules": {
"no-restricted-properties": [
Expand All @@ -16,4 +13,4 @@ module.exports = {
}
]
}
};
}
7 changes: 7 additions & 0 deletions client/es6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": [
"./common",
"../language/es6",
"../vue/es6"
]
}
17 changes: 1 addition & 16 deletions mediawiki-qunit.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
{
"extends": [
"./client-common",
"./language/es2022",
"./jquery",
"./mediawiki",
"./qunit"
],
"globals": {
"sinon": "readonly"
},
"rules": {
"compat/compat": [ "error", "last 2 chrome versions, last 2 firefox versions, last 2 safari versions" ],
"max-len": "off",
"no-jquery/no-global-selector": "off",
"no-jquery/no-parse-html-literal": "off"
}
"extends": "./mediawiki/qunit"
}
3 changes: 3 additions & 0 deletions mediawiki.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./mediawiki/common"
}
4 changes: 3 additions & 1 deletion mediawiki.js → mediawiki/common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const commonRules = require( './common' );
const commonRules = require( '../common' );
const browsers = require( 'browserslist-config-wikimedia/modern' );

/* eslint-disable quote-props, quotes */
Expand Down Expand Up @@ -55,6 +55,8 @@ config.rules[ 'max-len' ][ 1 ].ignorePattern =
')';
// Duplicate JSON override from common rules to prevent max-len rule here taking precedent
const jsonOverride = commonRules.overrides.find( ( override ) => override.parser === 'eslint-plugin-json-es' );
// Adjust path, keep in sync with common.json
jsonOverride.extends = '../json';
config.overrides.push( jsonOverride );

module.exports = config;
18 changes: 18 additions & 0 deletions mediawiki/qunit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": [
"../client/common",
"../language/es2022",
"../jquery",
"../mediawiki",
"../qunit"
],
"globals": {
"sinon": "readonly"
},
"rules": {
"compat/compat": [ "error", "last 2 chrome versions, last 2 firefox versions, last 2 safari versions" ],
"max-len": "off",
"no-jquery/no-global-selector": "off",
"no-jquery/no-parse-html-literal": "off"
}
}
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
"common.json",
"client.json",
"client-common.json",
"client-es5.js",
"client-es5.json",
"client-es6.json",
"node.json",
"jest.json",
"jquery.json",
"jsdoc.json",
"jsduck.json",
"json.json",
"mediawiki.js",
"mediawiki.json",
"mediawiki-qunit.json",
"mocha.json",
"qunit.json",
Expand All @@ -46,12 +46,16 @@
"vue3-common.json",
"vue-es5.json",
"vue-es6.json",
"vue2-es5.js",
"vue2-es6.js",
"vue3-es6.js",
"vue-wrappers.js",
"vue2-es5.json",
"vue2-es6.json",
"vue3-es6.json",
"yaml.json",
"language"
"client/",
"language/",
"mediawiki/",
"vue/",
"vue2/",
"vue3/"
],
"contributors": [
"James D. Forrester <[email protected]>",
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ It also automatically applies the Vue plugin and Vue-specific rules to `.vue` fi
`.eslintrc.json`:
```json
{
"extends": "wikimedia/client-es6"
"extends": "wikimedia/client/es6"
}
```
If you want to only allow ES5 code and browser native functions, you can use `wikimedia/client-es5` instead.
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.
`.eslintrc.json`:
```json
{
"extends": [
"wikimedia/client-es6",
"wikimedia/client/es6",
"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/es6",
"wikimedia/mediawiki"
]
}
Expand All @@ -54,7 +54,7 @@ You can extend the above config by also adding a second `.eslintrc.json` file in
```json
{
"extends": [
"wikimedia/mediawiki-qunit"
"wikimedia/mediawiki/qunit"
]
}
```
Expand Down
4 changes: 0 additions & 4 deletions test/fixtures/client-common/.eslintrc.json

This file was deleted.

4 changes: 0 additions & 4 deletions test/fixtures/client-es5/.eslintrc.json

This file was deleted.

4 changes: 0 additions & 4 deletions test/fixtures/client-es6/.eslintrc.json

This file was deleted.

4 changes: 4 additions & 0 deletions test/fixtures/client/common/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": "../../../../client/common"
}
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions test/fixtures/client/es5/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": "../../../../client/es5"
}
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions test/fixtures/client/es6/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": "../../../../client/es6"
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/fixtures/jest/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"../../../client-es6",
"../../../client/es6",
"../../../mediawiki",
"../../../jest"
]
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/jquery/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"../../../client-es5",
"../../../client/es5",
"../../../jquery"
]
}
2 changes: 1 addition & 1 deletion test/fixtures/jsdoc/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"../../../client-es6",
"../../../client/es6",
"../../../jsdoc"
],
"rules": {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/jsduck/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"../../../client-es5",
"../../../client/es5",
"../../../jsduck"
],
"rules": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"root": true,
"extends": [
"../../../client-es5",
"../../../mediawiki"
"../../../../client/es5",
"../../../../mediawiki"
],
"rules": {
"json-es/use-valid-json": "off"
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/mediawiki/common/es6/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"root": true,
"extends": [
"../../../../../client/es6",
"../../../../../mediawiki"
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions test/fixtures/mediawiki/es6/.eslintrc.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"extends": [
"../../../mediawiki-qunit"
"../../../../mediawiki/qunit"
]
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/fixtures/mocha/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"files": [ "*-client.js" ],
"extends": [
"../../../client-es5"
"../../../client/es5"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/qunit/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": true,
"extends": [
"../../../client-common",
"../../../client/common",
"../../../language/es2017",
"../../../qunit"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"extends": "../../../vue-es5",
"extends": "../../../../vue/es5",
"globals": {
"module": "readonly"
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"extends": "../../../vue-es6",
"extends": "../../../../vue/es6",
"globals": {
"module": "readonly"
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"extends": "../../../vue2-common",
"extends": "../../../../vue2/common",
"globals": {
"module": "readonly"
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"extends": "../../../vue2-common",
"extends": "../../../../vue2/common",
"globals": {
"module": "readonly"
}
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit cab49c5

Please sign in to comment.