From 2f495b55b13925da75443ba4dcdf96dffd78691f Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Mon, 7 Aug 2023 14:01:23 +0100 Subject: [PATCH] Rename shared configs by grouping in folders e.g. * client-es5 -> client/es5 * mediawiki-quint -> mediawiki/qunit * vue3-common -> vue3/common Fixes #525 --- client-common.json | 15 +--- client-es5.json | 3 + client-es6.json | 6 +- client.json | 4 +- client/common.json | 16 ++++ client-es5.js => client/es5.json | 13 ++- client/es6.json | 7 ++ mediawiki-qunit.json | 17 +--- mediawiki.json | 3 + mediawiki.js => mediawiki/common.js | 4 +- mediawiki/qunit.json | 18 ++++ package.json | 18 ++-- readme.md | 10 +-- test/fixtures/client-common/.eslintrc.json | 4 - test/fixtures/client-es5/.eslintrc.json | 4 - test/fixtures/client-es6/.eslintrc.json | 4 - test/fixtures/client/common/.eslintrc.json | 4 + .../common}/invalid.js | 0 .../common}/positiveFailures.json | 0 .../{client-common => client/common}/valid.js | 0 test/fixtures/client/es5/.eslintrc.json | 4 + .../{client-es5 => client/es5}/invalid.js | 0 .../es5}/positiveFailures.json | 0 .../{client-es5 => client/es5}/valid.js | 0 test/fixtures/client/es6/.eslintrc.json | 4 + .../{client-es6 => client/es6}/invalid.js | 0 .../es6}/positiveFailures.json | 0 .../{client-es6 => client/es6}/valid.js | 0 test/fixtures/jest/.eslintrc.json | 2 +- test/fixtures/jquery/.eslintrc.json | 2 +- test/fixtures/jsdoc/.eslintrc.json | 2 +- test/fixtures/jsduck/.eslintrc.json | 2 +- .../mediawiki/{ => common}/.eslintrc.json | 4 +- .../mediawiki/common/es6/.eslintrc.json | 7 ++ .../mediawiki/{ => common}/es6/invalid.js | 0 .../mediawiki/{ => common}/invalid.js | 0 .../mediawiki/{ => common}/invalid.vue | 0 test/fixtures/mediawiki/{ => common}/valid.js | 0 .../mediawiki/{ => common}/valid.jsonc | 0 .../fixtures/mediawiki/{ => common}/valid.vue | 0 test/fixtures/mediawiki/es6/.eslintrc.json | 7 -- .../qunit}/.eslintrc.json | 2 +- .../qunit}/invalid.js | 0 .../qunit}/valid.js | 0 test/fixtures/mocha/.eslintrc.json | 2 +- test/fixtures/qunit/.eslintrc.json | 2 +- .../{vue-es5 => vue/es5}/.eslintrc.json | 2 +- .../fixtures/{vue-es5 => vue/es5}/invalid.vue | 0 .../{vue-es6 => vue/es6}/.eslintrc.json | 2 +- .../fixtures/{vue-es6 => vue/es6}/invalid.vue | 0 .../wrappers}/.eslintrc.json | 2 +- .../wrappers}/invalid.vue | 0 .../{vue-wrappers => vue/wrappers}/valid.vue | 0 .../common}/.eslintrc.json | 2 +- .../{vue2-common => vue2/common}/invalid.vue | 0 .../{vue2-common => vue2/common}/valid.vue | 0 test/test.js | 26 +++++- vue-common.json | 83 +----------------- vue-es5.json | 2 +- vue-es6.json | 2 +- vue/common.json | 84 +++++++++++++++++++ vue/es5.json | 3 + vue/es6.json | 3 + vue-wrappers.js => vue/wrappers.js | 2 +- vue2-common.json | 13 +-- vue2-es5.json | 3 + vue2-es6.json | 3 + vue2/common.json | 14 ++++ vue2-es5.js => vue2/es5.js | 6 +- vue2-es6.js => vue2/es6.js | 4 +- vue3-common.json | 13 +-- vue3-es6.json | 3 + vue3/common.json | 14 ++++ vue3-es6.js => vue3/es6.js | 4 +- 74 files changed, 270 insertions(+), 210 deletions(-) create mode 100644 client-es5.json create mode 100644 client/common.json rename client-es5.js => client/es5.json (62%) create mode 100644 client/es6.json create mode 100644 mediawiki.json rename mediawiki.js => mediawiki/common.js (91%) create mode 100644 mediawiki/qunit.json delete mode 100644 test/fixtures/client-common/.eslintrc.json delete mode 100644 test/fixtures/client-es5/.eslintrc.json delete mode 100644 test/fixtures/client-es6/.eslintrc.json create mode 100644 test/fixtures/client/common/.eslintrc.json rename test/fixtures/{client-common => client/common}/invalid.js (100%) rename test/fixtures/{client-common => client/common}/positiveFailures.json (100%) rename test/fixtures/{client-common => client/common}/valid.js (100%) create mode 100644 test/fixtures/client/es5/.eslintrc.json rename test/fixtures/{client-es5 => client/es5}/invalid.js (100%) rename test/fixtures/{client-es5 => client/es5}/positiveFailures.json (100%) rename test/fixtures/{client-es5 => client/es5}/valid.js (100%) create mode 100644 test/fixtures/client/es6/.eslintrc.json rename test/fixtures/{client-es6 => client/es6}/invalid.js (100%) rename test/fixtures/{client-es6 => client/es6}/positiveFailures.json (100%) rename test/fixtures/{client-es6 => client/es6}/valid.js (100%) rename test/fixtures/mediawiki/{ => common}/.eslintrc.json (61%) create mode 100644 test/fixtures/mediawiki/common/es6/.eslintrc.json rename test/fixtures/mediawiki/{ => common}/es6/invalid.js (100%) rename test/fixtures/mediawiki/{ => common}/invalid.js (100%) rename test/fixtures/mediawiki/{ => common}/invalid.vue (100%) rename test/fixtures/mediawiki/{ => common}/valid.js (100%) rename test/fixtures/mediawiki/{ => common}/valid.jsonc (100%) rename test/fixtures/mediawiki/{ => common}/valid.vue (100%) delete mode 100644 test/fixtures/mediawiki/es6/.eslintrc.json rename test/fixtures/{mediawiki-qunit => mediawiki/qunit}/.eslintrc.json (52%) rename test/fixtures/{mediawiki-qunit => mediawiki/qunit}/invalid.js (100%) rename test/fixtures/{mediawiki-qunit => mediawiki/qunit}/valid.js (100%) rename test/fixtures/{vue-es5 => vue/es5}/.eslintrc.json (62%) rename test/fixtures/{vue-es5 => vue/es5}/invalid.vue (100%) rename test/fixtures/{vue-es6 => vue/es6}/.eslintrc.json (62%) rename test/fixtures/{vue-es6 => vue/es6}/invalid.vue (100%) rename test/fixtures/{vue-wrappers => vue/wrappers}/.eslintrc.json (60%) rename test/fixtures/{vue-wrappers => vue/wrappers}/invalid.vue (100%) rename test/fixtures/{vue-wrappers => vue/wrappers}/valid.vue (100%) rename test/fixtures/{vue2-common => vue2/common}/.eslintrc.json (60%) rename test/fixtures/{vue2-common => vue2/common}/invalid.vue (100%) rename test/fixtures/{vue2-common => vue2/common}/valid.vue (100%) create mode 100644 vue/common.json create mode 100644 vue/es5.json create mode 100644 vue/es6.json rename vue-wrappers.js => vue/wrappers.js (96%) create mode 100644 vue2-es5.json create mode 100644 vue2-es6.json create mode 100644 vue2/common.json rename vue2-es5.js => vue2/es5.js (84%) rename vue2-es6.js => vue2/es6.js (77%) create mode 100644 vue3-es6.json create mode 100644 vue3/common.json rename vue3-es6.js => vue3/es6.js (77%) diff --git a/client-common.json b/client-common.json index 2d3bf70a..c804489d 100644 --- a/client-common.json +++ b/client-common.json @@ -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" } diff --git a/client-es5.json b/client-es5.json new file mode 100644 index 00000000..537084b1 --- /dev/null +++ b/client-es5.json @@ -0,0 +1,3 @@ +{ + "extends": "./client/es5" +} diff --git a/client-es6.json b/client-es6.json index 48409197..2b0e580d 100644 --- a/client-es6.json +++ b/client-es6.json @@ -1,7 +1,3 @@ { - "extends": [ - "./client-common", - "./language/es6", - "./vue-es6" - ] + "extends": "./client/es6" } diff --git a/client.json b/client.json index dddea4df..2b0e580d 100644 --- a/client.json +++ b/client.json @@ -1,5 +1,3 @@ { - "extends": [ - "./client-es6" - ] + "extends": "./client/es6" } diff --git a/client/common.json b/client/common.json new file mode 100644 index 00000000..b676095a --- /dev/null +++ b/client/common.json @@ -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" + } +} diff --git a/client-es5.js b/client/es5.json similarity index 62% rename from client-es5.js rename to client/es5.json index be20b970..fa2a853b 100644 --- a/client-es5.js +++ b/client/es5.json @@ -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": [ @@ -16,4 +13,4 @@ module.exports = { } ] } -}; +} diff --git a/client/es6.json b/client/es6.json new file mode 100644 index 00000000..25e0a25f --- /dev/null +++ b/client/es6.json @@ -0,0 +1,7 @@ +{ + "extends": [ + "./common", + "../language/es6", + "../vue/es6" + ] +} diff --git a/mediawiki-qunit.json b/mediawiki-qunit.json index ce31ff17..acd78187 100644 --- a/mediawiki-qunit.json +++ b/mediawiki-qunit.json @@ -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" } diff --git a/mediawiki.json b/mediawiki.json new file mode 100644 index 00000000..4d850b8b --- /dev/null +++ b/mediawiki.json @@ -0,0 +1,3 @@ +{ + "extends": "./mediawiki/common" +} diff --git a/mediawiki.js b/mediawiki/common.js similarity index 91% rename from mediawiki.js rename to mediawiki/common.js index f2d385db..cceffd3e 100644 --- a/mediawiki.js +++ b/mediawiki/common.js @@ -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 */ @@ -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; diff --git a/mediawiki/qunit.json b/mediawiki/qunit.json new file mode 100644 index 00000000..ec30c945 --- /dev/null +++ b/mediawiki/qunit.json @@ -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" + } +} diff --git a/package.json b/package.json index 6349ae54..01994389 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "common.json", "client.json", "client-common.json", - "client-es5.js", + "client-es5.json", "client-es6.json", "node.json", "jest.json", @@ -35,7 +35,7 @@ "jsdoc.json", "jsduck.json", "json.json", - "mediawiki.js", + "mediawiki.json", "mediawiki-qunit.json", "mocha.json", "qunit.json", @@ -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 ", diff --git a/readme.md b/readme.md index fc480ec9..2c6db31f 100644 --- a/readme.md +++ b/readme.md @@ -18,10 +18,10 @@ 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. @@ -29,7 +29,7 @@ This config adds the jQuery `$` global, and additional rules preventing the use ```json { "extends": [ - "wikimedia/client-es6", + "wikimedia/client/es6", "wikimedia/jquery" ] } @@ -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" ] } @@ -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" ] } ``` diff --git a/test/fixtures/client-common/.eslintrc.json b/test/fixtures/client-common/.eslintrc.json deleted file mode 100644 index 6aa85300..00000000 --- a/test/fixtures/client-common/.eslintrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "root": true, - "extends": "../../../client-common" -} diff --git a/test/fixtures/client-es5/.eslintrc.json b/test/fixtures/client-es5/.eslintrc.json deleted file mode 100644 index 94eb925e..00000000 --- a/test/fixtures/client-es5/.eslintrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "root": true, - "extends": "../../../client-es5" -} diff --git a/test/fixtures/client-es6/.eslintrc.json b/test/fixtures/client-es6/.eslintrc.json deleted file mode 100644 index 6aab957b..00000000 --- a/test/fixtures/client-es6/.eslintrc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "root": true, - "extends": "../../../client-es6" -} diff --git a/test/fixtures/client/common/.eslintrc.json b/test/fixtures/client/common/.eslintrc.json new file mode 100644 index 00000000..bbd8c6af --- /dev/null +++ b/test/fixtures/client/common/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "root": true, + "extends": "../../../../client/common" +} diff --git a/test/fixtures/client-common/invalid.js b/test/fixtures/client/common/invalid.js similarity index 100% rename from test/fixtures/client-common/invalid.js rename to test/fixtures/client/common/invalid.js diff --git a/test/fixtures/client-common/positiveFailures.json b/test/fixtures/client/common/positiveFailures.json similarity index 100% rename from test/fixtures/client-common/positiveFailures.json rename to test/fixtures/client/common/positiveFailures.json diff --git a/test/fixtures/client-common/valid.js b/test/fixtures/client/common/valid.js similarity index 100% rename from test/fixtures/client-common/valid.js rename to test/fixtures/client/common/valid.js diff --git a/test/fixtures/client/es5/.eslintrc.json b/test/fixtures/client/es5/.eslintrc.json new file mode 100644 index 00000000..b296b011 --- /dev/null +++ b/test/fixtures/client/es5/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "root": true, + "extends": "../../../../client/es5" +} diff --git a/test/fixtures/client-es5/invalid.js b/test/fixtures/client/es5/invalid.js similarity index 100% rename from test/fixtures/client-es5/invalid.js rename to test/fixtures/client/es5/invalid.js diff --git a/test/fixtures/client-es5/positiveFailures.json b/test/fixtures/client/es5/positiveFailures.json similarity index 100% rename from test/fixtures/client-es5/positiveFailures.json rename to test/fixtures/client/es5/positiveFailures.json diff --git a/test/fixtures/client-es5/valid.js b/test/fixtures/client/es5/valid.js similarity index 100% rename from test/fixtures/client-es5/valid.js rename to test/fixtures/client/es5/valid.js diff --git a/test/fixtures/client/es6/.eslintrc.json b/test/fixtures/client/es6/.eslintrc.json new file mode 100644 index 00000000..bbe100cc --- /dev/null +++ b/test/fixtures/client/es6/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "root": true, + "extends": "../../../../client/es6" +} diff --git a/test/fixtures/client-es6/invalid.js b/test/fixtures/client/es6/invalid.js similarity index 100% rename from test/fixtures/client-es6/invalid.js rename to test/fixtures/client/es6/invalid.js diff --git a/test/fixtures/client-es6/positiveFailures.json b/test/fixtures/client/es6/positiveFailures.json similarity index 100% rename from test/fixtures/client-es6/positiveFailures.json rename to test/fixtures/client/es6/positiveFailures.json diff --git a/test/fixtures/client-es6/valid.js b/test/fixtures/client/es6/valid.js similarity index 100% rename from test/fixtures/client-es6/valid.js rename to test/fixtures/client/es6/valid.js diff --git a/test/fixtures/jest/.eslintrc.json b/test/fixtures/jest/.eslintrc.json index b37d5bcc..90927c2d 100644 --- a/test/fixtures/jest/.eslintrc.json +++ b/test/fixtures/jest/.eslintrc.json @@ -1,7 +1,7 @@ { "root": true, "extends": [ - "../../../client-es6", + "../../../client/es6", "../../../mediawiki", "../../../jest" ] diff --git a/test/fixtures/jquery/.eslintrc.json b/test/fixtures/jquery/.eslintrc.json index e54a6fc4..423ceb20 100644 --- a/test/fixtures/jquery/.eslintrc.json +++ b/test/fixtures/jquery/.eslintrc.json @@ -1,7 +1,7 @@ { "root": true, "extends": [ - "../../../client-es5", + "../../../client/es5", "../../../jquery" ] } diff --git a/test/fixtures/jsdoc/.eslintrc.json b/test/fixtures/jsdoc/.eslintrc.json index 788e8065..fd1ef4ca 100644 --- a/test/fixtures/jsdoc/.eslintrc.json +++ b/test/fixtures/jsdoc/.eslintrc.json @@ -1,7 +1,7 @@ { "root": true, "extends": [ - "../../../client-es6", + "../../../client/es6", "../../../jsdoc" ], "rules": { diff --git a/test/fixtures/jsduck/.eslintrc.json b/test/fixtures/jsduck/.eslintrc.json index 9148c0fb..95834b93 100644 --- a/test/fixtures/jsduck/.eslintrc.json +++ b/test/fixtures/jsduck/.eslintrc.json @@ -1,7 +1,7 @@ { "root": true, "extends": [ - "../../../client-es5", + "../../../client/es5", "../../../jsduck" ], "rules": { diff --git a/test/fixtures/mediawiki/.eslintrc.json b/test/fixtures/mediawiki/common/.eslintrc.json similarity index 61% rename from test/fixtures/mediawiki/.eslintrc.json rename to test/fixtures/mediawiki/common/.eslintrc.json index 89a5e9b7..83fb82dd 100644 --- a/test/fixtures/mediawiki/.eslintrc.json +++ b/test/fixtures/mediawiki/common/.eslintrc.json @@ -1,8 +1,8 @@ { "root": true, "extends": [ - "../../../client-es5", - "../../../mediawiki" + "../../../../client/es5", + "../../../../mediawiki" ], "rules": { "json-es/use-valid-json": "off" diff --git a/test/fixtures/mediawiki/common/es6/.eslintrc.json b/test/fixtures/mediawiki/common/es6/.eslintrc.json new file mode 100644 index 00000000..9a3541f4 --- /dev/null +++ b/test/fixtures/mediawiki/common/es6/.eslintrc.json @@ -0,0 +1,7 @@ +{ + "root": true, + "extends": [ + "../../../../../client/es6", + "../../../../../mediawiki" + ] +} diff --git a/test/fixtures/mediawiki/es6/invalid.js b/test/fixtures/mediawiki/common/es6/invalid.js similarity index 100% rename from test/fixtures/mediawiki/es6/invalid.js rename to test/fixtures/mediawiki/common/es6/invalid.js diff --git a/test/fixtures/mediawiki/invalid.js b/test/fixtures/mediawiki/common/invalid.js similarity index 100% rename from test/fixtures/mediawiki/invalid.js rename to test/fixtures/mediawiki/common/invalid.js diff --git a/test/fixtures/mediawiki/invalid.vue b/test/fixtures/mediawiki/common/invalid.vue similarity index 100% rename from test/fixtures/mediawiki/invalid.vue rename to test/fixtures/mediawiki/common/invalid.vue diff --git a/test/fixtures/mediawiki/valid.js b/test/fixtures/mediawiki/common/valid.js similarity index 100% rename from test/fixtures/mediawiki/valid.js rename to test/fixtures/mediawiki/common/valid.js diff --git a/test/fixtures/mediawiki/valid.jsonc b/test/fixtures/mediawiki/common/valid.jsonc similarity index 100% rename from test/fixtures/mediawiki/valid.jsonc rename to test/fixtures/mediawiki/common/valid.jsonc diff --git a/test/fixtures/mediawiki/valid.vue b/test/fixtures/mediawiki/common/valid.vue similarity index 100% rename from test/fixtures/mediawiki/valid.vue rename to test/fixtures/mediawiki/common/valid.vue diff --git a/test/fixtures/mediawiki/es6/.eslintrc.json b/test/fixtures/mediawiki/es6/.eslintrc.json deleted file mode 100644 index 44291db8..00000000 --- a/test/fixtures/mediawiki/es6/.eslintrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "root": true, - "extends": [ - "../../../../client-es6", - "../../../../mediawiki" - ] -} diff --git a/test/fixtures/mediawiki-qunit/.eslintrc.json b/test/fixtures/mediawiki/qunit/.eslintrc.json similarity index 52% rename from test/fixtures/mediawiki-qunit/.eslintrc.json rename to test/fixtures/mediawiki/qunit/.eslintrc.json index 3310441d..fe863523 100644 --- a/test/fixtures/mediawiki-qunit/.eslintrc.json +++ b/test/fixtures/mediawiki/qunit/.eslintrc.json @@ -1,6 +1,6 @@ { "root": true, "extends": [ - "../../../mediawiki-qunit" + "../../../../mediawiki/qunit" ] } diff --git a/test/fixtures/mediawiki-qunit/invalid.js b/test/fixtures/mediawiki/qunit/invalid.js similarity index 100% rename from test/fixtures/mediawiki-qunit/invalid.js rename to test/fixtures/mediawiki/qunit/invalid.js diff --git a/test/fixtures/mediawiki-qunit/valid.js b/test/fixtures/mediawiki/qunit/valid.js similarity index 100% rename from test/fixtures/mediawiki-qunit/valid.js rename to test/fixtures/mediawiki/qunit/valid.js diff --git a/test/fixtures/mocha/.eslintrc.json b/test/fixtures/mocha/.eslintrc.json index 73ecbd53..2054eb47 100644 --- a/test/fixtures/mocha/.eslintrc.json +++ b/test/fixtures/mocha/.eslintrc.json @@ -10,7 +10,7 @@ { "files": [ "*-client.js" ], "extends": [ - "../../../client-es5" + "../../../client/es5" ] }, { diff --git a/test/fixtures/qunit/.eslintrc.json b/test/fixtures/qunit/.eslintrc.json index 09b5dd5f..6541d490 100644 --- a/test/fixtures/qunit/.eslintrc.json +++ b/test/fixtures/qunit/.eslintrc.json @@ -1,7 +1,7 @@ { "root": true, "extends": [ - "../../../client-common", + "../../../client/common", "../../../language/es2017", "../../../qunit" ] diff --git a/test/fixtures/vue-es5/.eslintrc.json b/test/fixtures/vue/es5/.eslintrc.json similarity index 62% rename from test/fixtures/vue-es5/.eslintrc.json rename to test/fixtures/vue/es5/.eslintrc.json index 1052a25e..43a316a0 100644 --- a/test/fixtures/vue-es5/.eslintrc.json +++ b/test/fixtures/vue/es5/.eslintrc.json @@ -1,6 +1,6 @@ { "root": true, - "extends": "../../../vue-es5", + "extends": "../../../../vue/es5", "globals": { "module": "readonly" } diff --git a/test/fixtures/vue-es5/invalid.vue b/test/fixtures/vue/es5/invalid.vue similarity index 100% rename from test/fixtures/vue-es5/invalid.vue rename to test/fixtures/vue/es5/invalid.vue diff --git a/test/fixtures/vue-es6/.eslintrc.json b/test/fixtures/vue/es6/.eslintrc.json similarity index 62% rename from test/fixtures/vue-es6/.eslintrc.json rename to test/fixtures/vue/es6/.eslintrc.json index dba966be..8058d24d 100644 --- a/test/fixtures/vue-es6/.eslintrc.json +++ b/test/fixtures/vue/es6/.eslintrc.json @@ -1,6 +1,6 @@ { "root": true, - "extends": "../../../vue-es6", + "extends": "../../../../vue/es6", "globals": { "module": "readonly" } diff --git a/test/fixtures/vue-es6/invalid.vue b/test/fixtures/vue/es6/invalid.vue similarity index 100% rename from test/fixtures/vue-es6/invalid.vue rename to test/fixtures/vue/es6/invalid.vue diff --git a/test/fixtures/vue-wrappers/.eslintrc.json b/test/fixtures/vue/wrappers/.eslintrc.json similarity index 60% rename from test/fixtures/vue-wrappers/.eslintrc.json rename to test/fixtures/vue/wrappers/.eslintrc.json index 070d39b9..bd16c9a5 100644 --- a/test/fixtures/vue-wrappers/.eslintrc.json +++ b/test/fixtures/vue/wrappers/.eslintrc.json @@ -1,6 +1,6 @@ { "root": true, - "extends": "../../../vue2-common", + "extends": "../../../../vue2/common", "globals": { "module": "readonly" } diff --git a/test/fixtures/vue-wrappers/invalid.vue b/test/fixtures/vue/wrappers/invalid.vue similarity index 100% rename from test/fixtures/vue-wrappers/invalid.vue rename to test/fixtures/vue/wrappers/invalid.vue diff --git a/test/fixtures/vue-wrappers/valid.vue b/test/fixtures/vue/wrappers/valid.vue similarity index 100% rename from test/fixtures/vue-wrappers/valid.vue rename to test/fixtures/vue/wrappers/valid.vue diff --git a/test/fixtures/vue2-common/.eslintrc.json b/test/fixtures/vue2/common/.eslintrc.json similarity index 60% rename from test/fixtures/vue2-common/.eslintrc.json rename to test/fixtures/vue2/common/.eslintrc.json index 070d39b9..bd16c9a5 100644 --- a/test/fixtures/vue2-common/.eslintrc.json +++ b/test/fixtures/vue2/common/.eslintrc.json @@ -1,6 +1,6 @@ { "root": true, - "extends": "../../../vue2-common", + "extends": "../../../../vue2/common", "globals": { "module": "readonly" } diff --git a/test/fixtures/vue2-common/invalid.vue b/test/fixtures/vue2/common/invalid.vue similarity index 100% rename from test/fixtures/vue2-common/invalid.vue rename to test/fixtures/vue2/common/invalid.vue diff --git a/test/fixtures/vue2-common/valid.vue b/test/fixtures/vue2/common/valid.vue similarity index 100% rename from test/fixtures/vue2-common/valid.vue rename to test/fixtures/vue2/common/valid.vue diff --git a/test/test.js b/test/test.js index 8291272b..03e6f1c0 100644 --- a/test/test.js +++ b/test/test.js @@ -19,7 +19,7 @@ packageFiles.forEach( function ( packageFile ) { configs.push.apply( configs, readdirRecursive( packageFile ) - .map( ( file ) => packageFile + '/' + file ) + .map( ( file ) => path.join( packageFile, file ) ) ); } else { configs.push( packageFile ); @@ -127,15 +127,35 @@ QUnit.module( 'package.json', () => { } ); } ); +const aliases = [ + 'client', + 'client-common', + 'client-es5', + 'client-es6', + 'mediawiki', + 'mediawiki-qunit', + 'vue-common', + 'vue-es5', + 'vue-es6', + 'vue2-common', + 'vue2-es5', + 'vue2-es6', + 'vue3-common', + 'vue3-es6' +]; + configs.forEach( ( configPath ) => { const configName = configPath.replace( /\..*/, '' ); + if ( aliases.includes( configName ) ) { + return; + } const fixturesDir = path.resolve( __dirname, `fixtures/${ configName }` ); const upstreamConfigsToTest = [ 'jest', 'jquery', 'jsdoc', 'json', - 'mediawiki', + 'mediawiki/common', 'mocha', 'qunit', 'selenium' @@ -176,7 +196,7 @@ configs.forEach( ( configPath ) => { ( { rules, globals } = extendRules( require( '../node' ), rules, globals ) ); } - if ( configName === 'client-es5' ) { + if ( configName === 'client/es5' ) { // Load the rules for ES5 when testing client Object.assign( rules, diff --git a/vue-common.json b/vue-common.json index f9de52ae..b77f3f44 100644 --- a/vue-common.json +++ b/vue-common.json @@ -1,84 +1,3 @@ { - "overrides": [ { - "files": [ "**/*.vue" ], - "extends": [ - "./common", - "./vue-wrappers" - ], - "rules": { - "vue/component-tags-order": [ "error", { - "order": [ "template", "script", "style" ] - } ], - "vue/html-indent": [ "error", "tab" ], - "vue/html-closing-bracket-newline": "off", - "vue/max-attributes-per-line": [ "warn", { - "singleline": 2, - "multiline": 1 - } ], - "vue/no-boolean-default": [ "error", "default-false" ], - "vue/no-deprecated-scope-attribute": "error", - "vue/no-deprecated-slot-attribute": "error", - "vue/no-deprecated-slot-scope-attribute": "error", - "vue/no-duplicate-attr-inheritance": "error", - "vue/no-invalid-model-keys": "error", - "vue/no-multiple-objects-in-class": "error", - "vue/no-reserved-component-names": [ "error", { - "disallowVueBuiltInComponents": true, - "disallowVue3BuiltInComponents": true - } ], - "vue/no-static-inline-styles": "error", - "vue/no-undef-properties": "error", - "vue/no-undef-components": "error", - "vue/no-unsupported-features": [ "error", { - "version": "2.6.11" - } ], - "vue/no-unused-properties": [ "error", { - "groups": [ "props", "data", "computed", "methods", "setup" ], - "deepData": false, - "ignorePublicMembers": true - } ], - "vue/no-unused-refs": "error", - "vue/no-use-computed-property-like-method": "error", - "vue/no-useless-mustaches": "error", - "vue/no-useless-v-bind": "error", - "vue/no-v-text": "error", - "vue/order-in-components": [ "error", { - "order": [ - "el", - "name", - "parent", - "functional", - [ "delimiters", "comments" ], - [ "components", "directives", "filters" ], - "extends", - "mixins", - "provide", - "inject", - "inheritAttrs", - "model", - [ "props", "propsData" ], - "emits", - "setup", - "asyncData", - "data", - "computed", - "methods", - "watch", - "fetch", - "LIFECYCLE_HOOKS", - "head", - [ "template", "render" ], - "renderError" - ] - } ], - "vue/brace-style": [ "error", "1tbs", { "allowSingleLine": true } ], - "vue/padding-line-between-blocks": [ "error", "always" ], - "vue/v-on-function-call": "error", - "vue/component-name-in-template-casing": [ "error", "PascalCase" ], - "vue/no-child-content": "error", - "vue/no-expose-after-await": "error", - "vue/prefer-separate-static-class": "error", - "vue/no-v-text-v-html-on-component": "error" - } - } ] + "extends": "./vue/common" } diff --git a/vue-es5.json b/vue-es5.json index 82fe44d8..739dc170 100644 --- a/vue-es5.json +++ b/vue-es5.json @@ -1,3 +1,3 @@ { - "extends": "./vue2-es5" + "extends": "./vue/es5" } diff --git a/vue-es6.json b/vue-es6.json index 7acc7d32..dd1d3455 100644 --- a/vue-es6.json +++ b/vue-es6.json @@ -1,3 +1,3 @@ { - "extends": "./vue3-es6" + "extends": "./vue/es6" } diff --git a/vue/common.json b/vue/common.json new file mode 100644 index 00000000..9d988e98 --- /dev/null +++ b/vue/common.json @@ -0,0 +1,84 @@ +{ + "overrides": [ { + "files": [ "**/*.vue" ], + "extends": [ + "../common", + "./wrappers" + ], + "rules": { + "vue/component-tags-order": [ "error", { + "order": [ "template", "script", "style" ] + } ], + "vue/html-indent": [ "error", "tab" ], + "vue/html-closing-bracket-newline": "off", + "vue/max-attributes-per-line": [ "warn", { + "singleline": 2, + "multiline": 1 + } ], + "vue/no-boolean-default": [ "error", "default-false" ], + "vue/no-deprecated-scope-attribute": "error", + "vue/no-deprecated-slot-attribute": "error", + "vue/no-deprecated-slot-scope-attribute": "error", + "vue/no-duplicate-attr-inheritance": "error", + "vue/no-invalid-model-keys": "error", + "vue/no-multiple-objects-in-class": "error", + "vue/no-reserved-component-names": [ "error", { + "disallowVueBuiltInComponents": true, + "disallowVue3BuiltInComponents": true + } ], + "vue/no-static-inline-styles": "error", + "vue/no-undef-properties": "error", + "vue/no-undef-components": "error", + "vue/no-unsupported-features": [ "error", { + "version": "2.6.11" + } ], + "vue/no-unused-properties": [ "error", { + "groups": [ "props", "data", "computed", "methods", "setup" ], + "deepData": false, + "ignorePublicMembers": true + } ], + "vue/no-unused-refs": "error", + "vue/no-use-computed-property-like-method": "error", + "vue/no-useless-mustaches": "error", + "vue/no-useless-v-bind": "error", + "vue/no-v-text": "error", + "vue/order-in-components": [ "error", { + "order": [ + "el", + "name", + "parent", + "functional", + [ "delimiters", "comments" ], + [ "components", "directives", "filters" ], + "extends", + "mixins", + "provide", + "inject", + "inheritAttrs", + "model", + [ "props", "propsData" ], + "emits", + "setup", + "asyncData", + "data", + "computed", + "methods", + "watch", + "fetch", + "LIFECYCLE_HOOKS", + "head", + [ "template", "render" ], + "renderError" + ] + } ], + "vue/brace-style": [ "error", "1tbs", { "allowSingleLine": true } ], + "vue/padding-line-between-blocks": [ "error", "always" ], + "vue/v-on-function-call": "error", + "vue/component-name-in-template-casing": [ "error", "PascalCase" ], + "vue/no-child-content": "error", + "vue/no-expose-after-await": "error", + "vue/prefer-separate-static-class": "error", + "vue/no-v-text-v-html-on-component": "error" + } + } ] +} diff --git a/vue/es5.json b/vue/es5.json new file mode 100644 index 00000000..115684e9 --- /dev/null +++ b/vue/es5.json @@ -0,0 +1,3 @@ +{ + "extends": "../vue2/es5" +} diff --git a/vue/es6.json b/vue/es6.json new file mode 100644 index 00000000..a3fb5b6d --- /dev/null +++ b/vue/es6.json @@ -0,0 +1,3 @@ +{ + "extends": "../vue3/es6" +} diff --git a/vue-wrappers.js b/vue/wrappers.js similarity index 96% rename from vue-wrappers.js rename to vue/wrappers.js index 171444e3..e017c85b 100644 --- a/vue-wrappers.js +++ b/vue/wrappers.js @@ -6,7 +6,7 @@ * templates). Set the values for these wrapped rules to be equal to the corresponding values * in common */ -const commonRules = require( './common' ).rules; +const commonRules = require( '../common' ).rules; const rulesToMap = [ 'array-bracket-newline', 'array-bracket-spacing', diff --git a/vue2-common.json b/vue2-common.json index 1abf725d..7026c650 100644 --- a/vue2-common.json +++ b/vue2-common.json @@ -1,14 +1,3 @@ { - "overrides": [ { - "files": [ "**/*.vue" ], - "extends": [ - "plugin:vue/recommended", - "./vue-common" - ], - "rules": { - "vue/no-unsupported-features": [ "error", { - "version": "2.6.11" - } ] - } - } ] + "extends": "./vue2/common" } diff --git a/vue2-es5.json b/vue2-es5.json new file mode 100644 index 00000000..7cfd1617 --- /dev/null +++ b/vue2-es5.json @@ -0,0 +1,3 @@ +{ + "extends": "./vue2/es5" +} diff --git a/vue2-es6.json b/vue2-es6.json new file mode 100644 index 00000000..945de7be --- /dev/null +++ b/vue2-es6.json @@ -0,0 +1,3 @@ +{ + "extends": "./vue2/es6" +} diff --git a/vue2/common.json b/vue2/common.json new file mode 100644 index 00000000..cdc7269c --- /dev/null +++ b/vue2/common.json @@ -0,0 +1,14 @@ +{ + "overrides": [ { + "files": [ "**/*.vue" ], + "extends": [ + "plugin:vue/recommended", + "../vue/common" + ], + "rules": { + "vue/no-unsupported-features": [ "error", { + "version": "2.6.11" + } ] + } + } ] +} diff --git a/vue2-es5.js b/vue2/es5.js similarity index 84% rename from vue2-es5.js rename to vue2/es5.js index f0b75491..d317de81 100644 --- a/vue2-es5.js +++ b/vue2/es5.js @@ -5,11 +5,11 @@ module.exports = { "overrides": [ { "files": [ "**/*.vue" ], "extends": [ - "./vue2-common", + "../vue2/common", // We can't use ./language/es5 here, because ecmaVersion: 5 breaks the Vue plugin // Instead, use ES6, then es-x/no-2015 to prohibit ES6+ syntax - // But don't use ./language/es-6 directly, because we don't want rules-es6 - "./language/rules-es5", + // But don't use ./language/es6 directly, because we don't want rules-es6 + "../language/rules-es5", "plugin:es-x/restrict-to-es5" ], "plugins": [ "es-x" ], diff --git a/vue2-es6.js b/vue2/es6.js similarity index 77% rename from vue2-es6.js rename to vue2/es6.js index 5ff0332f..a311292b 100644 --- a/vue2-es6.js +++ b/vue2/es6.js @@ -5,8 +5,8 @@ module.exports = { "overrides": [ { "files": [ "**/*.vue" ], "extends": [ - "./vue2-common", - "./language/es6" + "../vue2/common", + "../language/es6" ] } ] }; diff --git a/vue3-common.json b/vue3-common.json index 0383ea6c..ef913a59 100644 --- a/vue3-common.json +++ b/vue3-common.json @@ -1,14 +1,3 @@ { - "overrides": [ { - "files": [ "**/*.vue" ], - "extends": [ - "plugin:vue/vue3-recommended", - "./vue-common" - ], - "rules": { - "vue/no-unsupported-features": [ "error", { - "version": "^3.2.0" - } ] - } - } ] + "extends": "./vue3/common" } diff --git a/vue3-es6.json b/vue3-es6.json new file mode 100644 index 00000000..60f0120c --- /dev/null +++ b/vue3-es6.json @@ -0,0 +1,3 @@ +{ + "extends": "./vue3/es6" +} diff --git a/vue3/common.json b/vue3/common.json new file mode 100644 index 00000000..b6cf67fa --- /dev/null +++ b/vue3/common.json @@ -0,0 +1,14 @@ +{ + "overrides": [ { + "files": [ "**/*.vue" ], + "extends": [ + "plugin:vue/vue3-recommended", + "../vue/common" + ], + "rules": { + "vue/no-unsupported-features": [ "error", { + "version": "^3.2.0" + } ] + } + } ] +} diff --git a/vue3-es6.js b/vue3/es6.js similarity index 77% rename from vue3-es6.js rename to vue3/es6.js index 1e9e6929..3bdff84d 100644 --- a/vue3-es6.js +++ b/vue3/es6.js @@ -5,8 +5,8 @@ module.exports = { "overrides": [ { "files": [ "**/*.vue" ], "extends": [ - "./vue3-common", - "./language/es6" + "../vue3/common", + "../language/es6" ] } ] };