Setup grunt-tyops and fix

Change-Id: I372c3cc5bedaf800716bff68cadb2846a399a42a
This commit is contained in:
Ed Sanders 2024-03-27 12:45:21 +00:00
parent 083900821e
commit a70f411ee1
5 changed files with 60 additions and 4 deletions

View file

@ -5,6 +5,7 @@ module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-tyops' );
grunt.initConfig( {
eslint: {
@ -20,9 +21,25 @@ module.exports = function ( grunt ) {
'modules/**/*.{css,less}'
]
},
tyops: {
options: {
typos: 'typos.json'
},
src: [
'**/*.{js,json,less,css,txt,php,md,sh}',
'!package-lock.json',
'!typos.json',
'!i18n/**',
'i18n/en.json',
'i18n/qqq.json',
'!lib/**',
'!{docs,node_modules,vendor}/**',
'!.git/**'
]
},
banana: conf.MessagesDirs
} );
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'banana' ] );
grunt.registerTask( 'test', [ 'tyops', 'eslint', 'stylelint', 'banana' ] );
grunt.registerTask( 'default', 'test' );
};

View file

@ -971,9 +971,9 @@ class CommentFormatter {
// Check fallback languages
$fallbackLanguages = $userLang->getFallbackLanguages();
foreach ( $fallbackLanguages as $fallbackLangauge ) {
if ( isset( $languages[ $fallbackLangauge ] ) ) {
return (bool)$languages[ $fallbackLangauge ];
foreach ( $fallbackLanguages as $fallbackLanguage ) {
if ( isset( $languages[ $fallbackLanguage ] ) ) {
return (bool)$languages[ $fallbackLanguage ];
}
}

13
package-lock.json generated
View file

@ -13,6 +13,7 @@
"grunt-banana-checker": "0.11.1",
"grunt-eslint": "24.3.0",
"grunt-stylelint": "0.19.0",
"grunt-tyops": "0.1.1",
"stylelint-config-wikimedia": "0.16.1"
}
},
@ -2515,6 +2516,12 @@
"stylelint": "15.x"
}
},
"node_modules/grunt-tyops": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/grunt-tyops/-/grunt-tyops-0.1.1.tgz",
"integrity": "sha512-fLTY6Ai1JpIv1INYCWq3/gNZKsvGrcg6M2XxBsmwdciY//3+12/dlKZy5C5HjjupwpcpScggilgSyvwnU+I1Fg==",
"dev": true
},
"node_modules/grunt/node_modules/argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@ -7046,6 +7053,12 @@
"chalk": "^4.1.2"
}
},
"grunt-tyops": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/grunt-tyops/-/grunt-tyops-0.1.1.tgz",
"integrity": "sha512-fLTY6Ai1JpIv1INYCWq3/gNZKsvGrcg6M2XxBsmwdciY//3+12/dlKZy5C5HjjupwpcpScggilgSyvwnU+I1Fg==",
"dev": true
},
"hard-rejection": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz",

View file

@ -11,6 +11,7 @@
"grunt-banana-checker": "0.11.1",
"grunt-eslint": "24.3.0",
"grunt-stylelint": "0.19.0",
"grunt-tyops": "0.1.1",
"stylelint-config-wikimedia": "0.16.1"
}
}

25
typos.json Normal file
View file

@ -0,0 +1,25 @@
{
"caseInsensitive": [
[ "paralell", "parallel" ],
[ "properites", "properties" ],
[ "visiblit(ies|y)", "visibilit$1" ],
[ "movablilties", "movabilities" ],
[ "inpsect(ors?|ion)", "inspect$1" ],
[ "\bteh\b", "the" ],
[ "intialization", "initialization" ],
[ "durring", "during" ],
[ "contian", "contain" ],
[ "occured", "occurred" ],
[ "pgk", "pkg" ],
[ "arrray", "array" ],
[ "overriden", "overridden" ],
[ "begining", "beginning" ],
[ "detatched", "detached" ],
[ "paramter", "parameter" ],
[ "descendent", "descendant" ],
[ "sepcific", "specific" ],
[ "connet", "connect" ],
[ "emtpy", "empty" ],
[ "langauge", "language" ]
]
}