mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-09-23 18:28:34 +00:00
Prevent our 'no-restricted-properties' from clobbering eslint-config-wikimedia
Our eslintrc extends from 'wikimedia/client' which includes a
'no-restricted-properties' ruleset from the 'not-es5.js' file [1].
However, we were also including our own 'no-restricted-properties'
rules.
ESLint handle this duplication by clobbering instead of merging
so eslint-config-wikimedia's no-restricted-properties where not taking
effect and we were losing out on some guards against using es6.
This commit corrects that and makes both no-restricted-properties
rulesets merge instead of clobber as already done in MobileFrontend [2]
[1] 07320f16ae/language/not-es5.js (L5)
[2] https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/.eslintshared.js
Bug: T239269
Change-Id: Ibc2c144be51719d71a4c1d5828486253a5d4bf5d
This commit is contained in:
parent
705c3327ee
commit
46ab5b9c36
|
@ -1,4 +1,10 @@
|
|||
{
|
||||
// "no-restricted-properties" rules are not properly merged when just using "extends".
|
||||
// Therefore we have to have this file which calls a custom merge function.
|
||||
// The merge function calls Object.assign with special handling for configuration such as
|
||||
// `no-restricted-properties` and `no-restricted-syntax` which are array based - ensuring the two
|
||||
// values being merged are concatenated.
|
||||
const merge = require( 'eslint-config-wikimedia/language/merge.js' );
|
||||
const config = {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"wikimedia/client",
|
||||
|
@ -40,4 +46,9 @@
|
|||
"no-use-before-define": "off",
|
||||
"no-underscore-dangle": "off"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Object.assign(
|
||||
config,
|
||||
merge( config, require( 'eslint-config-wikimedia/language/not-es5.js' ) )
|
||||
);
|
|
@ -1,4 +1,5 @@
|
|||
/* eslint-env node */
|
||||
/* eslint-disable no-restricted-properties */
|
||||
module.exports = function ( grunt ) {
|
||||
var conf = grunt.file.readJSON( 'skin.json' );
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": [
|
||||
"wikimedia/qunit",
|
||||
"../../.eslintrc.json"
|
||||
"../../.eslintrc.js"
|
||||
],
|
||||
"rules": {
|
||||
"no-restricted-properties": "off",
|
||||
|
|
Loading…
Reference in a new issue